Using Juce to Create UI For Existing OpenGL App

Hello everyone,

My situation: I have an OpenGL app with no UI, I'd like to integrate Juce into this app to create a UI. I was hoping to get some help getting started.

Does any one have any insight on how I could achieve this? The app in question uses a library written from the ground up to handle windowing & keyboard events.

I'm going to dive into the source now but If anyone is willing to help me get on my feet, I'd save me a lot of time and I'd greatly appreciate it.


It'd be easier the other way round - i.e. adding existing openGL code to a juce app. It's probably possible to hack things so that the juce rendering engine can draw onto a GL context that is supplied by something else, but it could get quite messy!

If my app created the rendering context (not using Juce), wouldn't the GL calls used by Juce's renderer just use that context? For rendering I figured all I'd need to do is: get Juce's renderer to write all UI elements to a single framebuffer and composite the UI in my app's renderer. As far as interaction is concened, wouldn't I just need to figure out a way to pass key events to Juce's input manager? Am I horribly mistaken?

I spent yesterday going through the source, I'm still familiarizing myself with Juce's architecture. But if you have any insights please let me know.


EDIT: I should mention, I'm not going to be creating multiple windows, referring to the JuceDemo: I really only need the features of the "Look And Feel", "Settings" & "MDI" demos. My framework will handle everything else. Ideally I want to be able to nest buttons into a modal which can me moved around ("Look And Feel" + "MDI"). 

TBH I don't know what might be involved in making that happen, but you may need to spoof things like the OpenGLContext class, etc, which have been designed to assume that they're in charge of the infrastructure. Passing key events is pretty easy, you'd just call the appropriate methon in ComponentPeer.


I hope you will sort this out with Jule's help. 

It can be a great opportunity for juce to be referenced as a viable GUI framework for game developers. 

I used some of them, and it is really painful compared to juce system.