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 <[email protected]> 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 <[email protected]> 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 > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

