How to use OpenGLContext::triggerRepaint

Hello all,

I am reading through the documentation of OpenGLContext and I’m left with the impression, that:

  1. An OpenGLContext may not be attached to a component
  2. That same OpenGLContext will have a renderer
  3. We can execute the OpenGLContext rendering function by invoking context.triggerRepaint()

I tried creating such functionality on my side, but it is not working if the OpenGLContext is not attached to a component. Looking at JUCE Framework code it appears that a component is indeed required.

I am trying to achieve the above to have OpenGL rendering working without blocking the Message Manager.

Any thoughts on the above?

UP

I believe attaching to a component is what sets the size and position of the OpenGL window that is floated on top. You can disable component rendering which will no longer lock the message thread.

When you attach an OpenGLContext to a Component, then a generic OpenGLRenderer is created to render the component and sub components through the OpenGLContext. I.e. the normal juce::Graphics commands are executed.

You can create and set your own OpenGLRenderer, which will execute the overridden renderOpenGL() method of the OpenGLRenderer. I.e. you can write “real” OpenGL commands there. Anything implemented in paint() won’t be rendered in that case IIRC.