GL30 adapter (#652)
This commit is contained in:
parent
f6f00c2521
commit
45cf4057d1
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2018 Gustl22
|
||||
* Copyright 2018-2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -23,6 +23,7 @@ import android.util.DisplayMetrics;
|
||||
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
@ -33,6 +34,7 @@ import org.oscim.backend.DateTimeAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.gdx.AndroidGL;
|
||||
import org.oscim.gdx.AndroidGL30;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.gdx.poi3d.Poi3DLayer;
|
||||
@ -66,7 +68,6 @@ public class GdxActivity extends AndroidApplication {
|
||||
|
||||
AndroidGraphics.init();
|
||||
GdxAssets.init("");
|
||||
GLAdapter.init(new AndroidGL());
|
||||
DateTimeAdapter.init(new DateTime());
|
||||
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
@ -84,6 +85,14 @@ public class GdxActivity extends AndroidApplication {
|
||||
}
|
||||
|
||||
class GdxMapAndroid extends GdxMap {
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init(new AndroidGL30());
|
||||
else
|
||||
GLAdapter.init(new AndroidGL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2018 Gustl22
|
||||
* Copyright 2018-2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -31,7 +31,9 @@ import android.view.WindowManager;
|
||||
|
||||
import org.oscim.android.canvas.AndroidGraphics;
|
||||
import org.oscim.android.gl.AndroidGL;
|
||||
import org.oscim.android.gl.AndroidGL30;
|
||||
import org.oscim.android.gl.GlConfigChooser;
|
||||
import org.oscim.android.gl.GlContextFactory;
|
||||
import org.oscim.android.input.AndroidMotionEvent;
|
||||
import org.oscim.android.input.GestureHandler;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
@ -59,6 +61,11 @@ public class MapView extends GLSurfaceView {
|
||||
|
||||
static final Logger log = LoggerFactory.getLogger(MapView.class);
|
||||
|
||||
/**
|
||||
* Target OpenGL ES version, if not available fall back to OpenGL ES 2.0
|
||||
*/
|
||||
public static int targetGLESVersion = 3;
|
||||
|
||||
private static void init() {
|
||||
System.loadLibrary("vtm-jni");
|
||||
}
|
||||
@ -90,7 +97,6 @@ public class MapView extends GLSurfaceView {
|
||||
/* Setup android backend */
|
||||
AndroidGraphics.init();
|
||||
AndroidAssets.init(context);
|
||||
GLAdapter.init(new AndroidGL());
|
||||
DateTimeAdapter.init(new DateTime());
|
||||
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
@ -116,8 +122,9 @@ public class MapView extends GLSurfaceView {
|
||||
mMap = new AndroidMap(this);
|
||||
|
||||
/* Initialize Renderer */
|
||||
//setEGLContextClientVersion(targetGLESVersion);
|
||||
setEGLContextFactory(new GlContextFactory());
|
||||
setEGLConfigChooser(new GlConfigChooser());
|
||||
setEGLContextClientVersion(2);
|
||||
|
||||
if (GLAdapter.debug)
|
||||
setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR
|
||||
@ -291,6 +298,15 @@ public class MapView extends GLSurfaceView {
|
||||
|
||||
@Override
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
// Check OpenGL ES version
|
||||
String versionStr = gl.glGetString(GL10.GL_VERSION);
|
||||
int versionIndex = "OpenGL ES ".length();
|
||||
float version = Float.parseFloat(versionStr.substring(versionIndex, versionIndex + 3));
|
||||
if (version >= 3)
|
||||
GLAdapter.init(new AndroidGL30());
|
||||
else
|
||||
GLAdapter.init(new AndroidGL());
|
||||
|
||||
super.onSurfaceCreated();
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser {
|
||||
EGL10.EGL_ALPHA_SIZE, 8,
|
||||
EGL10.EGL_DEPTH_SIZE, 16,
|
||||
// Requires that setEGLContextClientVersion(2) is called on the view.
|
||||
EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */,
|
||||
EGL10.EGL_RENDERABLE_TYPE, 4 /*EGL14.EGL_OPENGL_ES2_BIT*/ /*0x40 /*EGLExt.EGL_OPENGL_ES3_BIT_KHR*/,
|
||||
EGL10.EGL_STENCIL_SIZE, 8,
|
||||
EGL10.EGL_NONE};
|
||||
|
||||
@ -38,7 +38,7 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser {
|
||||
EGL10.EGL_BLUE_SIZE, 8,
|
||||
EGL10.EGL_ALPHA_SIZE, 8,
|
||||
EGL10.EGL_DEPTH_SIZE, 16,
|
||||
EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */,
|
||||
EGL10.EGL_RENDERABLE_TYPE, 4 /*EGL14.EGL_OPENGL_ES2_BIT*/ /*0x40 /*EGLExt.EGL_OPENGL_ES3_BIT_KHR*/,
|
||||
EGL10.EGL_STENCIL_SIZE, 8,
|
||||
EGL10.EGL_NONE};
|
||||
|
||||
|
||||
80
vtm-android/src/org/oscim/android/gl/GlContextFactory.java
Normal file
80
vtm-android/src/org/oscim/android/gl/GlContextFactory.java
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
|
||||
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.oscim.android.gl;
|
||||
|
||||
import android.opengl.GLSurfaceView;
|
||||
|
||||
import org.oscim.android.MapView;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
|
||||
/**
|
||||
* See https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/surfaceview/GLSurfaceView20.java
|
||||
*/
|
||||
public class GlContextFactory implements GLSurfaceView.EGLContextFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GlContextFactory.class);
|
||||
|
||||
private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
||||
|
||||
@Override
|
||||
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
|
||||
log.info("creating OpenGL ES " + MapView.targetGLESVersion + ".0 context");
|
||||
checkEglError("Before eglCreateContext " + MapView.targetGLESVersion, egl);
|
||||
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, MapView.targetGLESVersion, EGL10.EGL_NONE};
|
||||
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
|
||||
boolean success = checkEglError("After eglCreateContext " + MapView.targetGLESVersion, egl);
|
||||
|
||||
if ((!success || context == null) && MapView.targetGLESVersion > 2) {
|
||||
log.warn("Falling back to GLES 2");
|
||||
MapView.targetGLESVersion = 2;
|
||||
return createContext(egl, display, eglConfig);
|
||||
}
|
||||
log.info("Returning a GLES " + MapView.targetGLESVersion + " context");
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
|
||||
egl.eglDestroyContext(display, context);
|
||||
}
|
||||
|
||||
private static boolean checkEglError(String prompt, EGL10 egl) {
|
||||
int error;
|
||||
boolean result = true;
|
||||
while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
|
||||
result = false;
|
||||
log.error(String.format("%s: EGL error: 0x%x", prompt, error));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2018 Gustl22
|
||||
* Copyright 2018-2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -21,6 +21,7 @@ package org.oscim.gdx;
|
||||
import com.badlogic.gdx.Files;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
import org.oscim.awt.AwtGraphics;
|
||||
@ -44,7 +45,6 @@ public class GdxMapApp extends GdxMap {
|
||||
// init globals
|
||||
AwtGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new LwjglGL20());
|
||||
DateTimeAdapter.init(new DateTime());
|
||||
}
|
||||
|
||||
@ -84,6 +84,14 @@ public class GdxMapApp extends GdxMap {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init(new LwjglGL30());
|
||||
else
|
||||
GLAdapter.init(new LwjglGL20());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = new OSciMap4TileSource();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2018 Gustl22
|
||||
* Copyright 2018-2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -22,6 +22,7 @@ import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.InputMultiplexer;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
import com.badlogic.gdx.input.GestureDetector;
|
||||
import com.badlogic.gdx.utils.Timer;
|
||||
import com.badlogic.gdx.utils.Timer.Task;
|
||||
@ -36,9 +37,13 @@ import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.utils.Parameters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class GdxMap implements ApplicationListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GdxMap.class);
|
||||
|
||||
protected Map mMap;
|
||||
protected GestureDetector mGestureDetector;
|
||||
|
||||
@ -68,6 +73,10 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
final GLVersion version = Gdx.graphics.getGLVersion();
|
||||
log.info(version.getDebugVersionString());
|
||||
initGLAdapter(version);
|
||||
|
||||
if (!Parameters.CUSTOM_COORD_SCALE) {
|
||||
if (Math.min(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height) > 1080)
|
||||
MapRenderer.COORD_SCALE = 4.0f;
|
||||
@ -99,6 +108,8 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
createLayers();
|
||||
}
|
||||
|
||||
protected abstract void initGLAdapter(GLVersion version);
|
||||
|
||||
protected void createLayers() {
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -16,6 +17,8 @@
|
||||
*/
|
||||
package org.oscim.ios.test;
|
||||
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
@ -24,6 +27,7 @@ import org.oscim.core.TagSet;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.ios.backend.IosGL;
|
||||
import org.oscim.ios.backend.IosGL30;
|
||||
import org.oscim.ios.backend.IosGraphics;
|
||||
import org.oscim.layers.GenericLayer;
|
||||
import org.oscim.renderer.BucketRenderer;
|
||||
@ -45,13 +49,20 @@ public class IOSLineTexBucketTest extends GdxMap {
|
||||
// init globals
|
||||
IosGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new IosGL());
|
||||
}
|
||||
|
||||
GeometryBuffer mLine = new GeometryBuffer(2, 1);
|
||||
|
||||
LineTest l = new LineTest();
|
||||
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init(new IosGL30());
|
||||
else
|
||||
GLAdapter.init(new IosGL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
MapRenderer.setBackgroundColor(0xffffffff);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2017 Longri
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -17,12 +18,15 @@
|
||||
*/
|
||||
package org.oscim.ios.test;
|
||||
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
|
||||
import org.oscim.backend.DateTime;
|
||||
import org.oscim.backend.DateTimeAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.ios.backend.IosGL;
|
||||
import org.oscim.ios.backend.IosGL30;
|
||||
import org.oscim.ios.backend.IosGraphics;
|
||||
import org.oscim.layers.GroupLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
@ -45,10 +49,17 @@ public class IOSMapApp extends GdxMap {
|
||||
// init globals
|
||||
IosGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new IosGL());
|
||||
DateTimeAdapter.init(new DateTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init(new IosGL30());
|
||||
else
|
||||
GLAdapter.init(new IosGL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
Map map = getMap();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2017 Longri
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -17,6 +18,8 @@
|
||||
*/
|
||||
package org.oscim.ios.test;
|
||||
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeoPoint;
|
||||
@ -25,6 +28,7 @@ import org.oscim.event.Event;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.ios.backend.IosGL;
|
||||
import org.oscim.ios.backend.IosGL30;
|
||||
import org.oscim.ios.backend.IosGraphics;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
@ -46,7 +50,6 @@ public class IOSPathLayerTest extends GdxMap {
|
||||
// init globals
|
||||
IosGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new IosGL());
|
||||
}
|
||||
|
||||
private static final boolean ANIMATION = false;
|
||||
@ -54,6 +57,14 @@ public class IOSPathLayerTest extends GdxMap {
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
private TextureItem tex;
|
||||
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init(new IosGL30());
|
||||
else
|
||||
GLAdapter.init(new IosGL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 Izumi Kawashima
|
||||
* Copyright 2017-2018 devemux86
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -21,11 +22,13 @@ package org.oscim.web.client;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||
import com.badlogic.gdx.backends.gwt.GwtGraphics;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
|
||||
import org.oscim.backend.AssetAdapter;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.DateTimeAdapter;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GL30;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
@ -79,7 +82,6 @@ class GwtMap extends GdxMap {
|
||||
Tile.SIZE = Tile.calculateTileSize();
|
||||
|
||||
log.debug("GLAdapter.init");
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||
|
||||
@ -166,6 +168,14 @@ class GwtMap extends GdxMap {
|
||||
mSearchBox = new SearchBox(mMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGLAdapter(GLVersion version) {
|
||||
if (version.getMajorVersion() >= 3)
|
||||
GLAdapter.init((GL30) Gdx.graphics.getGL30());
|
||||
else
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createLayers() {
|
||||
mBuildingSolutionControl = new BuildingSolutionControl("#building-solution-input");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2018 Gustl22
|
||||
* Copyright 2018-2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -29,6 +29,7 @@ public class GLAdapter {
|
||||
* The instance provided by backend
|
||||
*/
|
||||
public static GL gl;
|
||||
public static GL30 gl30;
|
||||
|
||||
public static boolean ANDROID_QUIRKS = false;
|
||||
public static boolean GDX_DESKTOP_QUIRKS = false;
|
||||
@ -45,8 +46,10 @@ public class GLAdapter {
|
||||
*/
|
||||
public static boolean CIRCLE_QUADS = false;
|
||||
|
||||
public static void init(GL gl20) {
|
||||
gl = gl20;
|
||||
public static void init(GL gl) {
|
||||
GLAdapter.gl = gl;
|
||||
if (gl instanceof GL30)
|
||||
GLAdapter.gl30 = (GL30) gl;
|
||||
|
||||
ANDROID_QUIRKS = (CanvasAdapter.platform == Platform.ANDROID);
|
||||
GDX_DESKTOP_QUIRKS = CanvasAdapter.platform.isDesktop();
|
||||
@ -56,4 +59,8 @@ public class GLAdapter {
|
||||
if (CanvasAdapter.platform == Platform.MACOS)
|
||||
BuildingLayer.TRANSLUCENT = false;
|
||||
}
|
||||
|
||||
public static boolean isGL30() {
|
||||
return gl30 != null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user