From 297c97d28bb3490177b5ff9441f3d6494d09b819 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 8 Nov 2011 23:47:31 +0100 Subject: JOGL: GLBase Add 'isNPOTTextureAvailable()' for convenience --- src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java | 4 +--- src/jogl/classes/javax/media/opengl/GLBase.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index b6df365ba..7f3aa8a39 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -1055,9 +1055,7 @@ public class Texture { // Helper routines for disabling certain codepaths private static boolean haveNPOT(GL gl) { - return (!disableNPOT && - ( gl.isGLES2() || - gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two") ) ); + return !disableNPOT && gl.isNPOTTextureAvailable(); } private static boolean haveTexRect(GL gl) { diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index f93d443e0..534e449bc 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -294,6 +294,17 @@ public interface GLBase { */ public boolean isExtensionAvailable(String glExtensionName); + /** + * Returns true if the GL context supports non power of two (NPOT) textures, + * otherwise false. + *

+ * NPOT textures are supported in OpenGL >= 3, GLES2 or if the + * 'GL_ARB_texture_non_power_of_two' extension is available. + *

+ * @return + */ + public boolean isNPOTTextureAvailable(); + /** Provides a platform-independent way to specify the minimum swap interval for buffer swaps. An argument of 0 disables sync-to-vertical-refresh completely, while an argument of 1 -- cgit v1.2.3