Search code examples
c++openglglutglfwfreeglut

Swapping buffers with core profile uses invalid operations


Whenever I call a function to swap buffers I get tons of errors from glDebugMessageCallback saying:

glVertex2f has been removed from OpenGL Core context (GL_INVALID_OPERATION)

I've tried using both with GLFW and freeglut, and neither work appropriately.

I haven't used glVertex2f, of course. I even went as far as to delete all my rendering code to see if I can find what's causing it, but the error is still there, right after glutSwapBuffers/glfwSwapBuffers.
Using single-buffering causes no errors either.

I've initialized the context to 4.3, core profile, and flagged forward-compatibility.


Solution

  • As explained in comments, the problem here is actually third-party software and not any code you yourself wrote.

    When software such as the Steam overlay or FRAPS need to draw something overtop OpenGL they usually go about this by hooking/injecting some code into your application's SwapBuffers implementation at run-time.

    You are dealing with a piece of software (RivaTuner) that still uses immediate mode to draw its overlay and that is the source of the unexplained deprecated API calls on every buffer swap.