OpenGL ES 3.0 is supported with Android 4.3 (API level 18) and higher, fix #713

This commit is contained in:
Emux 2019-04-12 11:04:22 +03:00
parent cf49591d4f
commit e5bc7c7564
No known key found for this signature in database
GPG Key ID: 64ED9980896038C3
2 changed files with 12 additions and 9 deletions

View File

@ -3,6 +3,7 @@
## New since 0.11.0
- MBTiles raster tile source (Android) [#708](https://github.com/mapsforge/vtm/pull/708)
- Fix Android 4.2 crash [#713](https://github.com/mapsforge/vtm/issues/713)
- Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.12.0)

View File

@ -28,7 +28,6 @@ import android.util.DisplayMetrics;
import android.view.Display;
import android.view.GestureDetector;
import android.view.WindowManager;
import org.oscim.android.canvas.AndroidGraphics;
import org.oscim.android.gl.AndroidGL;
import org.oscim.android.gl.AndroidGL30;
@ -47,11 +46,10 @@ import org.oscim.utils.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* The MapView,
@ -127,12 +125,16 @@ public class MapView extends GLSurfaceView {
mMap = new AndroidMap(this);
/* Initialize Renderer */
try {
setEGLContextFactory(new GlContextFactory());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
// OpenGL ES 3.0 is supported with Android 4.3 (API level 18) and higher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
try {
setEGLContextFactory(new GlContextFactory());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
setEGLContextClientVersion(2);
}
} else
setEGLContextClientVersion(2);
}
setEGLConfigChooser(new GlConfigChooser());
if (GLAdapter.debug)