QCustomPlot提示 “QOpenGLFramebufferObject::bind() called from incompatible context“

QCustomPlot提示 “QOpenGLFramebufferObject::bind() called from incompatible context” 解决方法

void QCPPaintBufferGlFbo::draw(QCPPainter *painter) const

方法中的

painter->drawImage(0, 0, mGlFrameBuffer->toImage());

之前添加

if(QOpenGLContext::currentContext() != mGlContext.data()) {
     
    mGlContext.data()->makeCurrent(mGlContext.data()->surface());
}

你可能感兴趣的:(QT,QT,QCustomPlot)