Invalid OpenGL framebuffer operation after glClear (GL_COLOR_BUFFER_BIT);

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

It seems that the call is working fine and nothing seems to be wrong. I call glClear(GL_COLOR_BUFFER_BIT); first thing in the ::paintGL() method.

A? Should I just ignore this error?

+6
source share
2 answers

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

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

+4
source

I had a problem with osx using NSOpenGLView with CVDisplayLink to call the render callback.

Be sure to wait until NSOpenGLView is fully displayed before rendering, i.e.

 -(void)viewDidAppear { [super viewDidAppear]; CVDisplayLinkStart(_displayLink); } 

Doing this in viewDidLoad is too early.

+2
source

Source: https://habr.com/ru/post/918396/


All Articles