Simple Multiple openGLContext (or how to integrate Spout in Juce)


#1

Hi,
i’m trying to integrate Spout (Syphon for Windows) in Juce, and i saw some code from alfaleader that shows a basic class, but this class derives from OpenGLRenderer and when i instantiate it, the newOpenGlContextCreated override is never called, nor any gl override.

So before i’m spending more time on it, any idea on how to create other openGlContext in order to get Spout to work (in a clean way)

Thanks
Ben


#2

You need to have an OpenGLContext as a member variable and then add your OpenGLRenderer as a callback of that context:

class MyClass : public OpenGLRenderer
{
     MyClass()
     {
           ....
           openGLContext.setRenderer (this);
     }
 
      ...   

 private:
     OpenGLContext openGLContext;
 };

Note that you also need to attach the OpenGLContext to a component and that that component must be visible on the screen before you get any open gl render callbacks.