aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-03-09 00:58:28 +0000
committerChien Yang <[email protected]>2007-03-09 00:58:28 +0000
commit637d8427266fd3108764700b9f95d9a3b03893ff (patch)
tree29be17c24091efda5589d8bcc8cf84153aa7dd0c
parent88d9f0a85c8f8ddcfb758676296b86236cffaa2e (diff)
Added support to query GL_SGIS_generate_mipmap and GL_VERSION_1_4 (OpenGL only).
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@790 ba19aa83-45c5-6ac9-afd3-db810772062c
-rw-r--r--src/classes/jogl/javax/media/j3d/JoglPipeline.java18
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java7
-rw-r--r--src/native/ogl/Canvas3D.c15
-rw-r--r--src/native/ogl/gldefs.h1
4 files changed, 38 insertions, 3 deletions
diff --git a/src/classes/jogl/javax/media/j3d/JoglPipeline.java b/src/classes/jogl/javax/media/j3d/JoglPipeline.java
index a6a134a..a8d6db5 100644
--- a/src/classes/jogl/javax/media/j3d/JoglPipeline.java
+++ b/src/classes/jogl/javax/media/j3d/JoglPipeline.java
@@ -8248,6 +8248,11 @@ class JoglPipeline extends Pipeline {
gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two")) {
cv.textureExtendedFeatures |= Canvas3D.TEXTURE_NON_POWER_OF_TWO;
}
+
+ if (gl.isExtensionAvailable("GL_SGIS_generate_mipmap")) {
+ cv.textureExtendedFeatures |= Canvas3D.TEXTURE_AUTO_MIPMAP_GENERATION;
+ }
+
}
@@ -8407,10 +8412,12 @@ class JoglPipeline extends Pipeline {
}
boolean gl20 = false;
+ boolean gl14 = false;
boolean gl13 = false;
if (major > 1) {
// OpenGL 2.x -- set flags for 1.3 and 2.0 or greater
gl20 = true;
+ gl14 = true;
gl13 = true;
} else {
if (minor == 2) {
@@ -8422,8 +8429,15 @@ class JoglPipeline extends Pipeline {
if (gl20) {
assert gl13;
+ assert gl14;
assert gl.isExtensionAvailable("GL_VERSION_2_0");
}
+
+ if (gl14) {
+ assert gl13;
+ assert gl.isExtensionAvailable("GL_VERSION_1_4");
+ }
+
if (gl13) {
assert gl.isExtensionAvailable("GL_VERSION_1_3");
}
@@ -8434,6 +8448,10 @@ class JoglPipeline extends Pipeline {
// Note that we don't query for GL_ARB_imaging here
cv.textureExtendedFeatures |= Canvas3D.TEXTURE_LOD_RANGE;
+
+ if (gl14) {
+ cv.textureExtendedFeatures |= Canvas3D.TEXTURE_AUTO_MIPMAP_GENERATION;
+ }
// look for OpenGL 2.0 features
// Fix to Issue 455 : Need to disable NPOT textures for older cards that claim to support it.
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index 8981551..fd3be9b 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -767,7 +767,8 @@ public class Canvas3D extends Canvas {
// if Texture interpolation mode is support.
static final int TEXTURE_LERP = 0x4000;
static final int TEXTURE_NON_POWER_OF_TWO = 0x8000;
-
+ static final int TEXTURE_AUTO_MIPMAP_GENERATION = 0x10000;
+
int textureExtendedFeatures = 0;
// Extensions supported by the underlying canvas
@@ -3726,6 +3727,10 @@ public class Canvas3D extends Canvas {
values.add(new Boolean(
(textureExtendedFeatures & TEXTURE_NON_POWER_OF_TWO) != 0));
+ keys.add("textureAutoMipMapGenerationAvailable");
+ values.add(new Boolean(
+ (textureExtendedFeatures & TEXTURE_AUTO_MIPMAP_GENERATION) != 0));
+
keys.add("textureCoordSetsMax");
values.add(new Integer(maxTexCoordSets));
diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c
index 2a7cfc1..39d328c 100644
--- a/src/native/ogl/Canvas3D.c
+++ b/src/native/ogl/Canvas3D.c
@@ -383,6 +383,12 @@ checkTextureExtensions(
javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO;
}
+ if (isExtensionSupported(tmpExtensionStr,
+ "GL_SGIS_generate_mipmap")) {
+ ctxInfo->textureExtMask |=
+ javax_media_j3d_Canvas3D_TEXTURE_AUTO_MIPMAP_GENERATION;
+ }
+
}
@@ -598,8 +604,9 @@ getPropertiesFromCurrentContext(
}
if (versionNumbers[0] > 1) {
- /* OpenGL 2.x -- set flags for 1.3 and 2.0 or greater */
+ /* OpenGL 2.x -- set flags for 1.3, 1.4 and 2.0 or greater */
ctxInfo->gl20 = JNI_TRUE;
+ ctxInfo->gl14 = JNI_TRUE;
ctxInfo->gl13 = JNI_TRUE;
}
else {
@@ -647,7 +654,10 @@ getPropertiesFromCurrentContext(
ctxInfo->texture_base_level_enum = GL_TEXTURE_BASE_LEVEL;
ctxInfo->texture_max_level_enum = GL_TEXTURE_MAX_LEVEL;
-
+ if (ctxInfo->gl14) {
+ ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_AUTO_MIPMAP_GENERATION;
+ }
+
/* look for OpenGL 2.0 features */
/*
// Fix to Issue 455 : Need to disable NPOT textures for older cards that claim to support it.
@@ -2610,6 +2620,7 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
ctxInfo->versionNumbers[0] = 1;
ctxInfo->versionNumbers[1] = 1;
ctxInfo->gl13 = JNI_FALSE;
+ ctxInfo->gl14 = JNI_FALSE;
ctxInfo->gl20 = JNI_FALSE;
/* 1.2 and GL_ARB_imaging */
diff --git a/src/native/ogl/gldefs.h b/src/native/ogl/gldefs.h
index 1edaeff..edd5cdd 100644
--- a/src/native/ogl/gldefs.h
+++ b/src/native/ogl/gldefs.h
@@ -434,6 +434,7 @@ struct GraphicsContextPropertiesInfoRec {
char *extensionStr;
int versionNumbers[2];
jboolean gl13; /* OpenGL 1.3 or greater */
+ jboolean gl14; /* OpenGL 1.4 or greater */
jboolean gl20; /* OpenGL 2.0 or greater */
/* GL_ARB_imaging subset */