Explorar el Código

Merge pull request #2862 from mikica1986vee/Godot_Tegra_3_fix

Tegra 3 fix
Juan Linietsky hace 9 años
padre
commit
265f7ba4e5
Se han modificado 1 ficheros con 21 adiciones y 2 borrados
  1. 21 2
      platform/android/java/src/com/android/godot/GodotView.java

+ 21 - 2
platform/android/java/src/com/android/godot/GodotView.java

@@ -371,8 +371,8 @@ public class GodotView extends GLSurfaceView {
 
 		if (use_32) {
 			setEGLConfigChooser( translucent ?
-						new ConfigChooser(8, 8, 8, 8, 24, stencil) :
-						new ConfigChooser(8, 8, 8, 8, 24, stencil) );
+						new FallbackConfigChooser(8, 8, 8, 8, 24, stencil, new ConfigChooser(8, 8, 8, 8, 16, stencil)) :
+						new FallbackConfigChooser(8, 8, 8, 8, 24, stencil, new ConfigChooser(5, 6, 5, 0, 16, stencil)) );
 
 		} else {
 			setEGLConfigChooser( translucent ?
@@ -410,6 +410,25 @@ public class GodotView extends GLSurfaceView {
 	    Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
 	}
     }
+    	/* Fallback if 32bit View is not supported*/
+	private static class FallbackConfigChooser extends ConfigChooser {
+		private ConfigChooser fallback;
+		
+		public FallbackConfigChooser(int r, int g, int b, int a, int depth, int stencil, ConfigChooser fallback) {
+			super(r, g, b, a, depth, stencil);
+			this.fallback = fallback;
+		}
+      
+      		@Override
+		public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs) {
+			EGLConfig ec = super.chooseConfig(egl, display, configs);
+			if (ec == null) {
+	  			Log.w(TAG, "Trying ConfigChooser fallback");
+	  			ec = fallback.chooseConfig(egl, display, configs);
+			}
+			return ec;
+      		}
+    	}
 
 	private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {