Hi Janling,

On 5/15/06, Yanling Liu <[EMAIL PROTECTED]> wrote:
Hi, My program create OpenGL context using Fox::GLCanvas, then I have a osgUtil::SceneView to handle rendering.

Here is my code for rendering

m_sceneVeiw->update();
m_sceneView->cull();
m_scaneView->draw();

The problem is I cannot get OpenGL projection and modelview matrix using glGetDoublev(...). All I got is identity matrix for both projection and modelview.

You can only use glGet* methods from within the current context.  Also the OSG itself manages the projection and model view matrices so these values will change throught the draw traversal.

So the questions are:
1. does osg has any special process/locking about OpenGL projection and modelview matrix?

No, but OpenGL is state machine, you'll only ever be abe to get the last values applied to OpenGL using glGet methods, and you can only do it from a valid graphics context.  As a general note, avoid using glGets in OpenGL application, as it can stall the whole graphics pipeline and kill performance.

2. Is that safe to use camera projection and modelview matrix of osgUtil::SceneView when I need to use OpenGL projection and modelview matrix?

When and why do you need the projection and modelview matrices?

If you need them from the draw traversal then look no further than the osg::State object passed into each Drawable::drawImplementation(State&) and the osg::State object has getProjectionMatrix and getModelViewMatrix() methods, these just return locally cached OSG matrices, and don't require any glGet* which is a boon for convinience and performance.

Robert.


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

Reply via email to