Results 1 to 3 of 3

Thread: glGetError problem

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

    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

    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
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Santa Clara, CA

    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
    SF, CA, USA

    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.

Similar Threads

  1. glGetError joy
    By Jeff Russell in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 03-03-2008, 02:26 AM
  2. glGetError always returns zero
    By remdul in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-18-2008, 08:14 AM
  3. glGetError
    By ToddAtWSU in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-23-2007, 06:33 PM
  4. glgeterror
    By cem polat in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 10-05-2004, 12:30 PM
  5. glGetError
    By mdog1234 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-13-2003, 02:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean