Hi Sajjadul, There are plenty of shader examples in OpenSceneGraph/examples and OpenSceneGraph-Data/shaders. Just search from "osg::Shader" in the OSG code base and you'll find plenty of examples. Most with just use the OpenGL builts of gl_ModelViewMatrix etc, which is available in OpenGL 2 or OpenGL 3 and later versions of OpenGL when you use the compatibility profile so you won't need to use the osg_ModeViewMatrix etc. If you do need to use the OSG built-ins then switching it on is required, see the osgsimplegl3 for using the OSG with an OpenGL version without the backwards compatible context.
Robert. On 18 February 2013 05:11, Sajjadul Islam <[email protected]> wrote: > Hi forum, > > I am trying to implement the diffuse shading using shaders and i need to > access the model view and projection matrix in the shader. There are built-in > uniform variables in osg to get those information. > > Is it possible to extract the model , view and projection matrices separately > ? > > There is only function i found in the sceneview.cpp to extract the viewmatrix > by the following snippet: > > > Code: > > stateset->getOrCrateUniform(); > > > > > Is there any unifroms to find the rest of the matrices? > > In one of the post robert suggested to enable the following: > > > Code: > > osgState state; > state.setUseModelViewAndProjectionUniforms(true); > > > > > How to set the state to the model on which i shall do the shading calculation > ? > > So far i only know how to extract the stateset of the model by the following > call: > > > Code: > > osg::StateSet* stateset = model->getOrCreateStateSet(); > > > > > > If there any examples in the repository answer to all my questions, please > refer me to it. > > > Thanks > Sajjadul > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=52722#52722 > > > > > > _______________________________________________ > 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

