QCustomPlot Discussion and Comments

QCP 2.0 opengL Return to overview

Hi All,
I have an application, with two QCP Customplots in one Qt 5.8 dialog. Iam on windows 10/x64.
This all working just fine using non-openGL, now trying to use openGL.

I have added a preprocessor defined telling it to build using openGL, also I call setOpenGL(true) on both of them.

But when I resize the dialog both plot will end up with the same data. Obviously something in openGL (context?) is being shared between the plots. When I zoom out on an individual plot it shows the correct one again. But when resizing again both become the same.

I have played around with the openGL functions but to no avail.

I see in my debug about sometimes this message:

QOpenGLFramebufferObject::toImage() called without a current context

Any idea's how to resolve this?
Kind Regardsm

I managed to fix this by changing QCustomPlot slightly:

Add to the bottom of function:
void QCPPaintBufferGlFbo::draw(QCPPainter *painter) const
the following code before the call to
painter->drawImage(0, 0, mGlFrameBuffer->toImage());

if (mGlContext.data() != QOpenGLContext::currentContext())

Now it all works fine.