Assume OpenGL ES 2.0 is supported on ICS and higher devices

Fixes running jME3 in Android Emulator
experimental
shadowislord 10 years ago
parent 18807cf175
commit 6bdebb937a
  1. 4
      jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

@ -99,11 +99,15 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex
public GLSurfaceView createView() { public GLSurfaceView createView() {
Context appContext = JmeAndroidSystem.getActivity().getApplication(); Context appContext = JmeAndroidSystem.getActivity().getApplication();
// NOTE: We assume all ICS devices have OpenGL ES 2.0.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
// below 4.0, check OpenGL ES 2.0 support.
ActivityManager am = (ActivityManager) appContext.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager am = (ActivityManager) appContext.getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo(); ConfigurationInfo info = am.getDeviceConfigurationInfo();
if (info.reqGlEsVersion < 0x20000) { if (info.reqGlEsVersion < 0x20000) {
throw new UnsupportedOperationException("OpenGL ES 2.0 is not supported on this device"); throw new UnsupportedOperationException("OpenGL ES 2.0 is not supported on this device");
} }
}
// Start to set up the view // Start to set up the view
GLSurfaceView view = new GLSurfaceView(appContext); GLSurfaceView view = new GLSurfaceView(appContext);

Loading…
Cancel
Save