Hi,
The error is not with the previous post code.
When I added the following code then the model is displayed.
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. If I remove this
code then the model is not displayed. OpenGLES1 dosnt have this shaders.
2) If I add this code then the textures are not applied to my model. I got
model from 3DS MAX. How can I get textures?
Can you please guide me how to get textures? If shaders are necessary to render
model on Android then how can I handle textures (or any others) ? Is there any
tutorial to handle this in Android?
...
Thank you!
Cheers,
Koduri
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51112#51112
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org