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: glGetError problem

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Dunedin, New Zealand
    Posts
    3

    glGetError problem

    I am writing a multithreaded MFC program. There are two threads: One
    does some processing on each of several models and sends messages to the
    second, which draws the models.

    The second thread has two methods that may be activated by the messages
    from the first. One is OnPaint, and the other is my own DrawModel.
    DrawModel is called for each model and the OnPaint is called to start
    the next frame. The OnPaint method draws some axis, swaps the back
    buffer into the front, and the clears the back buffer, in that order.
    This all works fine. If I call glGetError in this method it returns
    GL_NO_ERROR.

    The DrawModel method works fine in that it gets called and does all the
    non openGL stuff in it. But none of the openGL commands are executed
    and if I call glGetError I get GL_INVALID_OPERATION. If I loop around
    only calling glGetError and reporting the error, I still get
    GL_INVALID_OPERATION every time, which makes me think that the
    glGetError funtion itself is causing an error.

    Any ideas what could be wrong? I use the OnPaint method by calling the
    InvalidateRect(NULL, FALSE) method. Is there something that
    InvalidateRedt does that I need to do when I call DrawModel?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Santa Clara, CA
    Posts
    172

    Re: glGetError problem

    I'm a little bit confused by your description, but here are two things to check.

    1) If you have no context bound in the current thread, calling glGetError() is itself an error. Make sure you are calling it from the rendering thread.

    2) Never call glGetError() inside a begin/end, as that will cause an error.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2000
    Location
    SF, CA, USA
    Posts
    3

    Re: glGetError problem

    You need to call wglMakeCurrent() with the current HDC on entry to your Draw routine.

    It's a good idea to also call it again with NULL context on exit, especially in case of multiple views or threads.

Posting Permissions

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