Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hi Robert, Could you post all the changes that want considered for inclusion with svn/trunk to osg-submissions as whole files as this is the avenue for submission and the form the should take. Cheers, Robert. On Tue, Mar 22, 2011 at 6:24 PM, Robert Timm m...@rtti.de wrote: Hi there, there are another two tiny patches I want to provide. They fix two OpenGL errors (printed as OSG warnings to stdout/stderr) which appeared on my machine when using a OpenGL ES 2 build. 1. One warning was written repeatedly to the terminal (while font rendering): Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..) 2. This warning was only printed once while initing: Warning: detected OpenGL error 'invalid enumerant' at Before Renderer::compile Find the patches in the attachment (numbered like above). Again, any kind of comment is appreciated :) Bye, rti -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37807#37807 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and OpenGL ES 2.0
Hi Ankur, On Sat, Apr 16, 2011 at 10:40 AM, Ankur Gandhi ank.gan...@tcs.com wrote: You are right. both are quire different. I ported OSG over OpenGL ES 2.0 and everything is behaving in different way. I guess I almost need to rewrite my OpenGL application. Also i think i need to go through ShaderGen to understand how well the OpenGL application gets converted to GLSL language. The big difference with GLES2 is that there is no fixed function pipeline so you have to provide shaders yourself. This situtation is the same for the GL 3.x and beyond profiles where backwards compatability is dropped, so it's in't really a case of GL vs GLES2, rather it's GL1/GLES1 fixed function vs GL3/GL4/GLES2 shader based, with GL2 sitting on the fence - doing both fixed function and shaders. You can also used shaders entirely with GL2, and even your the CMake to build only the shader backends, and not implement the fixed function state, so replicate much of what it takes to program GLES2 entirely on a machine with only GL2 available. This approach also allows you to build final applications that will more easily port between desktop and GLES2 targets. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and OpenGL ES 2.0
Hi Jorge, You are right. both are quire different. I ported OSG over OpenGL ES 2.0 and everything is behaving in different way. I guess I almost need to rewrite my OpenGL application. Also i think i need to go through ShaderGen to understand how well the OpenGL application gets converted to GLSL language. Cheers, Ankur -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38519#38519 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and OpenGL ES 2.0
Hi Christian, Thanks for your input and source code that you shared. I had tried your program however my application crashes with segmentation fault. when i check backtrace, it shows crashing point at the drivers (i am using intel i915 display). actually I am pretty new to OpenGL OpenGL ES too. so concept of Shader is new to me. So i think i need to go through shader first! :-) Also, i used OpenGL emulation for OSG build. now i think i will try by installing OpenGL ES library and perform build for actual GLES2. I will update you soon regarding my activities. Thanks again for help! Regards/Ankur Christian wrote: Hi, just one addition to my previous post: Normally you wouldn't define an extra vertex attribute array for the vertex color/normal as I did in this test code. Just use void Geometry::setColorArray(Array* array); void Geometry::setNormalArray(Array* array); and access the vertex color/normal in the vertex shader via osg_Color and osg_Normal (OSG will do the mapping for you). Cheers, Christian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38291#38291 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG and OpenGL ES 2.0
Hi, I am a new member of OSG. I am using 2.9.11 (latest developer release) version of OSG. In last few weeks, I used OSG over OpenGL. All the examples and Tutorials that are posted on the site have been very useful in learning OSG. Now, I want to use OSG over OpenGL ES 2.0. For this, I have modified cmake variables accordingly to emulate OpenGL ES on my ubuntu system. However I can't seem to get any example work. I get many different kinds of errors as below. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Warning: Material::apply(State) - not supported. Warning: TexEnv::apply(State) - not supported. Segmentation fault After going through old posts, i found that these examples won't work directly over OpenGL es. I would like to know if there are any examples available which i can use over OpenGL ES. It would really help me in figuring out if my OSG recompilation is successful and it will enable me to learn OSG over opengl ES. Thank you! Cheers, Ankur -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38244#38244 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and OpenGL ES 2.0
Hi, it's just a really simple scene but it should help you figuring out, if your OpenGLES 2.0 support works (tested on iPhone): Code: // create geometry osg::Group* scene = new osg::Group; osg::Geode* geode = new osg::Geode; osg::Geometry* geo = new osg::Geometry; scene-addChild(geode); geode-addDrawable(geo); // set vertices osg::Vec3Array* vertices = new osg::Vec3Array; vertices-push_back(osg::Vec3(0.0, 0.0, 0.0)); vertices-push_back(osg::Vec3(0.0, 0.0, 1.0)); vertices-push_back(osg::Vec3(1.0, 0.0, 0.0)); vertices-push_back(osg::Vec3(1.0, 0.0, 1.0)); geo-setVertexArray(vertices); // set colors osg::Vec4Array* colors = new osg::Vec4Array; colors-push_back(osg::Vec4(1.0, 0.0, 0.0, 1.0)); colors-push_back(osg::Vec4(0.0, 1.0, 0.0, 1.0)); colors-push_back(osg::Vec4(0.0, 0.0, 1.0, 1.0)); colors-push_back(osg::Vec4(1.0, 0.0, 1.0, 1.0)); geo-setVertexAttribArray(7, colors); geo-setVertexAttribBinding(7, osg::Geometry::BIND_PER_VERTEX); // set primitive set geo-addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLE_STRIP, 0, 4)); geo-setUseVertexBufferObjects(true); // declare shaders char vertSource[] = attribute vec4 osg_Vertex;\n attribute vec4 a_col; uniform mat4 osg_ModelViewProjectionMatrix;\n varying vec4 v_col; void main(void)\n {\n gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;\n v_col = a_col;\n }\n; char fragSource[] = precision mediump float;\n varying vec4 v_col; void main(void)\n {\n gl_FragColor = v_col;\n }\n; // set shader osg::Program* program = new osg::Program; program-setName( simple shader ); program-addShader( new osg::Shader( osg::Shader::VERTEX, vertSource ) ); program-addShader( new osg::Shader( osg::Shader::FRAGMENT, fragSource ) ); program-addBindAttribLocation(a_col, 7); geode-getOrCreateStateSet()-setAttributeAndModes( program, osg::StateAttribute::ON ); // set scene in viewer... HTH, Christian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38263#38263 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and OpenGL ES 2.0
Hi, just one addition to my previous post: Normally you wouldn't define an extra vertex attribute array for the vertex color/normal as I did in this test code. Just use void Geometry::setColorArray(Array* array); void Geometry::setNormalArray(Array* array); and access the vertex color/normal in the vertex shader via osg_Color and osg_Normal (OSG will do the mapping for you). Cheers, Christian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38270#38270 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hi rti, can you please post whole modified files to osg.submissions as noted on http://www.openscenegraph.org/projects/osg/wiki/MailingLists/SubmissionsProtocol Thanks, Stephan Am 22.03.11 19:24, schrieb Robert Timm: Hi there, there are another two tiny patches I want to provide. They fix two OpenGL errors (printed as OSG warnings to stdout/stderr) which appeared on my machine when using a OpenGL ES 2 build. 1. One warning was written repeatedly to the terminal (while font rendering): Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..) 2. This warning was only printed once while initing: Warning: detected OpenGL error 'invalid enumerant' at Before Renderer::compile Find the patches in the attachment (numbered like above). Again, any kind of comment is appreciated :) Bye, rti -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37807#37807 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hi there, there are another two tiny patches I want to provide. They fix two OpenGL errors (printed as OSG warnings to stdout/stderr) which appeared on my machine when using a OpenGL ES 2 build. 1. One warning was written repeatedly to the terminal (while font rendering): Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..) 2. This warning was only printed once while initing: Warning: detected OpenGL error 'invalid enumerant' at Before Renderer::compile Find the patches in the attachment (numbered like above). Again, any kind of comment is appreciated :) Bye, rti -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37807#37807 Index: src/osg/State.cpp === --- src/osg/State.cpp (revision 12261) +++ src/osg/State.cpp (working copy) @@ -900,7 +900,11 @@ if ( osg::getGLVersionNumber() = 2.0 || osg::isGLExtensionSupported(_contextID,GL_ARB_vertex_shader) || OSG_GLES2_FEATURES) { glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,_glMaxTextureUnits); +#ifdef OSG_GLES2_AVAILABLE +_glMaxTextureCoords = 1; +#else glGetIntegerv(GL_MAX_TEXTURE_COORDS,_glMaxTextureCoords); +#endif } else if ( osg::getGLVersionNumber() = 1.3 || osg::isGLExtensionSupported(_contextID,GL_ARB_multitexture) || Index: src/osgText/Text.cpp === --- src/osgText/Text.cpp(revision 12261) +++ src/osgText/Text.cpp(working copy) @@ -1209,12 +1209,12 @@ unsigned int contextID = state.getContextID(); state.applyMode(GL_BLEND,true); -#if 1 +#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) +# if 1 state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON); -#else +# else state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OFF); -#endif -#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) +# endif state.applyTextureAttribute(0,getActiveFont()-getTexEnv()); #endif if (_characterSizeMode!=OBJECT_COORDS || _autoRotateToScreen) @@ -1348,12 +1348,12 @@ } } -#if 1 +#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) +# if 1 state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON); -#else +# else state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OFF); -#endif -#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) +# endif state.applyTextureAttribute(0,getActiveFont()-getTexEnv()); #endif ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hi Rti Just found this post while finally trying out gles2 myself, saved me a ton of messing around thanks. Seems odd apple would do that removal of the OES. I'll make sure these changes get added to the git repository. Also if you check out the latest version there is now support for high res displays, multi touch input in osgGA, auto rotate of view, and use of external displays on IPads. Cheers Tom -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32701#32701 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hello, @Robert: Thanks a lot for your explanations! @tomhog: Very kind you mention that. I will check out the new version soon. Currently I was working on getting FreeType fonts rendered on the IPhone using ES2. There are still some problems, I am looking into that and will post updates into this thread. Bye, rti -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32702#32702 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
HI Robert, On Fri, Aug 27, 2010 at 3:50 PM, Robert Timm m...@rtti.de wrote: Ok, to keep this up to date, I managed to render a textured model using OpenGL ES 2.0 on the IPhone. Horay!! ;-) But I am not sure whether this is the way to go... With shaders there are a 101 ways to go :-) Using this code I get a textured model with some basic shading. But is this really the way to go? It feels so manual. But what ShaderGen does for OpenGL ES 2.0 does not work at all (does not compile due to usage of undefined variable names). Any hints or suggestions are very welcome! ShaderGen was written for GL2 so uses GL2 GLSL variables that aren't available. I've added some remapping of variables in osg::State to handle the most common ones but in the end it's only a temporary work around. ShaderGen itself is also just a temporary solution. ShaderComposition will the final solution, but this is still in development so for now you'll have to write all the shaders yourself. Furthermore I get tons of messages like: Code: Warning: detected OpenGL error GL_INVALID_ENUM after applying GLMode 0xba1 Warning: Material::apply(State) - not supported. Warning: detected OpenGL error GL_INVALID_ENUM after applying GLMode 0xde1 Warning: detected OpenGL error GL_INVALID_ENUM after applying GLMode 0xb50 Those modes correspond to GL_NORMALIZE, GL_TEXTURE_2D and GL_LIGHTING. Why does OSG still use them even it is compiled in OpenGL ES 2.0 mode? Am I doing something wrong? Or is it just work in progress? The OSG just passes OpenGL modes directly on to OpenGL/OpenGL ES making the assumption that you know what you are doing and the state you've set up in the scene graph is correct for your target. In your case you just need to remove these problem modes. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hi Paramar, On Fri, Aug 27, 2010 at 6:48 PM, Rakesh Parmar rakes...@kpitcummins.com wrote: How you have compiled and build for es 2.0 . No doubt he used my original discussions on osg-users the OpenGLES page that I've wrote and then he used heaps of his own initiative. Please explain to me i also want to build for es 2.0 using emulator. You are clearly struggling but no one will know what you are struggling with as you don't say. Most others have got far further than you with less information to go on. Those that have had problems have asked in my more useful ways that others can know what to say. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Ok, to keep this up to date, I managed to render a textured model using OpenGL ES 2.0 on the IPhone. But I am not sure whether this is the way to go... Vertex Shader: Code: varying highp vec2 tex_coord0; varying highp vec3 normal; varying highp vec4 position; void main(void) { tex_coord0 = gl_MultiTexCoord0.xy; normal = gl_Normal; position = gl_Vertex; gl_Position = gl_ModelViewProjectionMatrix * position; } Fragment Shader: Code: varying highp vec2 tex_coord0; varying highp vec3 normal; varying highp vec4 position; uniform sampler2D tex0; uniform highp vec4 light_pos; void main(void) { gl_FragColor = texture2D(tex0, tex_coord0) * (max(dot(normal, vec3(light_pos - position)) * 0.7, 0.3)); } I attach those shaders to the node containing the model: Code: osg::Program* program = new osg::Program; program-setName(shader2); program-addShader(new osg::Shader(osg::Shader::VERTEX, vertSource)); program-addShader(new osg::Shader(osg::Shader::FRAGMENT, fragSource)); model-getOrCreateStateSet()-setAttributeAndModes(program, osg::StateAttribute::ON); Using this code I get a textured model with some basic shading. But is this really the way to go? It feels so manual. But what ShaderGen does for OpenGL ES 2.0 does not work at all (does not compile due to usage of undefined variable names). Any hints or suggestions are very welcome! Furthermore I get tons of messages like: Code: Warning: detected OpenGL error GL_INVALID_ENUM after applying GLMode 0xba1 Warning: Material::apply(State) - not supported. Warning: detected OpenGL error GL_INVALID_ENUM after applying GLMode 0xde1 Warning: detected OpenGL error GL_INVALID_ENUM after applying GLMode 0xb50 Those modes correspond to GL_NORMALIZE, GL_TEXTURE_2D and GL_LIGHTING. Why does OSG still use them even it is compiled in OpenGL ES 2.0 mode? Am I doing something wrong? Or is it just work in progress? Thanks in advance, rti -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31107#31107 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG using OpenGL ES 2.0 on IPhone
Hi rti, How you have compiled and build for es 2.0 . Please explain to me i also want to build for es 2.0 using emulator. ... Thank you! Cheers, parmar -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=3#3 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG using OpenGL ES 2.0 on IPhone
Hello, In this post I want to report my progress on using OSG with OpenGL ES 2.0 on the IPhone. I am using OSG for my master thesis at the HPI. I needed a cross platform rendering system which supports OpenGL ES 2.0 (to have shader support on iOS). OSG was the only mature rendering system offering OpenGL ES 2.0 support and having some progress on running it on the IPhone. Building and setting up OSG on Mac and Windows was pretty easy. Luckily, there is an OSG fork on GitHub which has an IPhone branch (stmh/osg/tree/iphone). Using that branch, I managed to get an OSG sample running on the IPhone Simulator. I am using Version 4 of the iOS SDK, so I adjusted the Xcode project (IPhone_Project/OSGIPhone.xcodeproj) to use version 4 as the base SDK and changed the target to version 4 for the simulator. The only code change I had to make it get it running was: Code: diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp index 573886a..073beb8 100644 --- a/src/osgDB/FileUtils.cpp +++ b/src/osgDB/FileUtils.cpp @@ -51,7 +51,7 @@ typedef char TCHAR; //OSG_IPHONE //IPhone includes #include TargetConditionals.h - #if (TARGET_OS_IPHONE) !(TARGET_IPHONE_SIMULATOR) //only when on device + #if (TARGET_OS_IPHONE) #define stat64 stat #endif //OSG_IPHONE The sample was running, but only using OpenGL ES 1.x... Ok. So I started changing OSG's build config (IPhone_Project/config/osg/Config): Code: #ifndef OSG_CONFIG #define OSG_CONFIG 1 //static link needed on IPhone #define OSG_LIBRARY_STATIC #define OSG_USE_FLOAT_MATRIX /* #undef OSG_USE_FLOAT_PLANE */ #define OSG_USE_FLOAT_BOUNDINGSPHERE #define OSG_USE_FLOAT_BOUNDINGBOX #define OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION /* #undef OSG_USE_UTF8_FILENAME */ #define OSG_DISABLE_MSVC_WARNINGS /* #undef OSG_GLU_AVAILABLE */ /* #undef OSG_GL1_AVAILABLE */ /* #undef OSG_GL2_AVAILABLE */ /* #undef OSG_GL3_AVAILABLE */ /* #undef OSG_GLES1_AVAILABLE */ #define OSG_GLES2_AVAILABLE /* #undef OSG_GL_DISPLAYLISTS_AVAILABLE */ /* #undef OSG_GL_MATRICES_AVAILABLE */ /* #undef OSG_GL_VERTEX_FUNCS_AVAILABLE */ /* #undef OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE */ /* #undef OSG_GL_FIXED_FUNCTION_AVAILABLE */ #endif Next location for adjustments was the GraphicsWindowIPhone (src/osgViewer/GraphicsWindowIPhone.mm). GL functions which were suffixed with OES for OpenGL ES 1 do not have this suffix in OpenGL ES 2. So I changed the following: Code: diff --git a/src/osgViewer/GraphicsWindowIPhone.mm b/src/osgViewer/GraphicsWindowIPhone.mm index 9dab961..36cf916 100755 --- a/src/osgViewer/GraphicsWindowIPhone.mm +++ b/src/osgViewer/GraphicsWindowIPhone.mm @@ -11,6 +11,28 @@ #import OpenGLES/ES1/glext.h #else #import OpenGLES/ES2/glext.h +// in GLES2, the OES suffix if dropped from function names +#define glGenFramebuffersOES glGenFramebuffers +#define glGenRenderbuffersOES glGenRenderbuffers +#define glBindFramebufferOES glBindFramebuffer +#define glBindRenderbufferOES glBindRenderbuffer +#define glFramebufferRenderbufferOES glFramebufferRenderbuffer +#define glGetRenderbufferParameterivOES glGetRenderbufferParameteriv +#define glRenderbufferStorageOES glRenderbufferStorage +#define glDeleteRenderbuffersOES glDeleteRenderbuffers +#define glDeleteFramebuffersOES glDeleteFramebuffers +#define glCheckFramebufferStatusOES glCheckFramebufferStatus + +#define GL_FRAMEBUFFER_OES GL_FRAMEBUFFER +#define GL_RENDERBUFFER_OES GL_RENDERBUFFER +#define GL_RENDERBUFFER_WIDTH_OES GL_RENDERBUFFER_WIDTH +#define GL_RENDERBUFFER_HEIGHT_OES GL_RENDERBUFFER_HEIGHT +#define GL_COLOR_ATTACHMENT0_OES GL_COLOR_ATTACHMENT0 +#define GL_DEPTH_ATTACHMENT_OES GL_DEPTH_ATTACHMENT +#define GL_DEPTH_COMPONENT16_OES GL_DEPTH_COMPONENT16 +#define GL_STENCIL_INDEX8_OES GL_STENCIL_INDEX8 +#define GL_FRAMEBUFFER_COMPLETE_OES GL_FRAMEBUFFER_COMPLETE +#define GL_STENCIL_ATTACHMENT_OES GL_STENCIL_ATTACHMENT #endif #include IPhoneUtils.h Ok. Now OSG builds completely with the OpenGL ES 2 config. But running the sample application provided with the IPhone branch (IPhone_Project/iphoneExamples/simple/) fails while compiling the shaders. This happens due to quite hard restrictions in GLSL ES. This issue seems similar to thread #6120 (ShaderGen and OpenGL ES2). I started hacking around in src/osgUtil/ShaderGen.cpp, but I think the cleaner solution is to provide custom shaders. So finally, the OSG application code I am currently running on the IPhone (OpenGL ES 2), Windows (OpenGL 2) and Mac OS X (OpenGL 2) looks like this (only the essential parts shown): Code: #define SHADER_COMPAT \ #ifndef GL_ES\n \ #if (__VERSION__ = 110)\n \ #define lowp\n \ #define mediump\n \ #define highp\n \ #endif\n \ #endif\n static const char* vertSource = { SHADER_COMPAT // colors a fragment based on its position\n varying mediump vec4 color;\n void main(void) {\n color = gl_Vertex;\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n }\n }; static const char* fragSource = { SHADER_COMPAT varying
[osg-users] OSG and OpenGL ES?
Hi there, last time I asked nobody answered, so I try my luck again: is there anybody working on an OpenGL ES port? Robert, you hinted in an email earlier somebody works on a port - has there been anything substantial been created? I am just not interested reinventing the wheel ... Cheers, Hartmut -- Dr. Hartmut Seichter PhD (HKU), Dipl.-Ing. (BUW) Post-Doctoral Fellow, HIT Lab NZ +64 3 364 2987 Ext. 3078 http://www.hitlabnz.org/people/hse25 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG on OpenGL ES Progress?
Hi, Has there been any progress on the OpenGL ES front? I am referring to http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES H -- Dr. Hartmut Seichter PhD (HKU), Dipl.-Ing. (BUW) Post-Doctoral Fellow, HIT Lab NZ +64 3 364 2987 Ext. 3078 http://www.hitlabnz.org/people/hse25 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org