Hiya, Not to hijack this thread, but I'm also interested in porting my osg application to an OpenGL ES2 device. I'm new to OSG and OpenGL but I understand that ES2 has some pretty significant changes in how things are drawn. What sort of steps should I be taking to accomplish this? I'm not sure what level of 'continuity' OSG offers between the different OpenGL versions, and I didn't design the original application with OpenGLES in mind (no shaders, just simple geometry, transforms and materials). Based on this thread I get the feeling I shouldn't expect my application to 'just work'... so what's the right way to proceed? Does 'most' of OSG's basic functionality still work with ES2? Will I need to rewrite much of my code?
I downloaded an OpenGLES2 emulator from PowerVR... I'll try to compile OSG for ES2 and see if I can get any examples working, but beyond that I really don't know how to approach this and would appreciate any advice. Regards, Preet On Mon, Apr 23, 2012 at 4:51 PM, Eduardo Poyart <poy...@gmail.com> wrote: > Very clarifying, thank you. > > I did experiment with ShaderGen and I even patched it to generate > GLES2 code. However I'm going in a different direction. > > My models are simple. I wrote my own shader and added it to the root > node. My shader currently has a fixed light position for testing > purposes. Now I want to render it with textures. > > If OSG would detect GLES2 and appropriately write standard-named > uniforms for textures, I could just use those names in the shader. > Maybe that needs to be done in State::applyModeOnTexUnit, since there > is code there for fixed-function Opengl (glEnable(GL_TEXTURE_2D)). > > If that seems like a good direction, I'll try to do it for textures. > The same thing can be done for light positions later. This way I leave > ShaderGen out of the way, and it can be improved later. > > Eduardo > > On Mon, Apr 23, 2012 at 7:51 AM, Robert Osfield > <robert.osfi...@gmail.com> wrote: >> Hi Thomas et. al, >> >> I won't have a chance to complete the shader composition functionality >> in the near term so an improved ShaderGen would be welcome. >> >> Handling items like lights, texgen and clipplanes will require some >> handling elsewhere other than with just the standard functionality - >> we'll need to have the osg::Light, osg::TexGen and osg::ClipPlane all >> be written as appropriate osg_* uniforms with the values being passed >> to OpenGL using the current modelview matrix as is done by OpenGL with >> the fixed function pipeline. This might require amendments to >> osg::State/osgUtil::RenderStage and the osg::Light, osg::TexGen and >> osg::ClipPlane, but it might also be possible with just amendments to >> state attributes if they do a little compute work prior to passing >> their values to OpenGL as uniforms. I would suggest finding a workable >> solution for lights then when this works roll it out for the other >> positional state. >> >> Thoughts? >> Robert. >> >> On 23 April 2012 15:16, Thomas Hogarth <thomas.hoga...@gmail.com> wrote: >>> Yes I have a GLES2 version of shader gen. At the moment it only supports a >>> fixed hardcoded light position, which isn't great but it does support, >>> texturing, lighting etc. >>> >>> I've attached it and we can look at including into core osg, but I think >>> support for at least the initial position of one light source would be >>> good. Also we need to either test for backward compatibility with GL2 or >>> have two versions of ShaderGen in the core. >>> >>> I know Roberts long term goal is to introduce a Shader Composer system >>> (bits and pieces already exist), but this can work as an aid to new >>> developers until then. >>> >>> Let me know how you get on with it. >> _______________________________________________ >> 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 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org