glClear(GL_COLOR_BUFFER_BIT)之后OpenGL无效的帧缓冲区操作; [英] OpenGL invalid framebuffer operation after glClear(GL_COLOR_BUFFER_BIT);
问题描述
每次调用glClear(GL_COLOR_BUFFER_BIT);
后,都会收到OpenGL错误无效的帧缓冲区操作".
Every time after I call glClear(GL_COLOR_BUFFER_BIT);
, I get the OpenGL error "invalid framebuffer operation".
该呼叫似乎工作正常,并且似乎没有错.我在::paintGL()
方法中首先调用glClear(GL_COLOR_BUFFER_BIT);
.
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?
推荐答案
我的最佳猜测是您的帧缓冲区不完整,并且在不完整的帧缓冲区上调用glClear
会引发错误.
My best guess is that your framebuffer is not complete and calling glClear
on an incomplete framebuffer is throwing the error.
使用glCheckFramebufferStatus
检查帧缓冲区的状态,并确保其返回GL_FRAMEBUFFER_COMPLETE
.
Check the status of the framebuffer using glCheckFramebufferStatus
and make sure it returns GL_FRAMEBUFFER_COMPLETE
.
这篇关于glClear(GL_COLOR_BUFFER_BIT)之后OpenGL无效的帧缓冲区操作;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!