Hello Everyone,

Well, in on of my previous threads, i was advised against using glut. But i 
thought of using glut temporarily and get more familiar with the other classes.

So, i modified osgviewerGLUT.cpp like this, in order to get some translation 
and rotation.


Code:
// global
osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform;
osg::Matrix m, r;
int rot;

void display(void)
{
        m.setTrans(10, 0, 0 );
        mt->setMatrix( m );
    
        // update and render the scene graph
        if (viewer.valid()) {
                r.makeRotate( rot += 10, osg::Vec3( 1., 0., 0. ) );
                viewer->getCamera()->setViewMatrix( r );
                viewer->frame();
        }

    // Swap Buffers
    glutSwapBuffers();
    glutPostRedisplay();
}




But this does not work. What is wrong with the code? Can anyone provide some 
help?

i added

Code:
 viewer->getCamera()->setProjectionMatrixAsPerspective(
                                            40., 3., 1., 100. );



and the projection matrix was manipulated. But i could not get rotation and 
translation work from the pasted code. What could be wrong?

PS: Could anyone please throw some light as to how the matrices are manipulated 
in OSG? Some links would be really helpful.

Thanks,
Mukund

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36144#36144





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to