diff options
author | Chien Yang <[email protected]> | 2007-03-06 04:59:57 +0000 |
---|---|---|
committer | Chien Yang <[email protected]> | 2007-03-06 04:59:57 +0000 |
commit | ce4454ea2fba291eedd5f1623c48faaec5d34e1a (patch) | |
tree | a16e4ecef5731e68fcfd57b577a56815c0aaa590 /src/classes/jogl | |
parent | f558afb8ef2797ff0cfe3e9918ffcee29892d6d1 (diff) |
1) Fixed Issue 414 : D3D: NPOT textures not properly disabled on card that lacks support
2) Redo NPOT support by pushing all control logic to Java side.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@784 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/jogl')
-rw-r--r-- | src/classes/jogl/javax/media/j3d/JoglContext.java | 3 | ||||
-rw-r--r-- | src/classes/jogl/javax/media/j3d/JoglPipeline.java | 55 |
2 files changed, 0 insertions, 58 deletions
diff --git a/src/classes/jogl/javax/media/j3d/JoglContext.java b/src/classes/jogl/javax/media/j3d/JoglContext.java index 211507b..90923f6 100644 --- a/src/classes/jogl/javax/media/j3d/JoglContext.java +++ b/src/classes/jogl/javax/media/j3d/JoglContext.java @@ -28,7 +28,6 @@ class JoglContext implements Context { private int currentTextureUnit; private int currentCombinerUnit; private boolean hasMultisample; - private boolean hasTextureNonPowerOfTwo; // Needed for vertex attribute implementation private JoglShaderObject shaderProgram; @@ -169,8 +168,6 @@ class JoglContext implements Context { void setCurrentCombinerUnit(int val) { currentCombinerUnit = val; } boolean getHasMultisample() { return hasMultisample; } void setHasMultisample(boolean val){ hasMultisample = val; } - boolean getHasTextureNonPowerOfTwo() { return hasTextureNonPowerOfTwo; } - void setHasTextureNonPowerOfTwo(boolean val){ hasTextureNonPowerOfTwo = val; } // Helpers for vertex attribute methods void initCgVertexAttributeImpl() { diff --git a/src/classes/jogl/javax/media/j3d/JoglPipeline.java b/src/classes/jogl/javax/media/j3d/JoglPipeline.java index 7b6b6b7..8e2c842 100644 --- a/src/classes/jogl/javax/media/j3d/JoglPipeline.java +++ b/src/classes/jogl/javax/media/j3d/JoglPipeline.java @@ -5781,13 +5781,6 @@ class JoglPipeline extends Pipeline { int type = GL.GL_UNSIGNED_INT_8_8_8_8; boolean forceAlphaToOne = false; - // check if we are trying to draw NPOT on a system that doesn't support it - if (!(((JoglContext) ctx).getHasTextureNonPowerOfTwo()) && - (!isPowerOfTwo(width) || !isPowerOfTwo(height) || !isPowerOfTwo(depth))) { - // disable texture by setting width, height and depth to 0 - width = height = depth = 0; - } - switch (textureFormat) { case Texture.INTENSITY: internalFormat = GL.GL_INTENSITY; @@ -5950,24 +5943,6 @@ class JoglPipeline extends Pipeline { pixelStore = true; gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, tilew); } - - // if NPOT textures are not supported, check if h=w=0, if so we have been - // disabled due to a NPOT texture being sent to a context that doesn't - // support it: disable the glTexSubImage as well - if (!(((JoglContext) ctx).getHasTextureNonPowerOfTwo())) { - int[] tmp = new int[1]; - int texWidth, texHeight, texDepth; - gl.glGetTexLevelParameteriv(GL.GL_TEXTURE_2D, 0, GL.GL_TEXTURE_WIDTH, tmp, 0); - texWidth = tmp[0]; - gl.glGetTexLevelParameteriv(GL.GL_TEXTURE_2D, 0, GL.GL_TEXTURE_HEIGHT, tmp, 0); - texHeight = tmp[0]; - gl.glGetTexLevelParameteriv(GL.GL_TEXTURE_2D, 0, GL.GL_TEXTURE_DEPTH, tmp, 0); - texDepth = tmp[0]; - if ((texWidth == 0) && (texHeight == 0) && (texDepth == 0)) { - // disable the sub-image by setting it's width, height and depth to 0 - width = height = depth = 0; - } - } switch (textureFormat) { case Texture.INTENSITY: @@ -6333,13 +6308,6 @@ class JoglPipeline extends Pipeline { int type = GL.GL_UNSIGNED_INT_8_8_8_8; boolean forceAlphaToOne = false; - // check if we are trying to draw NPOT on a system that doesn't support it - if (!(((JoglContext) ctx).getHasTextureNonPowerOfTwo()) && - (!isPowerOfTwo(width) || !isPowerOfTwo(height))) { - // disable texture by setting width and height to 0 - width = height = 0; - } - switch (textureFormat) { case Texture.INTENSITY: internalFormat = GL.GL_INTENSITY; @@ -6494,22 +6462,6 @@ class JoglPipeline extends Pipeline { gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, tilew); } - // if NPOT textures are not supported, check if h=w=0, if so we have been - // disabled due to a NPOT texture being sent to a context that doesn't - // support it: disable the glTexSubImage as well - if (!(((JoglContext) ctx).getHasTextureNonPowerOfTwo())) { - int[] tmp = new int[1]; - int texWidth, texHeight; - gl.glGetTexLevelParameteriv(GL.GL_TEXTURE_2D, 0, GL.GL_TEXTURE_WIDTH, tmp, 0); - texWidth = tmp[0]; - gl.glGetTexLevelParameteriv(GL.GL_TEXTURE_2D, 0, GL.GL_TEXTURE_HEIGHT, tmp, 0); - texHeight = tmp[0]; - if ((texWidth == 0) && (texHeight == 0)) { - // disable the sub-image by setting it's width and height to 0 - width = height = 0; - } - } - switch (textureFormat) { case Texture.INTENSITY: internalFormat = GL.GL_INTENSITY; @@ -6659,11 +6611,6 @@ class JoglPipeline extends Pipeline { } - - private static boolean isPowerOfTwo(int val) { - return ((val & (val - 1)) == 0); - } - void updateTextureFilterModes(Context ctx, int target, int minFilter, @@ -8296,7 +8243,6 @@ class JoglPipeline extends Pipeline { if (!VirtualUniverse.mc.enforcePowerOfTwo && gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two")) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO; - ctx.setHasTextureNonPowerOfTwo(true); } } @@ -8489,7 +8435,6 @@ class JoglPipeline extends Pipeline { if (gl20) { if(!VirtualUniverse.mc.enforcePowerOfTwo) { cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO; - ctx.setHasTextureNonPowerOfTwo(true); } } |