Hi,
I completed osgAndroid Example with GLES1 successfully. If I try to run the
same example with OpenGLES2 then the OSG model is not rendering. If I add the
following code then I am able to see the model on my device.
Code:
mtForMarker[idx]=new osg::MatrixTransform();
osg::Shader * vshader = new osg::Shader(osg::Shader::VERTEX,
gVertexShader );
osg::Shader * fshader = new osg::Shader(osg::Shader::FRAGMENT,
gFragmentShader );
osg::Program * prog = new osg::Program;
prog->addShader ( vshader );
prog->addShader ( fshader );
mtForMarker[idx]->getOrCreateStateSet()->setAttribute ( prog );
mtForMarker[idx]->addChild(loadedModel[idx].get());
modelSwitch->addChild(mtForMarker[idx].get());
osgViewer::Viewer::Windows windows;
_viewer->getWindows(windows);
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr !=
windows.end();++itr)
{
(*itr)->getState()->setUseModelViewAndProjectionUniforms(true);
(*itr)->getState()->setUseVertexAttributeAliasing(true);
}
This code I added from osgAndroidOpenGLES2 example.
As I am new to OSG I have two doubts
1) Why should I add the shaders in OpenGLES2 to display model.Can't I display
the model with out this Shaders code. OpenGLES1 example doesn’t have this
shaders.
2) If I add the shaders then the fixed functionalities like textures, lighting
etc. were disabled. But I need to enable them because I got model from 3DS MAX.
How can I enable fixed functionalities?
Can you please guide me how to enable fixed functionalities? If shaders are
necessary to render model on Android with OpenGLES2 then how can I handle
textures (or any others fixed functionalities) ? Is there any tutorial to
handle this in Android?
NOTE:- By mistake i posted the same under "Build System" category.
...
Thank you!
Cheers,
Koduri
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51130#51130
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org