OpenGL invalid framebuffer operation after glClear(GL_COLOR_BUFFER_BIT);

houbysoft picture houbysoft · Jun 18, 2012 · Viewed 10.9k times · Source

Every time after I call glClear(GL_COLOR_BUFFER_BIT);, I get the OpenGL error "invalid framebuffer operation".

The call seems to work just fine, and nothing seems wrong. I call glClear(GL_COLOR_BUFFER_BIT); first thing in the ::paintGL() method.

Huh? Should I just disregard this error?

Answer

James picture James · Jul 27, 2012

My best guess is that your framebuffer is not complete and calling glClear on an incomplete framebuffer is throwing the error.

Check the status of the framebuffer using glCheckFramebufferStatus and make sure it returns GL_FRAMEBUFFER_COMPLETE.