PDA

View Full Version : Model View Matrix Value when using MFC



miztaken
07-12-2010, 08:22 AM
Hi,
I am developing opengl application using MFC.
I am having a problem while getting the value (array) of model view matrix.
In opengl window, i dont see any problem.

but in MFC window when i execute following command i get garbage values.

glGetDoublev( GL_MODELVIEW_MATRIX,m_dmodelview);

It doesnt return the actual modelview matrix array ( that is changed when scene is drawn)

Is it because i am rendering my scene in picture box of MFC dialog.
If yes, please let me know what should i do.

thanks

strattonbrazil
07-12-2010, 11:04 AM
The OpenGL calls assume a certain context when running so if you're calling glGetDouble, you need to make sure it's being called in the context of the correct OpenGL state.

For example, if an app has two OpenGL windows, it will have two contexts and each call to glGetDouble will depend on which window you're calling it from.

I would recommend calling glGetDoublev in your display call and saving it off somewhere. Then when you want it, you can just read from that location instead of actually querying from OpenGL when you're outside of an OpenGL context.

miztaken
07-12-2010, 01:48 PM
thanks a lot.. that was the problem.. i fixed it.