aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Barkholt <michael@corteza.dk>2016-05-12 17:46:48 +0200
committerJustin Shapcott <support@mobidevelop.com>2016-05-12 08:46:48 -0700
commita34f175c784777d62c742e4c7a18059498da38c1 (patch)
tree49d0d912ca7a15cc2ee8b738461ac2d04df828e8
parent6dbc86b7ede728235b2c370b1cec03a618466bb9 (diff)
downloadlibgdx-a34f175c784777d62c742e4c7a18059498da38c1.tar.gz
fixed supported for extensions in gwt/webgl backend (#3835)
-rw-r--r--backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtGraphics.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtGraphics.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtGraphics.java
index 57a1a7d6c..d66b947d3 100644
--- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtGraphics.java
+++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtGraphics.java
@@ -408,9 +408,12 @@ public class GwtGraphics implements Graphics {
}
@Override
- public boolean supportsExtension (String extension) {
- if (extensions == null) extensions = Gdx.gl.glGetString(GL20.GL_EXTENSIONS);
- return extensions.contains(extension);
+ public boolean supportsExtension (String extensionName) {
+ // Contrary to regular OpenGL, WebGL extensions need to be explicitly enabled before they can be used. See
+ // https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Using_Extensions
+ // Thus, it is not safe to use an extension just because context.getSupportedExtensions() tells you it is available.
+ // We need to call getExtension() to enable it.
+ return context.getExtension(extensionName) != null;
}
public void update () {