Hi there,

i started a small project over at google code that provides you with
bindings for OpenGL ES 2.0 in Java. I started just a couple of hours
ago so it's not finished yet. The project includes the original
GLSurfaceView plus all the helper classes from the latest Eclair build
as well as a modified version of GLJNIView from the NDK samples which
is now a fully functional GLSurfaceView subclass called
GLSurfaceView20.

OpenGL ES 1.x and 2.0 are exclusive so you have to first check wheter
GL ES 2.0 is supported. You can check this via the following method:

 private boolean checkGL20Support( Context context )
    {
        EGL10 egl = (EGL10) EGLContext.getEGL();
        EGLDisplay display =
egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

        int[] version = new int[2];
        egl.eglInitialize(display, version);

        int EGL_OPENGL_ES2_BIT = 4;
        int[] configAttribs =
        {
            EGL10.EGL_RED_SIZE, 4,
            EGL10.EGL_GREEN_SIZE, 4,
            EGL10.EGL_BLUE_SIZE, 4,
            EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL10.EGL_NONE
        };

        EGLConfig[] configs = new EGLConfig[10];
        int[] num_config = new int[1];
        egl.eglChooseConfig(display, configAttribs, configs, 10,
num_config);
        egl.eglTerminate(display);
        return num_config[0] > 0;
    }

Based on the result you then instantiate either a GLSurfaceView or a
GLSurfaceView20. In the later case you should refrain from using GL10/
GL11 instances, most of the methods won't work with OpenGL ES 2.0.
Instead you simply instantiate a class called AndroidGL20 which offers
you the complete OpenGL ES 2.0 API.

The project is in its infancy meaning that a couple of the native
binding methods are stubs at the moment. I'm trying to fill all of
them up over the weekend so we have a working wrapper on monday.

This is a lot of work, i was able to generate the stubs automatically
but filling them in has to be done manually. If anyone can spend some
time on this with me contact me via badlogicgames at gmail.com.

You can find the complete source at http://code.google.com/p/gl2-android/.
The current source tree is not all that clean, i simply imported the
complete project to SVN. In order to build it you have to create an
Application.mk in a folder in the app/ directory of your NDK
installation. The Application.mk has to look like this

APP_PROJECT_PATH := /cygdrive/c/Users/mzechner/private-workspace/gl2-
android
APP_MODULES      := libandroidgl20

Simply substitute the APP_PROJECT_PATH with what you have and you are
ready to build. Note that i haven't optimized the Android.mk in the
jni/ directory of the project yet, later on everything will compile to
arm instead of thumb and some optimization flags will also be set.

I hope somebody is willing to help out a little. I'll report back any
progress on this here as well as on my blog at http://www.badlogicgames.com.

Ciao,
Mario

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to