Problem attaching an OpenGLContext to a DocumentWindow


I've been doing some experimentation with the OpenGLContext in a sample app trying to figure out how to best organize things if I'd like to mix Juce components and OpenGL rendering.  I started out by trying to attach an OpenGLContext to the app's main window, which subclassed DocumentWindow, and that seemed to cause some weird behavior with OpenGL rendering. Everything worked fine if continuous repainting was enabled on the OpenGLContext, but if that was turned off, the only way I could get things to repaint correctly was after my component hierarchy changed, I'd have to call triggerRepaint() on the OpenGLContext on a timer; if I waited 100 msecs to call triggerRepaint(), the OpenGL code would repaint correctly (except the background color I set wouldn't take); a timer between 50 to 100 msec would work sometimes, and a timer less tha 50 msec wouldn't work .

I figured out that if I attached the OpenGLContext to the DocumentWindow's content component instead everything was fine, but it took me quite some time to realize that was the problem.  So, I wanted to point out that I stumbled on this.  Maybe, there's a bug there that needs to be fixed.  Or maybe, a note could be made about this in the attachTo() method of OpenGLContext.  In any case I have some sample code showing the problem if that would be helpful.


Are you running a full-screen app on Windows? I vaguely remember there was some kind of weirdness in that case, unless you allowed a pixel border around the edge of the embedded GL window, but can't remember the details right now..


I noticed some similar weird behaviour regarding OpenGL rendering on Windows in KioskMode/Fullscreen:

But i never noticed any problems as long as KioskMode is disabled.

I just tested whether attaching the OpenGLContext to the content component instead of the DocumentWindow also makes a different in my case, but interestingly it did not change anything.

There is definitely a bug with OpenGL rendering on Windows and i wouldn't be surprised if these problems are somehow connected.





Ok. Well, if you can post some sample code I could try, I'll take a look.