Hi Alessandro, ShaderComposition still requires you to put together the shaders so won't instantly give you what you after. The ShaderComposition functionality is also experimental.
In your case it's probably best just to implement your own shaders. Something I am working on right now is a means for mapping OpenGL old style glEnable/glDisable to #define's inserted into a shaders when they are compiled. If I can get this to work it'll probably a simpler means for emulating the fixed function pipeline by provided a uber osg::Program that contains all the key functionality you'll need for your scene graph and then have the different parts enabled/disabled via osg::StateSet::setMode(..). This will reduce the need for having lots of different osg::Program and shaders for different parts of your scene graph i.e. textured, non textured, light, no light etc. My plan for the week is to wrap up this new functionality and get it released in the next dev release, and part of OSG-3.4 thereafter. Robert. On 26 January 2015 at 11:16, Alessandro Terenzi <[email protected]> wrote: > Hi, > I'm trying to develop apps for iOS using GLES 2, so far I managed to build > OSG 3.2.1 to use GLES 2 and as long as I create some geometry and manually > load/apply GLES 2 shaders everything is fine. On the other hand I am > experiencing some issues when I try to load models from files (not > containing any shader definition - OBJ, FBX and some OSG/OSGT). > > I know that when I use such kind of models then I should provide GLES 2 > shaders in order to display them and, to my understanding, there are 3 > possibilities: > > 1) manually apply shaders to the loaded model > > 2) use ShaderGenVisitor that generates shaders automatically > > 3) use Shader Composition > > I tried using ShaderGenVisitor, but it looks like that the shaders that > are generated are not GLES 2 compliant (because of missing pre-built > attributes), and even though attribute aliasing is applied, not every "gl_" > attribute is translated to the corresponding "osg_" version. For instance > in the converted version I have a row like this: > > gl_Position = osg_ModelViewProjectionMatrix * gl_Vertex; > > Note that only "gl_ModelViewProjectionMatrix" has been converted but for > some reason "gl_Vertex" has not changed. > > Also, there are attributes that are not translated at all, like > gl_TexCoord and gl_LightSource. > > Searching the forum, it looks like that the ShaderGen approach should be > replaced by Shader Composition, so I wanted to try it but I'd need some > directions to start with it...so far I only managed to enable it like this: > > state->SetShaderCompositionEnabled(true); > > Where state comes from the viewer's window. But no model is displayed by > the viewer. > > Actually I am not sure at all that I should use Shader Composition, so my > question is: if in my GLES 2 app I want to display models loaded from files > (not containing any shader definition), what should I use and where should > I look at to get started? > > Thanks. > Alessandro > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=62475#62475 > > > > > > _______________________________________________ > 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

