aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-03-06 04:59:57 +0000
committerChien Yang <[email protected]>2007-03-06 04:59:57 +0000
commitce4454ea2fba291eedd5f1623c48faaec5d34e1a (patch)
treea16e4ecef5731e68fcfd57b577a56815c0aaa590 /src/native
parentf558afb8ef2797ff0cfe3e9918ffcee29892d6d1 (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/native')
-rw-r--r--src/native/ogl/Attributes.c58
-rw-r--r--src/native/ogl/Canvas3D.c3
-rw-r--r--src/native/ogl/gldefs.h3
3 files changed, 0 insertions, 64 deletions
diff --git a/src/native/ogl/Attributes.c b/src/native/ogl/Attributes.c
index d54708d..921b949 100644
--- a/src/native/ogl/Attributes.c
+++ b/src/native/ogl/Attributes.c
@@ -2182,22 +2182,6 @@ void updateTextureAnisotropicFilter(
degree);
}
-static int
-isPowerOfTwo(int size)
-{
- int i;
- if (size == 0) {
- return 1;
- } else {
- for (i = 0; i < 32; i++) {
- if (size == (1 << i)) {
- return 1;
- }
- }
- return 0;
- }
-}
-
/*
* common function to define 2D texture image for different target
*/
@@ -2227,13 +2211,6 @@ void updateTexture2DImage(
imageObjPtr = (void *)(*(table->GetDirectBufferAddress))(env, data);
}
- /* check if we are trying to draw NPOT on a system that doesn't support it */
- if ((!ctxProperties->textureNonPowerOfTwoAvailable) &&
- (!isPowerOfTwo(width) || !isPowerOfTwo(height))) {
- /* disable texture by setting width and height to 0 */
- width = height = 0;
- }
-
switch (textureFormat) {
case INTENSITY:
internalFormat = GL_INTENSITY;
@@ -2404,19 +2381,6 @@ void updateTexture2DSubImage(
pixelStore = JNI_TRUE;
glPixelStorei(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 (!ctxProperties->textureNonPowerOfTwoAvailable) {
- int texWidth, texHeight;
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &texWidth);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texHeight);
- if ((texWidth == 0) && (texHeight == 0)) {
- /* disable the sub-image by setting it's width and height to 0 */
- width = height = 0;
- }
- }
switch (textureFormat) {
case INTENSITY:
@@ -2901,13 +2865,6 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DImage(
else {
imageObjPtr = (void *)(*(table->GetDirectBufferAddress))(env, data);
}
-
- /* check if we are trying to draw NPOT on a system that doesn't support it */
- if ((!ctxProperties->textureNonPowerOfTwoAvailable) &&
- (!isPowerOfTwo(width) || !isPowerOfTwo(height) || !isPowerOfTwo(depth))) {
- /* disable texture by setting width, height and depth to 0 */
- width = height = depth = 0;
- }
switch (textureFormat) {
case INTENSITY:
@@ -3084,21 +3041,6 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DSubImage(
glPixelStorei(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 (!ctxProperties->textureNonPowerOfTwoAvailable) {
- int texWidth, texHeight, texDepth;
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &texWidth);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texHeight);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_DEPTH, &texDepth);
- 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 INTENSITY:
internalFormat = GL_INTENSITY;
diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c
index 9c17ce4..00b281e 100644
--- a/src/native/ogl/Canvas3D.c
+++ b/src/native/ogl/Canvas3D.c
@@ -379,7 +379,6 @@ checkTextureExtensions(
if (isExtensionSupported(tmpExtensionStr, "GL_ARB_texture_non_power_of_two") &&
!getJavaBoolEnv(env, "enforcePowerOfTwo")) {
- ctxInfo->textureNonPowerOfTwoAvailable = JNI_TRUE;
ctxInfo->textureExtMask |=
javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO;
}
@@ -652,7 +651,6 @@ getPropertiesFromCurrentContext(
/* look for OpenGL 2.0 features */
if (ctxInfo->gl20) {
if (!getJavaBoolEnv(env, "enforcePowerOfTwo")) {
- ctxInfo->textureNonPowerOfTwoAvailable = JNI_TRUE;
ctxInfo->textureExtMask |=
javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO;
}
@@ -2662,7 +2660,6 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
ctxInfo->textureColorTableSize = 0;
ctxInfo->textureLodAvailable = JNI_FALSE;
ctxInfo->textureLodBiasAvailable = JNI_FALSE;
- ctxInfo->textureNonPowerOfTwoAvailable = JNI_FALSE;
/* extension mask */
ctxInfo->extMask = 0;
diff --git a/src/native/ogl/gldefs.h b/src/native/ogl/gldefs.h
index 40ed49d..1edaeff 100644
--- a/src/native/ogl/gldefs.h
+++ b/src/native/ogl/gldefs.h
@@ -549,9 +549,6 @@ struct GraphicsContextPropertiesInfoRec {
/* GL_SGIX_texture_lod_bias */
jboolean textureLodBiasAvailable;
- /* GL_ARB_texture_non_power_of_two */
- jboolean textureNonPowerOfTwoAvailable;
-
/* extension mask */
jint extMask;
jint textureExtMask;