views:

62

answers:

2

Hello,

I'm developing a game for Android, and I made it using OpenGL ES 2.0. Now I want to add support for devices that do not have OpenGL ES 2.0 support, and use OpenGL ES 1.0 instead.

My problem is that I can't seem to detect the right OpenGL ES version. I used the example in the SDK, but it simply returns 0 on my Legend.

This is what I've tried:

    ActivityManager am = (ActivityManager) getSystemService(getApplication().ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();

    String eglVersion = info.getGlEsVersion();
    if (eglVersion == "2.0") GameLibrary.load_gl20();
    else GameLibrary.load_gl10();

(GameLibrary is a class containing some native methods, and load_glxx are static methods calling System.loadLibrary() with the specific library for the right opengl ES version) The problem is as i said before, info.getGlEsVersion() returns "0.0"

A: 

Try using glGetString(GL_VERSION).

genpfault
I have to know the available OpenGL ES version before i do anything else, so i can't use that.
Brammie
A: 

This might be oversimplifying things, but why not just try ES 2.0 first in an error-trap, then fall back to 1.0 if it fails to load?

Chris Peredun