Calling OpenGL functions in Android

I need to use some opengl functions in Android. I can’t use them form jMonkey directly since, as far as I know, they are features not implemented yet (stencil buffer drawing in particular). Do you know how could I do that? I thought of calling opengl functions directly, from android.opengl, but I guess they cannot be called from outside the render threads of the GLSurfaceView. In that case, should I reimplement OGLESContext and other android-related classes to get it to work, or is there any other way to call raw gl functions in Android? Thanks!

We do not recommend to do this usually as all is wrapped by the renderer, but i reckon there are missing functionality in the android renderer.

you can make any GL code from the jme application and you won’t have any thread issue.

If you call this from the android activity you have to enqueue the calls to the JME app


Stencils are supported in the renderer, you should rather look into making it work n the android renderer than putting gl calls in your application.

Stencil is supported in jME3, but the Android renderer doesn’t support it. The proper calls will need to be copied from the LWJGL renderer and placed in the Android renderer. Once you do that, post a patch so it can be added to core.