qcustom使用OpenGL加速
qcustomplot开启opengl加速渲染,提示QOpenGLFramebufferObject::bind() called from incompatible context。
在QCPPaintBufferGlFbo::draw()前面加if(QOpenGLContext::currentContext() != mGlContext.data()) {
mGlContext.data()->makeCurrent(mGlContext.data()->surface());
}
使用setOpengl 出现这个情况:
void __cdecl QCustomPlot::setOpenGl(bool,int) QCustomPlot can’t use OpenGL because QCUSTOMPLOT_USE_OPENGL was not defined during compilation (add ‘DEFINES += QCUSTOMPLOT_USE_OPENGL’ to your qmake .pro file)
在pro文件加:Qt +=opengl
添加依赖项:
DEFINES += QCUSTOMPLOT_USE_OPENGL
如果报错不能使用glu的库,这个情况是缺少库文件:
加载qt5.x自带的OpenGL库文件:LIBS+=-lopengl32 -lglu32。
qcustom使用OpenGL加速

相关文章:

  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-12-05
  • 2022-12-23
  • 2023-03-19
猜你喜欢
  • 2022-12-23
  • 2022-01-02
  • 2021-08-17
  • 2021-09-11
  • 2021-12-05
  • 2022-12-23
  • 2021-06-28
相关资源
相似解决方案