aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-10-20 01:26:27 +0000
committerKenneth Russel <[email protected]>2008-10-20 01:26:27 +0000
commit247c010c035348260bdcf36aa0435808e0af52c8 (patch)
tree7336fc818e5e2d0b6e3b5f0ed181d3149d2145a3 /src/classes
parenta524581e59e36b40f84d449f8a9e10a62af19c8e (diff)
Limit scope of new logic to only be used in NPOT case
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1782 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/Texture.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/classes/com/sun/opengl/util/texture/Texture.java b/src/classes/com/sun/opengl/util/texture/Texture.java
index 168bab54f..ee1c4113d 100755
--- a/src/classes/com/sun/opengl/util/texture/Texture.java
+++ b/src/classes/com/sun/opengl/util/texture/Texture.java
@@ -437,10 +437,12 @@ public class Texture {
data.setHaveEXTABGR(gl.isExtensionAvailable("GL_EXT_abgr"));
data.setHaveGL12(gl.isExtensionAvailable("GL_VERSION_1_2"));
+ // Indicates whether both width and height are power of two
+ boolean isPOT = isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight);
+
// Note that automatic mipmap generation doesn't work for
// GL_ARB_texture_rectangle
- if ((!isPowerOfTwo(imgWidth) || !isPowerOfTwo(imgHeight)) &&
- !haveNPOT(gl)) {
+ if (!isPOT && !haveNPOT(gl)) {
haveAutoMipmapGeneration = false;
}
@@ -459,7 +461,7 @@ public class Texture {
done = true;
}
- if (!done && preferTexRect(gl) &&
+ if (!done && preferTexRect(gl) && !isPOT &&
haveTexRect(gl) && !data.isDataCompressed() && gl.isGL2()) {
// GL_ARB_texture_rectangle does not work for compressed textures
if (DEBUG) {
@@ -472,10 +474,9 @@ public class Texture {
done = true;
}
- if (!done && ((isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight)) ||
- haveNPOT(gl))) {
+ if (!done && (isPOT || haveNPOT(gl))) {
if (DEBUG) {
- if (isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight)) {
+ if (isPOT) {
System.err.println("Power-of-two texture");
} else {
System.err.println("Using GL_ARB_texture_non_power_of_two");