Use of JUCE components in a basic OpenGL context

Hi everyone,


I would like to use GUI components of JUCE in a OpenGL project that I begin few days ago. Basically, I just want to know if it's possible to attach components of JUCE with a glut window, without launching a JUCE application.


If yes, how ? Because I draw a glut window, and I created a GUIComponent class that inherits from Component. But after this, I know that I should override paint function but I need the Graphics instance.


Can someone help me please ? :)

Thanks !

I'm not 100% sure I understand what you're trying to do, but I wouldn't recommend trying to integrate juce components into an app where something else provides the GL context - the amount of infrastructure you'd need to re-write to make that work would be enormous. Surely vastly easier to just have a juce app that creates the context, and do your other drawing using that?

Yeah, sure. I know that it would be easier ^^ Thing is, it's a student project so, I don't know if I can use it totally. I'll ask my professor.


Thanks for the reply !

I finally take the decision to use a juce application generated by the Introjucer. So basically, I would like to have a viewport for OpenGL rendering and have some GUI components from JUCE. 


I created a class that inherits from OpenGLRenderer and Component that contains a OpenGLContext. In the constructor, I did this:


    _contextOpenGL.setRenderer (this);
    _contextOpenGL.attachTo (*this);
    _contextOpenGL.setContinuousRepainting (true);

But when I run the application, I only see my base window, no opengl rendering. I'm not sure how to do so can someone explains me how combine openGL viewport in which I can draw a scene and JUCE GUI components please ? :)


Thanks !


After reading all posts in the forum and proofread my code, actually I realized that I made a stupid thing, I forgot to set the size of the OpenGL component... it works now.