qcustom使用OpenGL加速

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。
可以看到OpenGL已经进行显卡绘图了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值