summaryrefslogtreecommitdiffstats
path: root/src/classes/jogl
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-02-28 23:35:03 +0000
committerChien Yang <[email protected]>2007-02-28 23:35:03 +0000
commit1856fc92c798ef83af1fc8695eaf060122dd18ca (patch)
tree98e8833661feb365a90b8a316060060fde753087 /src/classes/jogl
parent537cac28344a39da93b0b2d4900d215bc56cbead (diff)
1) OGL and JOGL only : Fix to Issue 415 : Need ability to disable NPOT textures for raster/background
2) Minor fix on when to call setHasMultiSample(). At present this method is not called, but getHasMultiSample() is used. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@781 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/jogl')
-rw-r--r--src/classes/jogl/javax/media/j3d/JoglContext.java3
-rw-r--r--src/classes/jogl/javax/media/j3d/JoglPipeline.java36
2 files changed, 16 insertions, 23 deletions
diff --git a/src/classes/jogl/javax/media/j3d/JoglContext.java b/src/classes/jogl/javax/media/j3d/JoglContext.java
index 90923f6..211507b 100644
--- a/src/classes/jogl/javax/media/j3d/JoglContext.java
+++ b/src/classes/jogl/javax/media/j3d/JoglContext.java
@@ -28,6 +28,7 @@ class JoglContext implements Context {
private int currentTextureUnit;
private int currentCombinerUnit;
private boolean hasMultisample;
+ private boolean hasTextureNonPowerOfTwo;
// Needed for vertex attribute implementation
private JoglShaderObject shaderProgram;
@@ -168,6 +169,8 @@ 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 8a16114..7b6b6b7 100644
--- a/src/classes/jogl/javax/media/j3d/JoglPipeline.java
+++ b/src/classes/jogl/javax/media/j3d/JoglPipeline.java
@@ -5781,12 +5781,8 @@ 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
- boolean textureNonPowerOfTwoAvailable =
- gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two") ||
- gl.isExtensionAvailable("GL_VERSION_2_0");
-
- if (!textureNonPowerOfTwoAvailable &&
+ // 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;
@@ -5958,11 +5954,7 @@ class JoglPipeline extends Pipeline {
// 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
- boolean textureNonPowerOfTwoAvailable =
- gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two") ||
- gl.isExtensionAvailable("GL_VERSION_2_0");
-
- if (!textureNonPowerOfTwoAvailable) {
+ 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);
@@ -6342,11 +6334,7 @@ class JoglPipeline extends Pipeline {
boolean forceAlphaToOne = false;
// check if we are trying to draw NPOT on a system that doesn't support it
- boolean textureNonPowerOfTwoAvailable =
- gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two") ||
- gl.isExtensionAvailable("GL_VERSION_2_0");
-
- if (!textureNonPowerOfTwoAvailable &&
+ if (!(((JoglContext) ctx).getHasTextureNonPowerOfTwo()) &&
(!isPowerOfTwo(width) || !isPowerOfTwo(height))) {
// disable texture by setting width and height to 0
width = height = 0;
@@ -6509,11 +6497,7 @@ class JoglPipeline extends Pipeline {
// 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
- boolean textureNonPowerOfTwoAvailable =
- gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two") ||
- gl.isExtensionAvailable("GL_VERSION_2_0");
-
- if (!textureNonPowerOfTwoAvailable) {
+ 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);
@@ -8309,8 +8293,10 @@ class JoglPipeline extends Pipeline {
cv.textureExtendedFeatures |= Canvas3D.TEXTURE_LOD_OFFSET;
}
- if (gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two")) {
+ if (!VirtualUniverse.mc.enforcePowerOfTwo &&
+ gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two")) {
cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO;
+ ctx.setHasTextureNonPowerOfTwo(true);
}
}
@@ -8501,7 +8487,10 @@ class JoglPipeline extends Pipeline {
// look for OpenGL 2.0 features
if (gl20) {
- cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO;
+ if(!VirtualUniverse.mc.enforcePowerOfTwo) {
+ cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO;
+ ctx.setHasTextureNonPowerOfTwo(true);
+ }
}
// Setup GL_EXT_abgr
@@ -8516,6 +8505,7 @@ class JoglPipeline extends Pipeline {
// FIXME: this is not correct for the Windows platform yet
if (gl13) {
cv.extensionsSupported |= Canvas3D.MULTISAMPLE;
+ ctx.setHasMultisample(true);
}
if ((cv.extensionsSupported & Canvas3D.MULTISAMPLE) != 0 &&