Open GL issue


#1

When i open the Juce-Demo on my Galaxy Nexus, and switch to the OpenGL-Demo tab, i don’t see the part which should be rendered by OpenGL, and if i switch back to the home screen, i get this weird picture.
It seems that the GL-Part was behind the other stuff, and that the GL Context has to be cleared after (or before?!) the app becomes inactive.
BTW: The whole GUI should be higher scaled (https://github.com/jchkn/ckjucetools/blob/master/GuiLayout/ScalableContainer.h), the buttons become to small on high resolution displays.

[attachment=0]Screenshot_2013-03-30-16-47-05.png[/attachment]


#2

depending on the device, the OGL context is thrown away when the app is paused. such as when you switch away from the app or a call comes in, for example. A lot of newer devices are able to keep the OGL context around however. Another time, it’s thrown away is when you re-orient the unit.

you are supposed to magically reload all your assets into the OGL context. Unfortunately, any well written OGL app with have pretty much everything in the OGL context; geometry, attributes, textures etc. so reloading takes the same time as startup, which is crazy when you turn your unit :frowning:

ok, you can fix this by going to API 11 or better. add `setPreserveEGLContextOnPause’ in your java activity as follows:

[code] OpenGLView (Context context)
{
super (context);
setEGLContextClientVersion (2);
setRenderer (this);
setRenderMode (RENDERMODE_WHEN_DIRTY);

        // dont trash the OpenGL context all the time
        setPreserveEGLContextOnPause(true);  // API 11
    }[/code]

it’s also possible to fix this for api 10 by devious means…