HI Yanling,

I am not quite sure when you are saying the current context. Are you talking about osg's current context or OpenGL's context? I am sure I have used glGet* methods in the current OpenGL context. Also I have tried to use glGet* in osgHud examples like this:

while( !viewer.done() )
    {
        // wait for all cull and draw threads to complete.
        viewer.sync();

        // update the scene by traversing it with the the update visitor which will
        // call all node update callbacks and animations.
        viewer.update();

        double proj[16];
        glGetDoublev(GL_PROJECTION_MATRIX, proj);
        //after get I output the projection matrix using std::cout
        //std::cout<<proj[0]<<" "<<proj[1]<<" ".....

        // fire off the cull and draw traversals of the scene.
        viewer.frame();
       
    }


The glGetDouble is not in thread that has the current graphics context as will produce undefined results if not a crash...

Use the Viewer's (subclassed from Producer::CameraGroup) setLens/getLens and getViewMatrix.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to