- 项目依赖库freeglut

- 代码修改

if (QOpenGLContext::currentContext() != mGlContext.data()) {
mGlContext.data()->makeCurrent(mGlContext.data()->surface());
}
【防止报错:QOpenGLFramebufferObject::bind() called from incompatible context】
- 开启OpenGL
本文介绍了一种解决OpenGL上下文切换导致的错误的方法。通过确保当前上下文与预期一致,避免了在不同上下文中调用OpenGL函数时可能出现的问题。


if (QOpenGLContext::currentContext() != mGlContext.data()) {
mGlContext.data()->makeCurrent(mGlContext.data()->surface());
}
【防止报错:QOpenGLFramebufferObject::bind() called from incompatible context】
2160
1512
400