I’ve been trying to draw 2D things and 3D things at the same time. The 2D things are child components of something attached to an OpenGLContext which is drawing 3D things in its `renderOpenGL’ method.
What happens though, is that Juce is also using OpenGL to render the 2D things. This is not a bad thing except that, due to OpenGL being state based, they sometimes step on each others’ toes.
The first problem, was that i needed to reset various OpenGL modes before the 2D drawing would work at all.
glDisable( GL_DEPTH_TEST );
This was simple enough, but then i ran into a problem that took me hours to track down to to with the use of texture units.
To cut a long story short, I eventually managed to get things to work by settings the active texture unit back to GL_TEXTURE0 after my own stuff.
In particular some of the 2D components worked fine, but those using, for example, GradientFill such as the Slider came out entirely black (although they functionally worked).
So my questions are;
should the above line be in Juce where it relies on this, is there any other state i need to put back or not mess with (although it does seem to work currently) and should i be somehow making Juce use its 2D code (rather than opengl) in the first place for its components.
Thanks for your pointers.
BTW, it did originally work on Windows, but failed on Android (iOS not tested yet). I hate these Android only problems!