Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Model View Matrix Value when using MFC

  1. #1
    Junior Member Newbie
    Join Date
    May 2010
    Posts
    13

    Model View Matrix Value when using MFC

    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

  2. #2
    Member Regular Contributor strattonbrazil's Avatar
    Join Date
    Jun 2007
    Location
    Los Angeles, CA
    Posts
    305

    Re: Model View Matrix Value when using MFC

    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.

  3. #3
    Junior Member Newbie
    Join Date
    May 2010
    Posts
    13

    Re: Model View Matrix Value when using MFC

    thanks a lot.. that was the problem.. i fixed it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •