Very well. Some preliminary remarks:
The sphere Code: geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3d(0,0,0), 6500000.0))); has a radius of 6.5E6, whereas your orthographic frustum Code: node->setProjectionMatrix(osg::Matrix::ortho2D(0, 1600, 0, 900)); is 3 magnitudes smaller along each axis. That would never fit around the whole sphere, but apparently, so see the sphere nevertheless That gives rise to the notion of some "mangling" being done behind the scenes. Again the sphere Code: geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3d(0,0,0), 6500000.0))); It's at origin. as initially is world respective to cam coords Code: node->setViewMatrix(osg::Matrix::identity()); . cam would sit inside the sphere, if no mangling was done. osgViewer::Viewer::run() http://trac.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/include/osgViewer/Viewer > /** Execute a main frame loop. > * Equivalent to while (!viewer.done()) viewer.frame(); > * Also calls realize() if the viewer is not already realized, > * and installs trackball manipulator if one is not already assigned. > */ > and it's obvious that there is a manipulator installed, because the viewer is responsive to mouse events. If you log the view matrix before the viewer.run() you get the identity matrix you set. But If log dump the view matrix from within run(), e.g in your Code: UpdateUniformsCallback::operator() you get 1 0 0 0 0 0 1 0 0 -1 0 -4.47409e+07 0 0 0 1 thus world has been tilted by [pi/2,0,0] and shifted ~4.5E7 to the back. That's it about the maths. Now about the uniforms - you have to do Code: pref->getState()->setUseModelViewAndProjectionUniforms(true); pref->getState()->setUseVertexAttributeAliasing(false); // depands on the shader code for all valid Code: osgViewer::ViewerBase::Contexts:.value_type pref; after the view has been realized once but before the run. I will give you code for that after you'll have figured out your compiler's C++ support. Cheers, Solkar Code: ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60183#60183 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org