summaryrefslogtreecommitdiffstats
path: root/src/native/ogl
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2006-09-29 18:04:13 +0000
committerKevin Rushforth <[email protected]>2006-09-29 18:04:13 +0000
commit908d0fbb2ea26226165cd42f12abf0d27e4a3f53 (patch)
tree0258d2293efab8f4eafba39a528a3d2eedd0c3cb /src/native/ogl
parent0661a22dd9278b20856b13b08ff22d248119cf6b (diff)
Merged dev-1_5 branch back to MAIN trunk
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@701 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/ogl')
-rw-r--r--src/native/ogl/Attributes.c1656
-rw-r--r--src/native/ogl/Canvas3D.c1779
-rw-r--r--src/native/ogl/CgShaderProgram.c200
-rw-r--r--src/native/ogl/DrawingSurfaceObjectAWT.c4
-rw-r--r--src/native/ogl/GLSLInfo.h2
-rw-r--r--src/native/ogl/GLSLShaderProgram.c229
-rw-r--r--src/native/ogl/GeometryArrayRetained.c509
-rw-r--r--src/native/ogl/GraphicsContext3D.c188
-rw-r--r--src/native/ogl/Lights.c12
-rw-r--r--src/native/ogl/MasterControl.c163
-rw-r--r--src/native/ogl/NativeAPIInfo.c39
-rw-r--r--src/native/ogl/NativeConfigTemplate3D.c17
-rw-r--r--src/native/ogl/NativeWSInfo.c78
-rw-r--r--src/native/ogl/RasterRetained.c398
-rw-r--r--src/native/ogl/build-linux-amd64.xml4
-rw-r--r--src/native/ogl/build-linux-i586.xml4
-rw-r--r--src/native/ogl/build-linux-ia64.xml5
-rw-r--r--src/native/ogl/build-linux-ppc.xml6
-rw-r--r--src/native/ogl/build-solaris-sparc-forte.xml8
-rw-r--r--src/native/ogl/build-solaris-sparc-gcc.xml8
-rw-r--r--src/native/ogl/build-solaris-x86-forte.xml8
-rw-r--r--src/native/ogl/build-solaris-x86-gcc.xml8
-rw-r--r--src/native/ogl/build-windows-amd64-vc.xml108
-rw-r--r--src/native/ogl/build-windows-i586-gcc.xml4
-rw-r--r--src/native/ogl/build-windows-i586-vc.xml4
-rw-r--r--src/native/ogl/gldefs.h183
26 files changed, 2251 insertions, 3373 deletions
diff --git a/src/native/ogl/Attributes.c b/src/native/ogl/Attributes.c
index bb35990..db87e70 100644
--- a/src/native/ogl/Attributes.c
+++ b/src/native/ogl/Attributes.c
@@ -217,18 +217,25 @@ const unsigned int screen_door[17][32] = {
},
};
+void
+throwAssert(JNIEnv *env, char *str)
+{
+ jclass rte;
+ if ((rte = (*env)->FindClass(env, "java/lang/AssertionError")) != NULL) {
+ (*env)->ThrowNew(env, rte, str);
+ }
+}
-
JNIEXPORT
-void JNICALL Java_javax_media_j3d_LinearFogRetained_update(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateLinearFog(
JNIEnv *env,
- jobject fog,
+ jobject obj,
jlong ctxInfo,
jfloat red,
jfloat green,
jfloat blue,
jdouble fdist,
- jdouble bdist)
+ jdouble bdist)
{
float color[3];
@@ -248,9 +255,9 @@ void JNICALL Java_javax_media_j3d_LinearFogRetained_update(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_ExponentialFogRetained_update(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateExponentialFog(
JNIEnv *env,
- jobject fog,
+ jobject obj,
jlong ctxInfo,
jfloat red,
jfloat green,
@@ -274,9 +281,9 @@ void JNICALL Java_javax_media_j3d_ExponentialFogRetained_update(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_ModelClipRetained_update(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateModelClip(
JNIEnv *env,
- jobject modelClip,
+ jobject obj,
jlong ctxInfo,
jint planeNum,
jboolean enableFlag,
@@ -308,7 +315,7 @@ void JNICALL Java_javax_media_j3d_ModelClipRetained_update(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setModelViewMatrix(
+void JNICALL Java_javax_media_j3d_NativePipeline_setModelViewMatrix(
JNIEnv * env,
jobject obj,
jlong ctxInfo,
@@ -327,11 +334,10 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setModelViewMatrix(
glMatrixMode(GL_MODELVIEW);
-
- if (ctxProperties->arb_transpose_matrix) {
- ctxProperties->glLoadTransposeMatrixdARB(vmatrix_pointer);
- ctxProperties->glMultTransposeMatrixdARB(mmatrix_pointer);
+ if (ctxProperties->gl13) {
+ ctxProperties->glLoadTransposeMatrixd(vmatrix_pointer);
+ ctxProperties->glMultTransposeMatrixd(mmatrix_pointer);
} else {
double v[16];
double m[16];
@@ -364,7 +370,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setModelViewMatrix(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setProjectionMatrix(
+void JNICALL Java_javax_media_j3d_NativePipeline_setProjectionMatrix(
JNIEnv * env,
jobject obj,
jlong ctxInfo,
@@ -379,7 +385,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setProjectionMatrix(
glMatrixMode(GL_PROJECTION);
- if (ctxProperties->arb_transpose_matrix) {
+ if (ctxProperties->gl13) {
/*
* Invert the Z value in clipping coordinates because OpenGL uses
* left-handed clipping coordinates, while Java3D defines right-handed
@@ -389,7 +395,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setProjectionMatrix(
matrix_pointer[9] *= -1.0;
matrix_pointer[10] *= -1.0;
matrix_pointer[11] *= -1.0;
- ctxProperties->glLoadTransposeMatrixdARB(matrix_pointer);
+ ctxProperties->glLoadTransposeMatrixd(matrix_pointer);
matrix_pointer[8] *= -1.0;
matrix_pointer[9] *= -1.0;
matrix_pointer[10] *= -1.0;
@@ -427,7 +433,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setProjectionMatrix(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setViewport(
+void JNICALL Java_javax_media_j3d_NativePipeline_setViewport(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -445,7 +451,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setViewport(
#endif
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setSceneAmbient(
+void JNICALL Java_javax_media_j3d_NativePipeline_setSceneAmbient(
JNIEnv *env,
jobject cv,
jlong ctxInfo,
@@ -463,7 +469,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setSceneAmbient(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setLightEnables(
+void JNICALL Java_javax_media_j3d_NativePipeline_setLightEnables(
JNIEnv *env,
jobject cv,
jlong ctxInfo,
@@ -489,7 +495,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setLightEnables(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setLightingEnable(
+void JNICALL Java_javax_media_j3d_NativePipeline_setLightingEnable(
JNIEnv *env,
jobject cv,
jlong ctxInfo,
@@ -509,7 +515,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setLightingEnable(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_disableFog(
+void JNICALL Java_javax_media_j3d_NativePipeline_disableFog(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -521,7 +527,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_disableFog(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_disableModelClip(
+void JNICALL Java_javax_media_j3d_NativePipeline_disableModelClip(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -540,7 +546,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_disableModelClip(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetRenderingAttributes(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetRenderingAttributes(
JNIEnv *env,
jobject cv,
jlong ctxInfo,
@@ -618,9 +624,9 @@ GLenum getStencilOpValue(jint op) {
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_RenderingAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateRenderingAttributes(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jboolean db_write_enable_override,
jboolean db_enable_override,
@@ -750,7 +756,7 @@ void JNICALL Java_javax_media_j3d_RenderingAttributesRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetPolygonAttributes(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetPolygonAttributes(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -769,9 +775,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetPolygonAttributes(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_PolygonAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updatePolygonAttributes(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jint polygonMode,
jint cullFace,
@@ -834,7 +840,7 @@ void JNICALL Java_javax_media_j3d_PolygonAttributesRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetLineAttributes(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetLineAttributes(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -852,9 +858,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetLineAttributes(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_LineAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateLineAttributes(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jfloat lineWidth,
jint linePattern,
@@ -888,7 +894,7 @@ void JNICALL Java_javax_media_j3d_LineAttributesRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetPointAttributes(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetPointAttributes(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -900,9 +906,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetPointAttributes(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_PointAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updatePointAttributes(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jfloat pointSize,
jboolean pointAntialiasing)
@@ -918,7 +924,7 @@ void JNICALL Java_javax_media_j3d_PointAttributesRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetTexCoordGeneration(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetTexCoordGeneration(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -930,9 +936,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTexCoordGeneration(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TexCoordGenerationRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexCoordGeneration(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jboolean enable,
jint genMode,
@@ -1016,8 +1022,8 @@ void JNICALL Java_javax_media_j3d_TexCoordGenerationRetained_updateNative(
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
- if (ctxProperties->arb_transpose_matrix) {
- ctxProperties->glLoadTransposeMatrixdARB(mat);
+ if (ctxProperties->gl13) {
+ ctxProperties->glLoadTransposeMatrixd(mat);
} else {
jdouble v[16];
COPY_TRANSPOSE(mat, v);
@@ -1084,7 +1090,7 @@ void JNICALL Java_javax_media_j3d_TexCoordGenerationRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureAttributes(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetTextureAttributes(
JNIEnv *env,
jobject cv,
jlong ctxInfo)
@@ -1110,9 +1116,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureAttributes(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureAttributes(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jdoubleArray transform,
jboolean isIdentity,
@@ -1144,8 +1150,8 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateNative(
NULL);
if (isIdentity) {
glLoadIdentity();
- } else if (ctxProperties->arb_transpose_matrix) {
- ctxProperties->glLoadTransposeMatrixdARB(mx_ptr);
+ } else if (ctxProperties->gl13) {
+ ctxProperties->glLoadTransposeMatrixd(mx_ptr);
} else {
double mx[16];
COPY_TRANSPOSE(mx_ptr, mx);
@@ -1215,9 +1221,9 @@ GLenum getCombinerArg(jint arg, GLenum textureUnit, GLenum combUnit) {
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateNativeRegisterCombiners(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateRegisterCombiners(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jdoubleArray transform,
jboolean isIdentity,
@@ -1262,8 +1268,8 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateNativeRegister
NULL);
if (isIdentity) {
glLoadIdentity();
- } else if (ctxProperties->arb_transpose_matrix) {
- ctxProperties->glLoadTransposeMatrixdARB(mx_ptr);
+ } else if (ctxProperties->gl13) {
+ ctxProperties->glLoadTransposeMatrixd(mx_ptr);
} else {
double mx[16];
COPY_TRANSPOSE(mx_ptr, mx);
@@ -1564,9 +1570,9 @@ jint _gl_combineFcn[] = {
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateCombinerNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateCombiner(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxProperties,
jint combineRgbMode,
jint combineAlphaMode,
@@ -1642,9 +1648,9 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateCombinerNative
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateTextureColorTableNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureColorTable(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jint numComponents,
jint colorTableSize,
@@ -1672,9 +1678,9 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateTextureColorTa
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_updateMaterial(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateMaterialColor(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jfloat colorRed,
jfloat colorGreen,
@@ -1692,9 +1698,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_updateMaterial(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_MaterialRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateMaterial(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jfloat colorRed,
jfloat colorGreen,
@@ -1762,7 +1768,7 @@ void JNICALL Java_javax_media_j3d_MaterialRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetTransparency(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetTransparency(
JNIEnv *env,
jobject cv,
jlong ctxInfo,
@@ -1787,7 +1793,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTransparency(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TransparencyAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTransparencyAttributes(
JNIEnv *env,
jobject tr,
jlong ctxInfo,
@@ -1826,7 +1832,7 @@ void JNICALL Java_javax_media_j3d_TransparencyAttributesRetained_updateNative(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetColoringAttributes(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetColoringAttributes(
JNIEnv *env,
jobject cv,
jlong ctxInfo,
@@ -1849,9 +1855,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetColoringAttributes(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_ColoringAttributesRetained_updateNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateColoringAttributes(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jfloat dRed,
jfloat dGreen,
@@ -1883,32 +1889,25 @@ void JNICALL Java_javax_media_j3d_ColoringAttributesRetained_updateNative(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureNative(
+void JNICALL Java_javax_media_j3d_NativePipeline_resetTextureNative(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint texUnitIndex)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if(ctxProperties->arb_multitexture) {
-
- if (texUnitIndex >= 0) {
- ctxProperties->glActiveTextureARB(texUnitIndex + GL_TEXTURE0_ARB);
- ctxProperties->glClientActiveTextureARB(texUnitIndex + GL_TEXTURE0_ARB);
- }
+ if(ctxProperties->gl13) {
+ if (texUnitIndex >= 0) {
+ ctxProperties->glActiveTexture(texUnitIndex + GL_TEXTURE0);
+ ctxProperties->glClientActiveTexture(texUnitIndex + GL_TEXTURE0);
+ }
}
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
-
- if(ctxProperties->texture3DAvailable) {
- glDisable(ctxProperties->texture_3D_ext_enum);
- }
-
- if(ctxProperties->textureCubeMapAvailable) {
- glDisable(ctxProperties->texture_cube_map_ext_enum);
- }
+ glDisable(GL_TEXTURE_3D);
+ glDisable(GL_TEXTURE_CUBE_MAP);
}
@@ -2048,7 +2047,7 @@ void updateTextureBoundary(
break;
case javax_media_j3d_Texture_CLAMP_TO_EDGE:
glTexParameteri(target, GL_TEXTURE_WRAP_S,
- ctxProperties->texture_clamp_to_edge_enum);
+ GL_CLAMP_TO_EDGE);
break;
case javax_media_j3d_Texture_CLAMP_TO_BOUNDARY:
glTexParameteri(target, GL_TEXTURE_WRAP_S,
@@ -2065,7 +2064,7 @@ void updateTextureBoundary(
break;
case javax_media_j3d_Texture_CLAMP_TO_EDGE:
glTexParameteri(target, GL_TEXTURE_WRAP_T,
- ctxProperties->texture_clamp_to_edge_enum);
+ GL_CLAMP_TO_EDGE);
break;
case javax_media_j3d_Texture_CLAMP_TO_BOUNDARY:
glTexParameteri(target, GL_TEXTURE_WRAP_T,
@@ -2078,21 +2077,21 @@ void updateTextureBoundary(
switch (boundaryModeR) {
case javax_media_j3d_Texture_WRAP:
glTexParameteri(target,
- ctxProperties->texture_wrap_r_ext_enum, GL_REPEAT);
+ GL_TEXTURE_WRAP_R, GL_REPEAT);
break;
case javax_media_j3d_Texture_CLAMP:
glTexParameteri(target,
- ctxProperties->texture_wrap_r_ext_enum, GL_CLAMP);
+ GL_TEXTURE_WRAP_R, GL_CLAMP);
break;
case javax_media_j3d_Texture_CLAMP_TO_EDGE:
glTexParameteri(target,
- ctxProperties->texture_wrap_r_ext_enum,
- ctxProperties->texture_clamp_to_edge_enum);
+ GL_TEXTURE_WRAP_R,
+ GL_CLAMP_TO_EDGE);
break;
case javax_media_j3d_Texture_CLAMP_TO_BOUNDARY:
glTexParameteri(target,
- ctxProperties->texture_wrap_r_ext_enum,
+ GL_TEXTURE_WRAP_R,
ctxProperties->texture_clamp_to_border_enum);
break;
}
@@ -2181,6 +2180,21 @@ 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
@@ -2191,130 +2205,159 @@ void updateTexture2DImage(
jint target,
jint numLevels,
jint level,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint width,
jint height,
jint boundaryWidth,
- jbyteArray imageYup)
+ jint dataType,
+ jobject data)
{
- GLenum oglFormat = 0, oglInternalFormat=0;
+ void *imageObjPtr;
+ GLenum format = 0, internalFormat = 0, type = GL_UNSIGNED_INT_8_8_8_8;
JNIEnv table = *env;
- jbyte *byteData;
- jshort *shortData;
+ GLboolean forceAlphaToOne = GL_FALSE;
- switch (internalFormat) {
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ imageObjPtr = (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)data, NULL);
+ }
+ 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))) {
+ /* disable texture by setting width and height to 0 */
+ width = height = 0;
+ }
+
+ switch (textureFormat) {
case INTENSITY:
- oglInternalFormat = GL_INTENSITY;
+ internalFormat = GL_INTENSITY;
break;
case LUMINANCE:
- oglInternalFormat = GL_LUMINANCE;
+ internalFormat = GL_LUMINANCE;
break;
case ALPHA:
- oglInternalFormat = GL_ALPHA;
+ internalFormat = GL_ALPHA;
break;
case LUMINANCE_ALPHA:
- oglInternalFormat = GL_LUMINANCE_ALPHA;
+ internalFormat = GL_LUMINANCE_ALPHA;
break;
case J3D_RGB:
- oglInternalFormat = GL_RGB;
+ internalFormat = GL_RGB;
break;
case J3D_RGBA:
- oglInternalFormat = GL_RGBA;
+ internalFormat = GL_RGBA;
break;
+ default:
+ throwAssert(env, "updateTexture2DImage : textureFormat illegal format");
+ return;
}
- switch (format) {
- case FORMAT_BYTE_RGBA:
- /* all RGB types are stored as RGBA */
- oglFormat = GL_RGBA;
- break;
- case FORMAT_BYTE_RGB:
- oglFormat = GL_RGB;
- break;
-
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- oglFormat = GL_ABGR_EXT;
- }
- break;
-
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- oglFormat = ctxProperties->bgr_ext_enum;
- }
- break;
-
- case FORMAT_BYTE_LA:
+
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_BYTE_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_BYTE_BGR:
+ format = GL_BGR;
+ break;
+ case IMAGE_FORMAT_BYTE_RGB:
+ format = GL_RGB;
+ break;
+ /* GL_ABGR_EXT */
+ case IMAGE_FORMAT_BYTE_ABGR:
+ if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
+ format = GL_ABGR_EXT;
+ }
+ else {
+ throwAssert(env, "updateTexture2DImage : GL_ABGR_EXT format is unsupported");
+ return;
+ }
+ break;
+ case IMAGE_FORMAT_BYTE_RGBA:
+ format = GL_RGBA;
+ break;
+ case IMAGE_FORMAT_BYTE_LA:
/* all LA types are stored as LA8 */
- oglFormat = GL_LUMINANCE_ALPHA;
+ format = GL_LUMINANCE_ALPHA;
break;
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- if (oglInternalFormat == GL_ALPHA) {
- oglFormat = GL_ALPHA;
+ case IMAGE_FORMAT_BYTE_GRAY:
+ if (internalFormat == GL_ALPHA) {
+ format = GL_ALPHA;
} else {
- oglFormat = GL_LUMINANCE;
+ format = GL_LUMINANCE;
}
break;
+
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_INT_BGR:
+ case IMAGE_FORMAT_INT_RGB:
+ case IMAGE_FORMAT_INT_ARGB:
+ default:
+ throwAssert(env, "updateTexture2DImage : imageFormat illegal format");
+ return;
+ }
+
+ glTexImage2D(target, level, internalFormat,
+ width, height, boundaryWidth,
+ format, GL_UNSIGNED_BYTE, imageObjPtr);
+
}
- /*
- fprintf(stderr,"native updateTextureImage\n");
- fprintf(stderr,"internalFormat = %x\n",internalFormat);
- fprintf(stderr,"format = %x\n",format);
- fprintf(stderr,"oglFormat = %x\n",oglFormat);
- fprintf(stderr,"oglInternalFormat = %x\n",oglInternalFormat);
- fprintf(stderr,"boundaryWidth= %d\n", boundaryWidth);
- */
- if (imageYup != NULL) {
- if (format != FORMAT_USHORT_GRAY) {
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- imageYup,
- NULL);
- /*
- {
- jbyte *c = byteData;
- int i, j;
- for (i = 0; i < 1; i++) {
- for (j = 0; j < 8; j++, c++) {
- fprintf(stderr, "%x ",*c);
- }
- fprintf(stderr, "\n");
- }
- }
- */
- }
- else { /* unsigned short */
- shortData = (jshort *)(*(table->GetPrimitiveArrayCritical))(env,
- imageYup,
- NULL);
+ else if((dataType == IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_INT_BGR: /* Assume XBGR format */
+ format = GL_RGBA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ forceAlphaToOne = GL_TRUE;
+ break;
+ case IMAGE_FORMAT_INT_RGB: /* Assume XRGB format */
+ forceAlphaToOne = GL_TRUE;
+ /* Fall through to next case */
+ case IMAGE_FORMAT_INT_ARGB:
+ format = GL_BGRA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ /* This method only supports 3 and 4 components formats and INT types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_BGR:
+ case IMAGE_FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_ABGR:
+ default:
+ throwAssert(env, "updateTexture2DImage : imageFormat illegal format");
+ return;
+ }
+
+ /* Force Alpha to 1.0 if needed */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
}
- }
- else {
- byteData = NULL;
- shortData = NULL;
- }
- if (format != FORMAT_USHORT_GRAY) {
- glTexImage2D(target, level, oglInternalFormat,
+
+ glTexImage2D(target, level, internalFormat,
width, height, boundaryWidth,
- oglFormat, GL_UNSIGNED_BYTE, (GLvoid *)byteData);
+ format, type, imageObjPtr);
+
+ /* Restore Alpha scale and bias */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
+ }
}
else {
- glTexImage2D(target, level, oglInternalFormat,
- width, height, boundaryWidth,
- oglFormat, GL_UNSIGNED_SHORT, (GLvoid *)shortData);
+ throwAssert(env, "updateTexture2DImage : illegal image data type");
+ return;
}
- if (imageYup != NULL) {
- if (format != FORMAT_USHORT_GRAY) {
- (*(table->ReleasePrimitiveArrayCritical))(env, imageYup, byteData, 0);
- }
- else {
- (*(table->ReleasePrimitiveArrayCritical))(env, imageYup, shortData, 0);
- }
- }
- /* No idea why we need following call. */
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ (*(table->ReleasePrimitiveArrayCritical))(env, data, imageObjPtr, 0);
+ }
+
}
@@ -2329,158 +2372,210 @@ void updateTexture2DSubImage(
jint level,
jint xoffset,
jint yoffset,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint imgXOffset,
jint imgYOffset,
jint tilew,
jint width,
jint height,
- jbyteArray image) {
+ jint dataType,
+ jobject data) {
- GLenum oglFormat = 0, oglInternalFormat=0;
+ void *imageObjPtr;
+ GLenum format = 0, internalFormat = 0, type = GL_UNSIGNED_INT_8_8_8_8;
JNIEnv table = *env;
- jbyte *byteData, *tmpByte;
- jshort *shortData, *tmpShort;
+ GLboolean forceAlphaToOne = GL_FALSE;
+ jbyte *tmpByte;
+ jint *tmpInt;
jint numBytes = 0;
jboolean pixelStore = JNI_FALSE;
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ imageObjPtr = (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)data, NULL);
+ }
+ else {
+ imageObjPtr = (void *)(*(table->GetDirectBufferAddress))(env, data);
+ }
+
+ if (imgXOffset > 0 || (width < tilew)) {
+ 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 (internalFormat) {
+ switch (textureFormat) {
case INTENSITY:
- oglInternalFormat = GL_INTENSITY;
+ internalFormat = GL_INTENSITY;
break;
case LUMINANCE:
- oglInternalFormat = GL_LUMINANCE;
+ internalFormat = GL_LUMINANCE;
break;
case ALPHA:
- oglInternalFormat = GL_ALPHA;
+ internalFormat = GL_ALPHA;
break;
case LUMINANCE_ALPHA:
- oglInternalFormat = GL_LUMINANCE_ALPHA;
+ internalFormat = GL_LUMINANCE_ALPHA;
break;
case J3D_RGB:
- oglInternalFormat = GL_RGB;
+ internalFormat = GL_RGB;
break;
case J3D_RGBA:
- oglInternalFormat = GL_RGBA;
+ internalFormat = GL_RGBA;
break;
+ default:
+ throwAssert(env, "updateTexture2DSubImage : textureFormat illegal format");
+ return;
}
-
- switch (format) {
- case FORMAT_BYTE_RGBA:
- /* all RGB types are stored as RGBA */
- oglFormat = GL_RGBA;
- numBytes = 4;
- break;
- case FORMAT_BYTE_RGB:
- oglFormat = GL_RGB;
- numBytes = 3;
- break;
-
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- oglFormat = GL_ABGR_EXT;
+
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_BYTE_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_BYTE_BGR:
+ format = GL_BGR;
+ numBytes = 3;
+ break;
+ case IMAGE_FORMAT_BYTE_RGB:
+ format = GL_RGB;
+ numBytes = 3;
+ break;
+ /* GL_ABGR_EXT */
+ case IMAGE_FORMAT_BYTE_ABGR:
+ if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
+ format = GL_ABGR_EXT;
numBytes = 4;
- }
- break;
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- oglFormat = ctxProperties->bgr_ext_enum;
- numBytes = 3;
- }
- break;
-
- case FORMAT_BYTE_LA:
+ }
+ else {
+ throwAssert(env, "updateTexture2DSubImage : GL_ABGR_EXT format is unsupported");
+ return;
+ }
+ break;
+ case IMAGE_FORMAT_BYTE_RGBA:
+ format = GL_RGBA;
+ numBytes = 4;
+ break;
+ case IMAGE_FORMAT_BYTE_LA:
/* all LA types are stored as LA8 */
- oglFormat = GL_LUMINANCE_ALPHA;
- numBytes = 2;
- break;
- case FORMAT_BYTE_GRAY:
- if (oglInternalFormat == GL_ALPHA) {
- oglFormat = GL_ALPHA;
- } else {
- oglFormat = GL_LUMINANCE;
- }
- numBytes = 1;
- case FORMAT_USHORT_GRAY:
- if (oglInternalFormat == GL_ALPHA) {
- oglFormat = GL_ALPHA;
- } else {
- oglFormat = GL_LUMINANCE;
+ numBytes = 2;
+ format = GL_LUMINANCE_ALPHA;
+ break;
+ case IMAGE_FORMAT_BYTE_GRAY:
+ if (internalFormat == GL_ALPHA) {
+ format = GL_ALPHA;
+ numBytes = 1;
+ } else {
+ format = GL_LUMINANCE;
+ numBytes = 1;
}
- numBytes = 2;
break;
- }
- /*
- fprintf(stderr,"format = %x\n",format);
- fprintf(stderr,"oglFormat = %x\n",oglFormat);
- fprintf(stderr, "imgXOffset = %d\n",imgXOffset);
- fprintf(stderr, "imgYOffset = %d\n",imgYOffset);
- fprintf(stderr, "xoffset = %d\n",xoffset);
- fprintf(stderr, "yoffset = %d\n",yoffset);
- fprintf(stderr, "tilew = %d\n",tilew);
- fprintf(stderr, "numBytes = %d\n",numBytes);
- fprintf(stderr, "width = %d\n",width);
- fprintf(stderr, "height = %d\n",height);
- */
- if (imgXOffset > 0 || (width < tilew)) {
- pixelStore = JNI_TRUE;
- glPixelStorei(GL_UNPACK_ROW_LENGTH, tilew);
- }
-
- if (format != FORMAT_USHORT_GRAY) {
- int off = 0;
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- image,
- NULL);
- /* offset by the imageOffset */
- off = (tilew * imgYOffset + imgXOffset) * numBytes;
- tmpByte = byteData+(off);
-/*
-printf("tmpByte: %x %x %x %x\n", *(tmpByte), *(tmpByte+1),
- *(tmpByte+2), *(tmpByte+3));
-*/
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_INT_BGR:
+ case IMAGE_FORMAT_INT_RGB:
+ case IMAGE_FORMAT_INT_ARGB:
+ default:
+ throwAssert(env, "updateTexture2DSubImage : imageFormat illegal format");
+ return;
+ }
+ tmpByte = (jbyte*)imageObjPtr +
+ (tilew * imgYOffset + imgXOffset) * numBytes;
+
+
glTexSubImage2D(target, level, xoffset, yoffset, width, height,
- oglFormat, GL_UNSIGNED_BYTE, (GLvoid *)tmpByte);
- (*(table->ReleasePrimitiveArrayCritical))(env, image, byteData, 0);
- } else { /* unsigned short */
- shortData = (jshort *)(*(table->GetPrimitiveArrayCritical))(env,
- image,
- NULL);
- tmpShort = (jshort*)((jbyte*)shortData+
- (tilew * imgYOffset + imgXOffset)*numBytes);
+ format, GL_UNSIGNED_BYTE, (GLvoid *)tmpByte);
+
+ }
+ else if((dataType == IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_INT_BGR: /* Assume XBGR format */
+ format = GL_RGBA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ forceAlphaToOne = GL_TRUE;
+ break;
+ case IMAGE_FORMAT_INT_RGB: /* Assume XRGB format */
+ forceAlphaToOne = GL_TRUE;
+ /* Fall through to next case */
+ case IMAGE_FORMAT_INT_ARGB:
+ format = GL_BGRA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ /* This method only supports 3 and 4 components formats and INT types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_BGR:
+ case IMAGE_FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_ABGR:
+ default:
+ throwAssert(env, "updateTexture2DSubImage : imageFormat illegal format");
+ return;
+ }
+
+ numBytes = 4;
+
+ tmpInt = (jint*)((jbyte*)imageObjPtr +
+ (tilew * imgYOffset + imgXOffset)*numBytes);
+
+ /* Force Alpha to 1.0 if needed */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
+ }
+
glTexSubImage2D(target, level, xoffset, yoffset, width, height,
- oglFormat, GL_UNSIGNED_SHORT, (GLvoid *)tmpShort);
- (*(table->ReleasePrimitiveArrayCritical))(env, image, shortData, 0);
+ format, type, (GLvoid *)tmpInt);
+
+ /* Restore Alpha scale and bias */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
+ }
}
+ else {
+ throwAssert(env, "updateTexture2DImage : illegal image data type");
+ return;
+ }
+
+
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ (*(table->ReleasePrimitiveArrayCritical))(env, data, imageObjPtr, 0);
+ }
+
if (pixelStore) {
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_bindTexture(
+void JNICALL Java_javax_media_j3d_NativePipeline_bindTexture2D(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint objectId,
jboolean enable)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- glDisable(ctxProperties->texture_cube_map_ext_enum);
- }
- if (ctxProperties->texture3DAvailable) {
- glDisable(ctxProperties->texture_3D_ext_enum);
- }
+ glDisable(GL_TEXTURE_CUBE_MAP);
+ glDisable(GL_TEXTURE_3D);
if (enable == JNI_FALSE) {
glDisable(GL_TEXTURE_2D);
-
} else {
glBindTexture(GL_TEXTURE_2D, objectId);
glEnable(GL_TEXTURE_2D);
@@ -2488,9 +2583,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_bindTexture(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilterModes(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DFilterModes(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint minFilter,
jint magFilter)
@@ -2502,16 +2597,15 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilterModes(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodRange(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DLodRange(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint baseLevel,
jint maximumLevel,
jfloat minimumLOD,
jfloat maximumLOD)
{
-
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTextureLodRange(ctxProperties, GL_TEXTURE_2D,
@@ -2519,10 +2613,11 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodRange(
minimumLOD, maximumLOD);
}
+
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodOffset(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DLodOffset(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jfloat lodOffsetS,
jfloat lodOffsetT,
@@ -2536,9 +2631,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodOffset(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureBoundary(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DBoundary(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint boundaryModeS,
jint boundaryModeT,
@@ -2556,9 +2651,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureBoundary(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureSharpenFunc(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DSharpenFunc(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numPts,
jfloatArray pts)
@@ -2569,9 +2664,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureSharpenFunc(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilter4Func(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DFilter4Func(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numPts,
jfloatArray pts)
@@ -2582,9 +2677,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilter4Func(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureAnisotropicFilter(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DAnisotropicFilter(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jfloat degree)
{
@@ -2594,193 +2689,81 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureAnisotropicFilter
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture2DRetained_updateTextureSubImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DSubImage(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint level,
jint xoffset,
jint yoffset,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint imgXOffset,
jint imgYOffset,
jint tilew,
jint width,
jint height,
- jbyteArray image) {
+ jint dataType,
+ jobject data)
+{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTexture2DSubImage(env, ctxProperties, GL_TEXTURE_2D,
- level, xoffset, yoffset,
- internalFormat, format,
- imgXOffset, imgYOffset, tilew, width, height,
- image);
+ level, xoffset, yoffset,
+ textureFormat, imageFormat,
+ imgXOffset, imgYOffset, tilew, width, height,
+ dataType, data);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture2DRetained_updateTextureImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DImage(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numLevels,
jint level,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint width,
jint height,
jint boundaryWidth,
- jbyteArray imageYup)
+ jint dataType,
+ jobject data)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTexture2DImage(env, ctxProperties, GL_TEXTURE_2D,
- numLevels, level, internalFormat, format,
- width, height, boundaryWidth, imageYup);
-}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture2DRetained_updateDetailTextureParameters(
- JNIEnv *env,
- jobject texture,
- jlong ctxInfo,
- jint mode,
- jint level,
- jint nPts,
- jfloatArray funcPts)
-{
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- float *pts = NULL;
- JNIEnv table = *env;
-
- if (ctxProperties->textureDetailAvailable) {
- switch (mode) {
- case javax_media_j3d_Texture2D_DETAIL_ADD:
- glTexParameterf(GL_TEXTURE_2D,
- ctxProperties->texture_detail_mode_enum, GL_ADD);
- break;
- case javax_media_j3d_Texture2D_DETAIL_MODULATE:
- glTexParameterf(GL_TEXTURE_2D,
- ctxProperties->texture_detail_mode_enum, GL_MODULATE);
- break;
- }
-
- glTexParameteri(GL_TEXTURE_2D,
- ctxProperties->texture_detail_level_enum, -level);
-
- if (nPts > 0) {
- pts = (jfloat *)(*(table->GetPrimitiveArrayCritical))(env,
- funcPts, NULL);
- }
- ctxProperties->glDetailTexFuncSGIS(GL_TEXTURE_2D, nPts, pts);
-
- if (pts != NULL) {
- (*(table->ReleasePrimitiveArrayCritical))(env, funcPts, pts, 0);
- }
- }
-}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_DetailTextureImage_bindTexture(
- JNIEnv *env,
- jobject texture,
- jlong ctxInfo,
- jint objectId)
-{
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if (ctxProperties->textureDetailAvailable) {
- glBindTexture(ctxProperties->texture_detail_ext_enum, objectId);
- }
-}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_DetailTextureImage_updateTextureSubImage(
- JNIEnv *env,
- jobject texture,
- jlong ctxInfo,
- jint level,
- jint xoffset,
- jint yoffset,
- jint internalFormat,
- jint format,
- jint imgXOffset,
- jint imgYOffset,
- jint tilew,
- jint width,
- jint height,
- jbyteArray image) {
-
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if (ctxProperties->textureDetailAvailable) {
- updateTexture2DSubImage(env, ctxProperties,
- ctxProperties->texture_detail_ext_enum,
- level, xoffset, yoffset,
- internalFormat, format,
- imgXOffset, imgYOffset, tilew, width, height,
- image);
- }
+ numLevels, level, textureFormat, imageFormat,
+ width, height, boundaryWidth, dataType, data);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_DetailTextureImage_updateTextureImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_bindTexture3D(
JNIEnv *env,
- jobject texture,
- jlong ctxInfo,
- jint numLevels,
- jint level,
- jint internalFormat,
- jint format,
- jint width,
- jint height,
- jint boundaryWidth,
- jbyteArray imageYup)
-{
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if (ctxProperties->textureDetailAvailable) {
- updateTexture2DImage(env, ctxProperties,
- ctxProperties->texture_detail_ext_enum,
- numLevels, level, internalFormat, format,
- width, height, boundaryWidth, imageYup);
- }
-}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_bindTexture(
- JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint objectId,
jboolean enable)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- /* textureCubeMap will take precedure over 3D Texture */
- glDisable(ctxProperties->texture_cube_map_ext_enum);
- }
+ /* textureCubeMap will take precedure over 3D Texture */
+ glDisable(GL_TEXTURE_CUBE_MAP);
if (enable == JNI_FALSE) {
- if(ctxProperties->texture3DAvailable) {
- glDisable(ctxProperties->texture_3D_ext_enum);
- }
-
+ glDisable(GL_TEXTURE_3D);
} else {
- if(ctxProperties->texture3DAvailable){
- glBindTexture(ctxProperties->texture_3D_ext_enum, objectId);
- glEnable(ctxProperties->texture_3D_ext_enum);
- }
+ glBindTexture(GL_TEXTURE_3D, objectId);
+ glEnable(GL_TEXTURE_3D);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureFilterModes(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DFilterModes(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint minFilter,
jint magFilter)
@@ -2794,9 +2777,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureFilterModes(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodRange(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DLodRange(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint baseLevel,
jint maximumLevel,
@@ -2812,9 +2795,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodRange(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodOffset(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DLodOffset(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jfloat lodOffsetS,
jfloat lodOffsetT,
@@ -2828,9 +2811,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodOffset(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureBoundary(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DBoundary(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint boundaryModeS,
jint boundaryModeT,
@@ -2849,9 +2832,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureBoundary(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSharpenFunc(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DSharpenFunc(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numPts,
jfloatArray pts)
@@ -2862,9 +2845,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSharpenFunc(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureFilter4Func(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DFilter4Func(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numPts,
jfloatArray pts)
@@ -2875,9 +2858,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureFilter4Func(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureAnisotropicFilter(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DAnisotropicFilter(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jfloat degree)
{
@@ -2888,147 +2871,184 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureAnisotropicFilt
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DImage(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numLevels,
jint level,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint width,
jint height,
jint depth,
jint boundaryWidth,
- jbyteArray imageYup)
+ jint dataType,
+ jobject data)
{
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if(ctxProperties->texture3DAvailable) {
+ void *imageObjPtr;
+ GLenum format = 0, internalFormat = 0, type = GL_UNSIGNED_INT_8_8_8_8;
+ JNIEnv table = *env;
+ GLboolean forceAlphaToOne = GL_FALSE;
- GLenum oglFormat = 0, oglInternalFormat=0;
- JNIEnv table = *env;
- jbyte *byteData;
- jshort *shortData;
+ GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
+
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ imageObjPtr = (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)data, NULL);
+ }
+ else {
+ imageObjPtr = (void *)(*(table->GetDirectBufferAddress))(env, data);
+ }
- switch (internalFormat) {
+ /* 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:
- oglInternalFormat = GL_INTENSITY;
+ internalFormat = GL_INTENSITY;
break;
case LUMINANCE:
- oglInternalFormat = GL_LUMINANCE;
+ internalFormat = GL_LUMINANCE;
break;
case ALPHA:
- oglInternalFormat = GL_ALPHA;
+ internalFormat = GL_ALPHA;
break;
case LUMINANCE_ALPHA:
- oglInternalFormat = GL_LUMINANCE_ALPHA;
+ internalFormat = GL_LUMINANCE_ALPHA;
break;
case J3D_RGB:
- oglInternalFormat = GL_RGB;
+ internalFormat = GL_RGB;
break;
case J3D_RGBA:
- oglInternalFormat = GL_RGBA;
- break;
- }
-
- switch (format) {
- case FORMAT_BYTE_RGBA:
- /* all RGB types are stored as RGBA */
- oglFormat = GL_RGBA;
- break;
- case FORMAT_BYTE_RGB:
- oglFormat = GL_RGB;
+ internalFormat = GL_RGBA;
break;
+ default:
+ throwAssert(env, "updateTexture3DImage : textureFormat illegal format");
+ return;
+ }
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- oglFormat = GL_ABGR_EXT;
- }
- break;
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- oglFormat = ctxProperties->bgr_ext_enum;
- }
- break;
- case FORMAT_BYTE_LA:
+
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_BYTE_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_BYTE_BGR:
+ format = GL_BGR;
+ break;
+ case IMAGE_FORMAT_BYTE_RGB:
+ format = GL_RGB;
+ break;
+ /* GL_ABGR_EXT */
+ case IMAGE_FORMAT_BYTE_ABGR:
+ if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
+ format = GL_ABGR_EXT;
+ }
+ else {
+ throwAssert(env, "updateTexture3DImage : GL_ABGR_EXT format is unsupported");
+ return;
+ }
+ break;
+ case IMAGE_FORMAT_BYTE_RGBA:
+ format = GL_RGBA;
+ break;
+ case IMAGE_FORMAT_BYTE_LA:
/* all LA types are stored as LA8 */
- oglFormat = GL_LUMINANCE_ALPHA;
+ format = GL_LUMINANCE_ALPHA;
break;
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- if (oglInternalFormat == GL_ALPHA) {
- oglFormat = GL_ALPHA;
+ case IMAGE_FORMAT_BYTE_GRAY:
+ if (internalFormat == GL_ALPHA) {
+ format = GL_ALPHA;
} else {
- oglFormat = GL_LUMINANCE;
+ format = GL_LUMINANCE;
}
break;
- }
- /*
- fprintf(stderr,"internalFormat = %x\n",internalFormat);
- fprintf(stderr,"format = %x\n",format);
- fprintf(stderr,"oglFormat = %x\n",oglFormat);
- fprintf(stderr,"oglInternalFormat = %x\n",oglInternalFormat);
- */
- if (imageYup != NULL) {
- if (format != FORMAT_USHORT_GRAY) {
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- imageYup,
- NULL);
- }
- else { /* unsigned short */
- shortData = (jshort *)(*(table->GetPrimitiveArrayCritical))(env,
- imageYup,
- NULL);
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_INT_BGR:
+ case IMAGE_FORMAT_INT_RGB:
+ case IMAGE_FORMAT_INT_ARGB:
+ default:
+ throwAssert(env, "updateTexture3DImage : imageFormat illegal format");
+ return;
+ }
- }
- } else {
- byteData = NULL;
- shortData = NULL;
+ ctxProperties->glTexImage3DEXT(GL_TEXTURE_3D,
+ level, internalFormat,
+ width, height, depth, boundaryWidth,
+ format, GL_UNSIGNED_BYTE,
+ imageObjPtr);
+
+ }
+ else if((dataType == IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_INT_BGR: /* Assume XBGR format */
+ format = GL_RGBA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ forceAlphaToOne = GL_TRUE;
+ break;
+ case IMAGE_FORMAT_INT_RGB: /* Assume XRGB format */
+ forceAlphaToOne = GL_TRUE;
+ /* Fall through to next case */
+ case IMAGE_FORMAT_INT_ARGB:
+ format = GL_BGRA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ /* This method only supports 3 and 4 components formats and INT types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_BGR:
+ case IMAGE_FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_ABGR:
+ default:
+ throwAssert(env, "updateTexture3DImage : imageFormat illegal format");
+ return;
+ }
+
+ /* Force Alpha to 1.0 if needed */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
+ }
+
+ ctxProperties->glTexImage3DEXT(GL_TEXTURE_3D,
+ level, internalFormat,
+ width, height, depth, boundaryWidth,
+ format, type, imageObjPtr);
+
+ /* Restore Alpha scale and bias */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
}
+ }
+ else {
+ throwAssert(env, "updateTexture3DImage : illegal image data type");
+ }
- if (format != FORMAT_USHORT_GRAY) {
- ctxProperties->glTexImage3DEXT(ctxProperties->texture_3D_ext_enum,
- level, oglInternalFormat,
- width, height, depth, boundaryWidth,
- oglFormat, GL_UNSIGNED_BYTE,
- (GLvoid *)byteData);
- }
- else {
- ctxProperties->glTexImage3DEXT(ctxProperties->texture_3D_ext_enum,
- level, oglInternalFormat,
- width, height, depth, boundaryWidth,
- oglFormat, GL_UNSIGNED_SHORT,
- (GLvoid *)shortData);
- }
- if (imageYup != NULL) {
- if (format != FORMAT_USHORT_GRAY) {
- (*(table->ReleasePrimitiveArrayCritical))(env, imageYup, byteData, 0);
- } else { /* unsigned short */
- (*(table->ReleasePrimitiveArrayCritical))(env, imageYup, shortData, 0);
-
- }
- }
-
- /* No idea why we need following call. */
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ (*(table->ReleasePrimitiveArrayCritical))(env, data, imageObjPtr, 0);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSubImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DSubImage(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint level,
jint xoffset,
jint yoffset,
jint zoffset,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint imgXOffset,
jint imgYOffset,
jint imgZOffset,
@@ -3037,139 +3057,195 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSubImage(
jint width,
jint height,
jint depth,
- jbyteArray image) {
+ jint dataType,
+ jobject data) {
+ void *imageObjPtr;
+ GLenum format = 0, internalFormat = 0, type = GL_UNSIGNED_INT_8_8_8_8;
+ JNIEnv table = *env;
+ GLboolean forceAlphaToOne = GL_FALSE;
+ jbyte *tmpByte;
+ jint *tmpInt;
+ jint numBytes = 0;
+ jboolean pixelStore = JNI_FALSE;
+
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if (ctxProperties->texture3DAvailable) {
- GLenum oglFormat = 0, oglInternalFormat=0;
- JNIEnv table = *env;
- jbyte *byteData, *tmpByte;
- jshort *shortData, *tmpShort;
- jint numBytes = 0;
- jboolean pixelStore = JNI_FALSE;
-
- switch (internalFormat) {
- case INTENSITY:
- oglInternalFormat = GL_INTENSITY;
- break;
- case LUMINANCE:
- oglInternalFormat = GL_LUMINANCE;
- break;
- case ALPHA:
- oglInternalFormat = GL_ALPHA;
- break;
- case LUMINANCE_ALPHA:
- oglInternalFormat = GL_LUMINANCE_ALPHA;
- break;
- case J3D_RGB:
- oglInternalFormat = GL_RGB;
- break;
- case J3D_RGBA:
- oglInternalFormat = GL_RGBA;
- break;
- }
-
- switch (format) {
- case FORMAT_BYTE_RGBA:
- /* all RGB types are stored as RGBA */
- oglFormat = GL_RGBA;
- numBytes = 4;
- break;
- case FORMAT_BYTE_RGB:
- oglFormat = GL_RGB;
- numBytes = 3;
- break;
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ imageObjPtr = (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)data, NULL);
+ }
+ else {
+ imageObjPtr = (void *)(*(table->GetDirectBufferAddress))(env, data);
+ }
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- oglFormat = GL_ABGR_EXT;
- numBytes = 4;
- }
- break;
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- oglFormat = ctxProperties->bgr_ext_enum;
- numBytes = 3;
- }
- break;
+ if (imgXOffset > 0 || (width < tilew)) {
+ 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, 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;
+ break;
+ case LUMINANCE:
+ internalFormat = GL_LUMINANCE;
+ break;
+ case ALPHA:
+ internalFormat = GL_ALPHA;
+ break;
+ case LUMINANCE_ALPHA:
+ internalFormat = GL_LUMINANCE_ALPHA;
+ break;
+ case J3D_RGB:
+ internalFormat = GL_RGB;
+ break;
+ case J3D_RGBA:
+ internalFormat = GL_RGBA;
+ break;
+ default:
+ throwAssert(env, "updateTexture3DSubImage : textureFormat illegal format");
+ break;
+ }
- case FORMAT_BYTE_LA:
- /* all LA types are stored as LA8 */
- oglFormat = GL_LUMINANCE_ALPHA;
- numBytes = 2;
- break;
- case FORMAT_BYTE_GRAY:
- if (oglInternalFormat == GL_ALPHA) {
- oglFormat = GL_ALPHA;
- } else {
- oglFormat = GL_LUMINANCE;
- }
- numBytes = 1;
- case FORMAT_USHORT_GRAY:
- if (oglInternalFormat == GL_ALPHA) {
- oglFormat = GL_ALPHA;
- } else {
- oglFormat = GL_LUMINANCE;
- }
- numBytes = 2;
- break;
- }
- /*
- fprintf(stderr,"format = %x\n",format);
- fprintf(stderr,"oglFormat = %x\n",oglFormat);
- fprintf(stderr, "imgXOffset = %d\n",imgXOffset);
- fprintf(stderr, "imgYOffset = %d\n",imgYOffset);
- fprintf(stderr, "imgZOffset = %d\n",imgZOffset);
- fprintf(stderr, "xoffset = %d\n",xoffset);
- fprintf(stderr, "yoffset = %d\n",yoffset);
- fprintf(stderr, "zoffset = %d\n",zoffset);
- fprintf(stderr, "tilew = %d\n",tilew);
- fprintf(stderr, "tileh = %d\n",tilew);
- fprintf(stderr, "numBytes = %d\n",numBytes);
- fprintf(stderr, "width = %d\n",width);
- fprintf(stderr, "height = %d\n",height);
- fprintf(stderr, "depth = %d\n",depth);
- */
- if (imgXOffset > 0 || (width < tilew)) {
- pixelStore = JNI_TRUE;
- glPixelStorei(GL_UNPACK_ROW_LENGTH, tilew);
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_BYTE_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_BYTE_BGR:
+ format = GL_BGR;
+ numBytes = 3;
+ break;
+ case IMAGE_FORMAT_BYTE_RGB:
+ format = GL_RGB;
+ numBytes = 3;
+ break;
+ /* GL_ABGR_EXT */
+ case IMAGE_FORMAT_BYTE_ABGR:
+ if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
+ format = GL_ABGR_EXT;
+ numBytes = 4;
+ }
+ else {
+ throwAssert(env, "updateTexture3DSubImage : GL_ABGR_EXT format is unsupported");
+ }
+ break;
+ case IMAGE_FORMAT_BYTE_RGBA:
+ format = GL_RGBA;
+ numBytes = 4;
+ break;
+ case IMAGE_FORMAT_BYTE_LA:
+ /* all LA types are stored as LA8 */
+ format = GL_LUMINANCE_ALPHA;
+ numBytes = 2;
+ break;
+ case IMAGE_FORMAT_BYTE_GRAY:
+ if (internalFormat == GL_ALPHA) {
+ format = GL_ALPHA;
+ numBytes = 1;
+ } else {
+ format = GL_LUMINANCE;
+ numBytes = 1;
+ }
+ break;
+
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_INT_BGR:
+ case IMAGE_FORMAT_INT_RGB:
+ case IMAGE_FORMAT_INT_ARGB:
+ default:
+ throwAssert(env, "updateTexture3DSubImage : imageFormat illegal format");
+ break;
}
-
- if (format != FORMAT_USHORT_GRAY) {
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- image, NULL);
-
- tmpByte = byteData +
- (tilew * tileh * imgZOffset +
- tilew * imgYOffset + imgXOffset) * numBytes;
-
- ctxProperties->glTexSubImage3DEXT(
- ctxProperties->texture_3D_ext_enum,
- level, xoffset, yoffset, zoffset,
- width, height, depth,
- oglFormat, GL_UNSIGNED_BYTE,
- (GLvoid *)tmpByte);
-
- (*(table->ReleasePrimitiveArrayCritical))(env, image, byteData, 0);
- } else { /* unsigned short */
- shortData = (jshort *)(*(table->GetPrimitiveArrayCritical))(env,
- image, NULL);
- tmpShort = (jshort*)((jbyte*)shortData+
- (tilew * tileh * imgZOffset +
- tilew * imgYOffset + imgXOffset)*numBytes);
+
+ tmpByte = (jbyte*)imageObjPtr +
+ (tilew * tileh * imgZOffset + tilew * imgYOffset + imgXOffset) *
+ numBytes;
+
+ ctxProperties->glTexSubImage3DEXT(GL_TEXTURE_3D,
+ level, xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, GL_UNSIGNED_BYTE,
+ (GLvoid *)tmpByte);
+
+
+ }
+ else if((dataType == IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_BUFFER)) {
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_INT_BGR: /* Assume XBGR format */
+ format = GL_RGBA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ forceAlphaToOne = GL_TRUE;
+ break;
+ case IMAGE_FORMAT_INT_RGB: /* Assume XRGB format */
+ forceAlphaToOne = GL_TRUE;
+ /* Fall through to next case */
+ case IMAGE_FORMAT_INT_ARGB:
+ format = GL_BGRA;
+ type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ /* This method only supports 3 and 4 components formats and INT types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_BGR:
+ case IMAGE_FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_ABGR:
+ default:
+ throwAssert(env, "updateTexture3DSubImage : imageFormat illegal format");
+ break;
+ }
+
+ numBytes = 4;
+
+ tmpInt = (jint*)((jbyte*)imageObjPtr +
+ (tilew * tileh * imgZOffset +
+ tilew * imgYOffset + imgXOffset)*numBytes);
+
+ /* Force Alpha to 1.0 if needed */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
+ }
+
+ ctxProperties->glTexSubImage3DEXT(GL_TEXTURE_3D,
+ level, xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type,
+ (GLvoid *)tmpInt);
+
+ /* Restore Alpha scale and bias */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
+ }
+ }
+ else {
+ throwAssert(env, "updateTexture3DImage : illegal image data type");
+ return;
+ }
+
+
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ (*(table->ReleasePrimitiveArrayCritical))(env, data, imageObjPtr, 0);
+ }
- ctxProperties->glTexSubImage3DEXT(
- ctxProperties->texture_3D_ext_enum,
- level, xoffset, yoffset, zoffset,
- width, height, depth,
- oglFormat, GL_UNSIGNED_SHORT,
- (GLvoid *)tmpShort);
- (*(table->ReleasePrimitiveArrayCritical))(env, image, shortData, 0);
- }
- if (pixelStore) {
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- }
+ if (pixelStore) {
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
}
@@ -3189,9 +3265,9 @@ jint _gl_textureCubeMapFace[] = {
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_bindTexture(
+void JNICALL Java_javax_media_j3d_NativePipeline_bindTextureCubeMap(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint objectId,
jboolean enable)
@@ -3202,39 +3278,33 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_bindTexture(
* TextureCubeMap will take precedure over 3D Texture so
* there is no need to disable 3D Texture here.
*/
- if (ctxProperties->textureCubeMapAvailable) {
- if (enable == JNI_FALSE) {
- glDisable(ctxProperties->texture_cube_map_ext_enum);
- } else {
- glBindTexture(ctxProperties->texture_cube_map_ext_enum, objectId);
- glEnable(ctxProperties->texture_cube_map_ext_enum);
- }
+ if (enable == JNI_FALSE) {
+ glDisable(GL_TEXTURE_CUBE_MAP);
+ } else {
+ glBindTexture(GL_TEXTURE_CUBE_MAP, objectId);
+ glEnable(GL_TEXTURE_CUBE_MAP);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureFilterModes(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapFilterModes(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint minFilter,
jint magFilter)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- updateTextureFilterModes(ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
- minFilter, magFilter);
- }
+ updateTextureFilterModes(ctxProperties,
+ GL_TEXTURE_CUBE_MAP,
+ minFilter, magFilter);
}
-
-
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodRange(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapLodRange(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint baseLevel,
jint maximumLevel,
@@ -3245,15 +3315,15 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodRange(
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTextureLodRange(ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
+ GL_TEXTURE_CUBE_MAP,
baseLevel, maximumLevel,
minimumLOD, maximumLOD);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodOffset(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapLodOffset(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jfloat lodOffsetS,
jfloat lodOffsetT,
@@ -3262,15 +3332,15 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodOffset(
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTextureLodOffset(ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
+ GL_TEXTURE_CUBE_MAP,
lodOffsetS, lodOffsetT, lodOffsetR);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureBoundary(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapBoundary(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint boundaryModeS,
jint boundaryModeT,
@@ -3281,117 +3351,110 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureBoundary(
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- updateTextureBoundary(ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
- boundaryModeS, boundaryModeT, -1,
- boundaryRed, boundaryGreen,
- boundaryBlue, boundaryAlpha);
- }
+ updateTextureBoundary(ctxProperties,
+ GL_TEXTURE_CUBE_MAP,
+ boundaryModeS, boundaryModeT, -1,
+ boundaryRed, boundaryGreen,
+ boundaryBlue, boundaryAlpha);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureSharpenFunc(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapSharpenFunc(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numPts,
jfloatArray pts)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- updateTextureSharpenFunc(env, ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
- numPts, pts);
- }
+ updateTextureSharpenFunc(env, ctxProperties,
+ GL_TEXTURE_CUBE_MAP,
+ numPts, pts);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureFilter4Func(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapFilter4Func(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint numPts,
jfloatArray pts)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- updateTextureFilter4Func(env, ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
- numPts, pts);
- }
+ updateTextureFilter4Func(env, ctxProperties,
+ GL_TEXTURE_CUBE_MAP,
+ numPts, pts);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureAnisotropicFilter(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapAnisotropicFilter(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jfloat degree)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if (ctxProperties->textureCubeMapAvailable) {
- updateTextureAnisotropicFilter(env, ctxProperties,
- ctxProperties->texture_cube_map_ext_enum,
- degree);
- }
+ updateTextureAnisotropicFilter(env, ctxProperties,
+ GL_TEXTURE_CUBE_MAP,
+ degree);
}
-
+
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureSubImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapSubImage(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint face,
jint level,
jint xoffset,
jint yoffset,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint imgXOffset,
jint imgYOffset,
jint tilew,
jint width,
jint height,
- jbyteArray image) {
-
+ jint dataType,
+ jobject data)
+{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTexture2DSubImage(env, ctxProperties, _gl_textureCubeMapFace[face],
- level, xoffset, yoffset, internalFormat,
- format, imgXOffset, imgYOffset, tilew,
- width, height, image);
+ level, xoffset, yoffset, textureFormat,
+ imageFormat, imgXOffset, imgYOffset, tilew,
+ width, height, dataType, data);
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureImage(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapImage(
JNIEnv *env,
- jobject texture,
+ jobject obj,
jlong ctxInfo,
jint face,
jint numLevels,
jint level,
- jint internalFormat,
- jint format,
+ jint textureFormat,
+ jint imageFormat,
jint width,
jint height,
jint boundaryWidth,
- jbyteArray imageYup)
+ jint dataType,
+ jobject data)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
updateTexture2DImage(env, ctxProperties, _gl_textureCubeMapFace[face],
- numLevels, level, internalFormat, format,
- width, height, boundaryWidth, imageYup);
+ numLevels, level, textureFormat, imageFormat,
+ width, height, boundaryWidth, dataType, data);
}
-
JNIEXPORT
-jboolean JNICALL Java_javax_media_j3d_Canvas3D_decal1stChildSetup(
+jboolean JNICALL Java_javax_media_j3d_NativePipeline_decal1stChildSetup(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -3408,7 +3471,7 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_decal1stChildSetup(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_decalNthChildSetup(
+void JNICALL Java_javax_media_j3d_NativePipeline_decalNthChildSetup(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -3419,7 +3482,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_decalNthChildSetup(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_decalReset(
+void JNICALL Java_javax_media_j3d_NativePipeline_decalReset(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -3431,7 +3494,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_decalReset(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_ctxUpdateEyeLightingEnable(
+void JNICALL Java_javax_media_j3d_NativePipeline_ctxUpdateEyeLightingEnable(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -3445,69 +3508,50 @@ void JNICALL Java_javax_media_j3d_Canvas3D_ctxUpdateEyeLightingEnable(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_updateSeparateSpecularColorEnable(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateSeparateSpecularColorEnable(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
jboolean enable)
{
- /*
- * This method will not be called if the rendering layer does not support
- * separate specular color control. The checking of the availability
- * of the functionality is done in Renderer at rendering time
- */
-
- /* 1.2 feature only */
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if(ctxProperties->seperate_specular_color) {
- if (enable == JNI_TRUE) {
- glLightModeli(ctxProperties->light_model_color_control_enum,
- ctxProperties->seperate_specular_color_enum);
- } else {
- glLightModeli(ctxProperties->light_model_color_control_enum, ctxProperties->single_color_enum);
- }
+ if (enable) {
+ glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+ } else {
+ glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_TextureUnitStateRetained_updateTextureUnitState(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureUnitState(
JNIEnv *env,
- jobject cv,
+ jobject obj,
jlong ctxInfo,
jint index,
jboolean enable)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if(ctxProperties->arb_multitexture) {
- if (index >= 0) {
- ctxProperties->glActiveTextureARB(index + GL_TEXTURE0_ARB);
- ctxProperties->glClientActiveTextureARB(GL_TEXTURE0_ARB + index);
- if (ctxProperties->textureRegisterCombinersAvailable) {
- ctxProperties->currentTextureUnit = index + GL_TEXTURE0_ARB;
- ctxProperties->currentCombinerUnit = index + GL_COMBINER0_NV;
- if (ctxProperties->glCombinerParameteriNV!=NULL)
- ctxProperties->glCombinerParameteriNV(
- GL_NUM_GENERAL_COMBINERS_NV, index + 1);
- }
- }
- } /* GL_ARB_multitexture */
+ if (ctxProperties->gl13 && index >= 0) {
+ ctxProperties->glActiveTexture(index + GL_TEXTURE0);
+ ctxProperties->glClientActiveTexture(GL_TEXTURE0 + index);
+ if (ctxProperties->textureRegisterCombinersAvailable) {
+ ctxProperties->currentTextureUnit = index + GL_TEXTURE0;
+ ctxProperties->currentCombinerUnit = index + GL_COMBINER0_NV;
+ if (ctxProperties->glCombinerParameteriNV != NULL)
+ ctxProperties->glCombinerParameteriNV(
+ GL_NUM_GENERAL_COMBINERS_NV, index + 1);
+ }
+ }
if (enable == JNI_FALSE) {
/* if not enabled, then don't enable any tex mapping */
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
-
- if(ctxProperties->texture3DAvailable)
- glDisable(ctxProperties->texture_3D_ext_enum);
-
- if(ctxProperties->textureCubeMapAvailable)
- glDisable(ctxProperties->texture_cube_map_ext_enum);
- }
+ glDisable(GL_TEXTURE_3D);
+ glDisable(GL_TEXTURE_CUBE_MAP);
+ }
/*
* if it is enabled, the enable flag will be taken care of
@@ -3517,7 +3561,7 @@ void JNICALL Java_javax_media_j3d_TextureUnitStateRetained_updateTextureUnitStat
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setBlendColor(
+void JNICALL Java_javax_media_j3d_NativePipeline_setBlendColor(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -3541,7 +3585,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setBlendColor(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setBlendFunc(
+void JNICALL Java_javax_media_j3d_NativePipeline_setBlendFunc(
JNIEnv * env,
jobject obj,
jlong ctxInfo,
@@ -3555,7 +3599,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setBlendFunc(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setFogEnableFlag(
+void JNICALL Java_javax_media_j3d_NativePipeline_setFogEnableFlag(
JNIEnv * env,
jobject obj,
jlong ctxInfo,
@@ -3568,7 +3612,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setFogEnableFlag(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_activeTextureUnit(
+void JNICALL Java_javax_media_j3d_NativePipeline_activeTextureUnit(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -3576,28 +3620,12 @@ void JNICALL Java_javax_media_j3d_Canvas3D_activeTextureUnit(
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if(ctxProperties->arb_multitexture){
- ctxProperties->glActiveTextureARB(GL_TEXTURE0_ARB + index);
- ctxProperties->glClientActiveTextureARB(GL_TEXTURE0_ARB + index);
- /* GL_ARB_multitexture */
+ if (ctxProperties->gl13) {
+ ctxProperties->glActiveTexture(GL_TEXTURE0 + index);
+ ctxProperties->glClientActiveTexture(GL_TEXTURE0 + index);
}
}
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_updateTexUnitStateMap(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo,
- jint numActiveTexUnit,
- jintArray texUnitStateMapArray)
-{
- /*
- * texture unit state map is explicitly handled in
- * execute; for display list, texture unit has to match
- * texture unit state.
- */
-}
-
/*
* strJavaToC
@@ -3699,13 +3727,3 @@ createShaderError(
return shaderError;
}
-
-
-void
-throwAssert(JNIEnv *env, char *str)
-{
- jclass rte;
- if ((rte = (*env)->FindClass(env, "java/lang/AssertionError")) != NULL) {
- (*env)->ThrowNew(env, rte, str);
- }
-}
diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c
index 9c15e92..b6cb469 100644
--- a/src/native/ogl/Canvas3D.c
+++ b/src/native/ogl/Canvas3D.c
@@ -43,19 +43,18 @@ extern void throwAssert(JNIEnv *env, char *str);
static void initializeCtxInfo(JNIEnv *env, GraphicsContextPropertiesInfo* ctxInfo);
static void cleanupCtxInfo(GraphicsContextPropertiesInfo* ctxInfo);
static void disableAttribFor2D(GraphicsContextPropertiesInfo *ctxProperties);
+static void disableAttribForRaster(GraphicsContextPropertiesInfo *ctxProperties);
/*
* Class: javax_media_j3d_Canvas3D
* Method: getTextureColorTableSize
* Signature: ()I
*/
-extern int getTextureColorTableSize(
+static int getTextureColorTableSize(
JNIEnv *env,
jobject obj,
- jlong ctxInfo,
- char *extensionStr,
- int minorVersion);
-
+ GraphicsContextPropertiesInfo *ctxInfo,
+ char *extensionStr);
extern void checkGLSLShaderExtensions(
JNIEnv *env,
@@ -138,26 +137,25 @@ checkTextureExtensions(
JNIEnv *env,
jobject obj,
char *tmpExtensionStr,
- int versionNumber,
GraphicsContextPropertiesInfo* ctxInfo)
{
- if (isExtensionSupported(tmpExtensionStr, "GL_ARB_multitexture")) {
- ctxInfo->arb_multitexture = JNI_TRUE;
+ if (ctxInfo->gl13) {
ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_MULTI_TEXTURE;
- glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ctxInfo->maxTextureUnits);
+ glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ctxInfo->maxTextureUnits);
ctxInfo->maxTexCoordSets = ctxInfo->maxTextureUnits;
if (isExtensionSupported(tmpExtensionStr, "GL_ARB_vertex_shader")) {
glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &ctxInfo->maxTexCoordSets);
}
}
-
+
if(isExtensionSupported(tmpExtensionStr,"GL_SGI_texture_color_table" )){
ctxInfo->textureColorTableAvailable = JNI_TRUE;
ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_COLOR_TABLE;
/* get texture color table size */
/* need to check later */
- ctxInfo->textureColorTableSize = getTextureColorTableSize(env, obj, (jlong)ctxInfo, tmpExtensionStr, versionNumber);
+ ctxInfo->textureColorTableSize = getTextureColorTableSize(env, obj,
+ ctxInfo, tmpExtensionStr);
if (ctxInfo->textureColorTableSize <= 0) {
ctxInfo->textureColorTableAvailable = JNI_FALSE;
ctxInfo->textureExtMask &= ~javax_media_j3d_Canvas3D_TEXTURE_COLOR_TABLE;
@@ -289,13 +287,7 @@ checkTextureExtensions(
ctxInfo->combine_dot3_rgba_enum = GL_DOT3_RGBA_EXT;
}
- if (isExtensionSupported(tmpExtensionStr, "GL_ARB_texture_cube_map")) {
- ctxInfo->texture_cube_map_ext_enum = GL_TEXTURE_CUBE_MAP_ARB;
- ctxInfo->textureCubeMapAvailable = JNI_TRUE;
- ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_CUBE_MAP;
- } else if (isExtensionSupported(tmpExtensionStr, "GL_EXT_texture_cube_map")) {
- ctxInfo->texture_cube_map_ext_enum = GL_TEXTURE_CUBE_MAP_EXT;
- ctxInfo->textureCubeMapAvailable = JNI_TRUE;
+ if (ctxInfo->gl13) {
ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_CUBE_MAP;
}
@@ -374,22 +366,26 @@ checkTextureExtensions(
javax_media_j3d_Canvas3D_TEXTURE_ANISOTROPIC_FILTER;
}
- if (isExtensionSupported(tmpExtensionStr,
- "GL_ARB_texture_border_clamp")) {
- ctxInfo->texture_clamp_to_border_enum = GL_CLAMP_TO_BORDER_ARB;
- } else if (isExtensionSupported(tmpExtensionStr,
- "GL_SGIS_texture_border_clamp")) {
- ctxInfo->texture_clamp_to_border_enum = GL_CLAMP_TO_BORDER_SGIS;
+ if (ctxInfo->gl13) {
+ ctxInfo->texture_clamp_to_border_enum = GL_CLAMP_TO_BORDER;
} else {
ctxInfo->texture_clamp_to_border_enum = GL_CLAMP;
}
-
+
if (isExtensionSupported(tmpExtensionStr,
"GL_SGIX_texture_lod_bias")) {
ctxInfo->textureLodBiasAvailable = JNI_TRUE;
ctxInfo->textureExtMask |=
javax_media_j3d_Canvas3D_TEXTURE_LOD_OFFSET;
}
+
+ if (isExtensionSupported(tmpExtensionStr,
+ "GL_ARB_texture_non_power_of_two")) {
+ ctxInfo->textureNonPowerOfTwoAvailable = JNI_TRUE;
+ ctxInfo->textureExtMask |=
+ javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO;
+ }
+
}
jboolean
@@ -433,6 +429,47 @@ getJavaBoolEnv(JNIEnv *env, char* envStr)
return (*(table->GetBooleanField))(env, obj, fieldID);
}
+jint
+getJavaIntEnv(JNIEnv *env, char* envStr)
+{
+ JNIEnv table = *env;
+ jclass cls;
+ jfieldID fieldID;
+ jobject obj;
+
+ cls = (jclass) (*(table->FindClass))(env, "javax/media/j3d/VirtualUniverse");
+
+ if (cls == NULL) {
+ return JNI_FALSE;
+ }
+
+ fieldID = (jfieldID) (*(table->GetStaticFieldID))(env, cls, "mc",
+ "Ljavax/media/j3d/MasterControl;");
+ if (fieldID == NULL) {
+ return JNI_FALSE;
+ }
+
+ obj = (*(table->GetStaticObjectField))(env, cls, fieldID);
+
+ if (obj == NULL) {
+ return JNI_FALSE;
+ }
+
+ cls = (jclass) (*(table->FindClass))(env, "javax/media/j3d/MasterControl");
+
+ if (cls == NULL) {
+ return JNI_FALSE;
+ }
+
+ fieldID = (jfieldID) (*(table->GetFieldID))(env, cls, envStr, "I");
+
+ if (fieldID == NULL ) {
+ return JNI_FALSE;
+ }
+
+ return (*(table->GetIntField))(env, obj, fieldID);
+}
+
/*
* Dummy functions for language-independent vertex attribute functions
*/
@@ -536,88 +573,96 @@ getPropertiesFromCurrentContext(
/* find out the version, major and minor version number */
extractVersionInfo(tmpVersionStr, versionNumbers);
+
/* *********************************************************/
/* setup the graphics context properties */
- /* NOTE : At some point we will want to require OpenGL 1.3 */
- /* Check for OpenGL 1.2 core or better */
- if ((versionNumbers[0] > 1) ||
- (versionNumbers[0] == 1 && versionNumbers[1] >= 2)) {
+ /*
+ * NOTE: Java 3D now requires OpenGL 1.3 for full functionality.
+ * For backwards compatibility with certain older graphics cards and
+ * drivers (e.g., the Linux DRI driver for older ATI cards),
+ * we will try to run on OpenGL 1.2 in an unsupported manner. However,
+ * we will not attempt to use OpenGL extensions for any features that
+ * are available in OpenGL 1.3, specifically multitexture, multisample,
+ * and cube map textures.
+ */
+ if (versionNumbers[0] < 1 ||
+ (versionNumbers[0] == 1 && versionNumbers[1] < 2)) {
+ jclass rte;
- if (versionNumbers[0] == 1 && versionNumbers[1] == 2) {
- fprintf(stderr,
- "Java 3D WARNING : OpenGL 1.3 will be required in the near future (GL_VERSION=%d.%d)\n",
+ fprintf(stderr,
+ "Java 3D ERROR : OpenGL 1.2 or better is required (GL_VERSION=%d.%d)\n",
versionNumbers[0], versionNumbers[1]);
+ if ((rte = (*(table->FindClass))(env, "javax/media/j3d/IllegalRenderingStateException")) != NULL) {
+ (*(table->ThrowNew))(env, rte, "GL_VERSION");
}
+ return JNI_FALSE;
+ }
+
+ if (versionNumbers[0] > 1) {
+ /* OpenGL 2.x -- set flags for 1.3 and 2.0 or greater */
+ ctxInfo->gl20 = JNI_TRUE;
+ ctxInfo->gl13 = JNI_TRUE;
+ }
+ else {
+ if (versionNumbers[1] == 2) {
+ fprintf(stderr,
+ "*********************************************************\n");
+ fprintf(stderr,
+ "*** JAVA 3D: WARNING OpenGL 1.2 is no longer supported.\n");
+ fprintf(stderr,
+ "*** Will attempt to run with reduced functionality.\n");
+ fprintf(stderr,
+ "*********************************************************\n");
+ } else {
+ // OpenGL 1.x (1.3 or greater)
+ ctxInfo->gl13 = JNI_TRUE;
+ }
+ }
+
- ctxInfo->rescale_normal_ext = JNI_TRUE;
- ctxInfo->rescale_normal_ext_enum = GL_RESCALE_NORMAL;
- ctxInfo->bgr_ext = JNI_TRUE;
- ctxInfo->bgr_ext_enum = GL_BGR;
- ctxInfo->texture3DAvailable = JNI_TRUE;
- ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_3D;
+ /* Setup function pointers for core OpenGL 1.3 features */
+
+ ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_3D;
#if defined(UNIX)
- ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexImage3D");
- ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexSubImage3D");
+ ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexImage3D");
+ ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )dlsym(RTLD_DEFAULT, "glTexSubImage3D");
#endif
#ifdef WIN32
- ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )wglGetProcAddress("glTexImage3D");
- ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )wglGetProcAddress("glTexSubImage3D");
- if ((ctxInfo->glTexImage3DEXT == NULL) || (ctxInfo->glTexSubImage3DEXT == NULL)) {
- ctxInfo->textureExtMask &= ~javax_media_j3d_Canvas3D_TEXTURE_3D;
- ctxInfo->texture3DAvailable = JNI_FALSE;
- }
+ ctxInfo->glTexImage3DEXT = (MYPFNGLTEXIMAGE3DPROC )wglGetProcAddress("glTexImage3D");
+ ctxInfo->glTexSubImage3DEXT = (MYPFNGLTEXSUBIMAGE3DPROC )wglGetProcAddress("glTexSubImage3D");
#endif
- ctxInfo->texture_3D_ext_enum = GL_TEXTURE_3D;
- ctxInfo->texture_wrap_r_ext_enum = GL_TEXTURE_WRAP_R;
- ctxInfo->texture_clamp_to_edge_enum = GL_CLAMP_TO_EDGE;
- if(isExtensionSupported(tmpExtensionStr, "GL_ARB_imaging")){
- ctxInfo->blend_color_ext = JNI_TRUE;
-
- ctxInfo->blendFunctionTable[BLEND_CONSTANT_COLOR] = GL_CONSTANT_COLOR;
+ if(isExtensionSupported(tmpExtensionStr, "GL_ARB_imaging")){
+ ctxInfo->blend_color_ext = JNI_TRUE;
+
+ ctxInfo->blendFunctionTable[BLEND_CONSTANT_COLOR] = GL_CONSTANT_COLOR;
#if defined(UNIX)
- ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )dlsym(RTLD_DEFAULT, "glBlendColor");
+ ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )dlsym(RTLD_DEFAULT, "glBlendColor");
#endif
#ifdef WIN32
- ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )wglGetProcAddress("glBlendColor");
- if (ctxInfo->glBlendColor == NULL) {
- ctxInfo->blend_color_ext = JNI_FALSE;
- }
+ ctxInfo->glBlendColor = (MYPFNGLBLENDCOLORPROC )wglGetProcAddress("glBlendColor");
+ if (ctxInfo->glBlendColor == NULL) {
+ ctxInfo->blend_color_ext = JNI_FALSE;
+ }
#endif
- }
-
- ctxInfo->seperate_specular_color = JNI_TRUE;
- ctxInfo->light_model_color_control_enum = GL_LIGHT_MODEL_COLOR_CONTROL;
- ctxInfo->single_color_enum = GL_SINGLE_COLOR;
- ctxInfo->seperate_specular_color_enum = GL_SEPARATE_SPECULAR_COLOR;
+ }
- ctxInfo->textureLodAvailable = JNI_TRUE;
- ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_LOD_RANGE;
- ctxInfo->texture_min_lod_enum = GL_TEXTURE_MIN_LOD;
- ctxInfo->texture_max_lod_enum = GL_TEXTURE_MAX_LOD;
- ctxInfo->texture_base_level_enum = GL_TEXTURE_BASE_LEVEL;
- ctxInfo->texture_max_level_enum = GL_TEXTURE_MAX_LEVEL;
+ ctxInfo->textureLodAvailable = JNI_TRUE;
+ ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_LOD_RANGE;
+ ctxInfo->texture_min_lod_enum = GL_TEXTURE_MIN_LOD;
+ ctxInfo->texture_max_lod_enum = GL_TEXTURE_MAX_LOD;
+ ctxInfo->texture_base_level_enum = GL_TEXTURE_BASE_LEVEL;
+ ctxInfo->texture_max_level_enum = GL_TEXTURE_MAX_LEVEL;
- /* ... */
- }
- else {
- jclass rte;
- fprintf(stderr,
- "Java 3D ERROR : OpenGL 1.2 or better is required (GL_VERSION=%d.%d)\n",
- versionNumbers[0], versionNumbers[1]);
- if ((rte = (*(table->FindClass))(env, "java/lang/IllegalStateException")) != NULL) {
- (*(table->ThrowNew))(env, rte, "GL_VERSION");
- }
- return JNI_FALSE;
+ /* look for OpenGL 2.0 features */
+ if (ctxInfo->gl20) {
+ ctxInfo->textureNonPowerOfTwoAvailable = JNI_TRUE;
+ ctxInfo->textureExtMask |=
+ javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO;
}
- /*
- * TODO: Remove extension checks for those features that are core
- * in OpenGL 1.2 and just use the core feature.
- */
-
/* check extensions for remaining of 1.1 and 1.2 */
if(isExtensionSupported(tmpExtensionStr, "GL_EXT_multi_draw_arrays")){
ctxInfo->multi_draw_arrays_ext = JNI_TRUE;
@@ -632,45 +677,29 @@ getPropertiesFromCurrentContext(
ctxInfo->compiled_vertex_array_ext = JNI_TRUE;
}
-
- if(isExtensionSupported(tmpExtensionStr, "GLX_SUN_video_resize")){
- ctxInfo->videoResizeAvailable = JNI_TRUE;
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_SUN_VIDEO_RESIZE;
- }
-
if(isExtensionSupported(tmpExtensionStr, "GL_SUN_global_alpha")){
ctxInfo->global_alpha_sun = JNI_TRUE;
}
- if(isExtensionSupported(tmpExtensionStr, "GL_SUNX_constant_data")){
- ctxInfo->constant_data_sun = JNI_TRUE;
- }
-
if(isExtensionSupported(tmpExtensionStr, "GL_EXT_abgr")) {
ctxInfo->abgr_ext = JNI_TRUE;
}
-
- if(isExtensionSupported(tmpExtensionStr, "GL_ARB_transpose_matrix")) {
- ctxInfo->arb_transpose_matrix = JNI_TRUE;
- }
-#if defined(UNIX)
/*
- * setup ARB_multisample, under windows this is setup in
+ * Setup ctxInfo->multisample; under windows this is setup in
* NativeConfigTemplate when pixel format is choose
*/
- if (isExtensionSupported(tmpExtensionStr, "GL_ARB_multisample")){
- ctxInfo->arb_multisample = JNI_TRUE;
- }
+#if defined(UNIX)
+ ctxInfo->multisample = ctxInfo->gl13;
#endif
#ifdef WIN32
if(offScreen) {
- ctxInfo->arb_multisample = PixelFormatInfoPtr->offScreenHasMultisample;
+ ctxInfo->multisample = PixelFormatInfoPtr->offScreenHasMultisample;
}
else {
- ctxInfo->arb_multisample = PixelFormatInfoPtr->onScreenHasMultisample;
+ ctxInfo->multisample = PixelFormatInfoPtr->onScreenHasMultisample;
}
/*
@@ -678,8 +707,8 @@ getPropertiesFromCurrentContext(
PixelFormatInfoPtr->onScreenHasMultisample,
PixelFormatInfoPtr->offScreenHasMultisample);
- fprintf(stderr, "Canvas3D - ctxInfo->arb_multisample = %d, offScreen = %d\n",
- ctxInfo->arb_multisample, offScreen);
+ fprintf(stderr, "Canvas3D - ctxInfo->multisample = %d, offScreen = %d\n",
+ ctxInfo->multisample, offScreen);
*/
#endif
@@ -688,75 +717,43 @@ getPropertiesFromCurrentContext(
* Disable multisample by default since OpenGL will enable
* it by default if the surface is multisample capable.
*/
- if (ctxInfo->arb_multisample && !ctxInfo->implicit_multisample) {
- glDisable(GL_MULTISAMPLE_ARB);
+ if (ctxInfo->multisample && !ctxInfo->implicit_multisample) {
+ glDisable(GL_MULTISAMPLE);
}
/* Check texture extensions */
- checkTextureExtensions(env, obj, tmpExtensionStr, versionNumbers[1],
- ctxInfo);
+ checkTextureExtensions(env, obj, tmpExtensionStr, ctxInfo);
/* Check shader extensions */
- checkGLSLShaderExtensions(env, obj, tmpExtensionStr, ctxInfo, glslLibraryAvailable);
- checkCgShaderExtensions(env, obj, tmpExtensionStr, ctxInfo, cgLibraryAvailable);
-
- /* ... */
-
- /* *********************************************************/
- /* Set up rescale_normal if extension supported */
- if (ctxInfo->rescale_normal_ext ) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_RESCALE_NORMAL;
+ if (ctxInfo->gl13) {
+ checkGLSLShaderExtensions(env, obj, tmpExtensionStr, ctxInfo, glslLibraryAvailable);
+ checkCgShaderExtensions(env, obj, tmpExtensionStr, ctxInfo, cgLibraryAvailable);
+ } else {
+ /* Force shaders to be disabled, since no multitexture support */
+ char *emptyExtStr = " ";
+ checkGLSLShaderExtensions(env, obj, emptyExtStr, ctxInfo, JNI_FALSE);
+ checkCgShaderExtensions(env, obj, emptyExtStr, ctxInfo, JNI_FALSE);
}
- /* Setup the multi_draw_array */
- if(ctxInfo->multi_draw_arrays_ext) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_MULTI_DRAW_ARRAYS;
- } else if (ctxInfo->multi_draw_arrays_sun) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_SUN_MULTI_DRAW_ARRAYS;
- }
- if(ctxInfo->compiled_vertex_array_ext) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_COMPILED_VERTEX_ARRAYS;
- }
-
+ /* *********************************************************/
/* Setup GL_SUN_gloabl_alpha */
if (ctxInfo->global_alpha_sun) {
ctxInfo->extMask |= javax_media_j3d_Canvas3D_SUN_GLOBAL_ALPHA;
}
- /* Setup GL_SUNX_constant_data */
- if (ctxInfo->constant_data_sun) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_SUN_CONSTANT_DATA;
- }
-
/* Setup GL_EXT_abgr */
if (ctxInfo->abgr_ext) {
ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_ABGR;
}
- /* Setup GL_BGR_EXT */
- if (ctxInfo->bgr_ext) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_BGR;
- }
+ /* GL_BGR is always supported */
+ ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_BGR;
- /* Setup GL_ARB_transpose_matrix */
- if (ctxInfo->arb_transpose_matrix) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_ARB_TRANSPOSE_MATRIX;
- }
-
- /* Setup GL_EXT_separate_specular_color */
- if(ctxInfo->seperate_specular_color) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_EXT_SEPARATE_SPECULAR_COLOR;
- }
-
- if (ctxInfo->constant_data_sun) {
- /* glPixelStorei(GL_UNPACK_CONSTANT_DATA_SUNX, GL_TRUE); */
+ if(ctxInfo->multisample) {
+ ctxInfo->extMask |= javax_media_j3d_Canvas3D_MULTISAMPLE;
}
-
- if(ctxInfo->arb_multisample) {
- ctxInfo->extMask |= javax_media_j3d_Canvas3D_ARB_MULTISAMPLE;
- }
-
+
/* setup those functions pointers */
#ifdef WIN32
@@ -786,53 +783,15 @@ getPropertiesFromCurrentContext(
}
}
- if (ctxInfo->arb_multitexture) {
- ctxInfo->glClientActiveTextureARB = (MYPFNGLCLIENTACTIVETEXTUREARBPROC)wglGetProcAddress("glClientActiveTextureARB");
- ctxInfo->glMultiTexCoord2fvARB = (MYPFNGLMULTITEXCOORD2FVARBPROC)wglGetProcAddress("glMultiTexCoord2fvARB");
- ctxInfo->glMultiTexCoord3fvARB = (MYPFNGLMULTITEXCOORD3FVARBPROC)wglGetProcAddress("glMultiTexCoord3fvARB");
- ctxInfo->glMultiTexCoord4fvARB = (MYPFNGLMULTITEXCOORD4FVARBPROC)wglGetProcAddress("glMultiTexCoord4fvARB");
- ctxInfo->glActiveTextureARB = (MYPFNGLACTIVETEXTUREARBPROC) wglGetProcAddress("glActiveTextureARB");
- /*
- if (ctxInfo->glClientActiveTextureARB == NULL) {
- printf("ctxInfo->glClientActiveTextureARB == NULL\n");
- }
- if (ctxInfo->glMultiTexCoord2fvARB == NULL) {
- printf("ctxInfo->glMultiTexCoord2fvARB == NULL\n");
- }
- if (ctxInfo->glMultiTexCoord3fvARB == NULL) {
- printf("ctxInfo->glMultiTexCoord3fvARB == NULL\n");
- }
- if (ctxInfo->glMultiTexCoord4fvARB == NULL) {
- printf("ctxInfo->glMultiTexCoord4fvARB == NULL\n");
- }
- if (ctxInfo->glActiveTextureARB == NULL) {
- printf("ctxInfo->glActiveTextureARB == NULL\n");
- }
- */
- if ((ctxInfo->glClientActiveTextureARB == NULL) ||
- (ctxInfo->glMultiTexCoord2fvARB == NULL) ||
- (ctxInfo->glMultiTexCoord3fvARB == NULL) ||
- (ctxInfo->glMultiTexCoord4fvARB == NULL) ||
- (ctxInfo->glActiveTextureARB == NULL)) {
- ctxInfo->arb_multitexture = JNI_FALSE;
- }
- }
-
- if(ctxInfo->arb_transpose_matrix) {
- ctxInfo->glLoadTransposeMatrixdARB = (MYPFNGLLOADTRANSPOSEMATRIXDARBPROC)wglGetProcAddress("glLoadTransposeMatrixdARB");
- ctxInfo->glMultTransposeMatrixdARB = (MYPFNGLMULTTRANSPOSEMATRIXDARBPROC)wglGetProcAddress("glMultTransposeMatrixdARB");
- /*
- if (ctxInfo->glLoadTransposeMatrixdARB == NULL) {
- printf("ctxInfo->glLoadTransposeMatrixdARB == NULL\n");
- }
- if (ctxInfo->glMultTransposeMatrixdARB == NULL) {
- printf("ctxInfo->glMultTransposeMatrixdARB == NULL\n");
- }
- */
- if ((ctxInfo->glLoadTransposeMatrixdARB == NULL) ||
- (ctxInfo->glMultTransposeMatrixdARB == NULL)) {
- ctxInfo->arb_transpose_matrix = JNI_FALSE;
- }
+ if (ctxInfo->gl13) {
+ ctxInfo->glClientActiveTexture = (MYPFNGLCLIENTACTIVETEXTUREPROC)wglGetProcAddress("glClientActiveTexture");
+ ctxInfo->glActiveTexture = (MYPFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture");
+ ctxInfo->glMultiTexCoord2fv = (MYPFNGLMULTITEXCOORD2FVPROC)wglGetProcAddress("glMultiTexCoord2fv");
+ ctxInfo->glMultiTexCoord3fv = (MYPFNGLMULTITEXCOORD3FVPROC)wglGetProcAddress("glMultiTexCoord3fv");
+ ctxInfo->glMultiTexCoord4fv = (MYPFNGLMULTITEXCOORD4FVPROC)wglGetProcAddress("glMultiTexCoord4fv");
+
+ ctxInfo->glLoadTransposeMatrixd = (MYPFNGLLOADTRANSPOSEMATRIXDPROC)wglGetProcAddress("glLoadTransposeMatrixd");
+ ctxInfo->glMultTransposeMatrixd = (MYPFNGLMULTTRANSPOSEMATRIXDPROC)wglGetProcAddress("glMultTransposeMatrixd");
}
if (ctxInfo->global_alpha_sun) {
@@ -878,35 +837,24 @@ getPropertiesFromCurrentContext(
}
}
- if(ctxInfo->arb_multitexture){
- ctxInfo->glClientActiveTextureARB =
- (MYPFNGLCLIENTACTIVETEXTUREARBPROC)dlsym(RTLD_DEFAULT, "glClientActiveTextureARB");
- ctxInfo->glMultiTexCoord2fvARB =
- (MYPFNGLMULTITEXCOORD2FVARBPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord2fvARB");
- ctxInfo->glMultiTexCoord3fvARB =
- (MYPFNGLMULTITEXCOORD3FVARBPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord3fvARB");
- ctxInfo->glMultiTexCoord4fvARB =
- (MYPFNGLMULTITEXCOORD4FVARBPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord4fvARB");
- ctxInfo->glActiveTextureARB =
- (MYPFNGLACTIVETEXTUREARBPROC)dlsym(RTLD_DEFAULT, "glActiveTextureARB");
- if ((ctxInfo->glClientActiveTextureARB == NULL) ||
- (ctxInfo->glMultiTexCoord2fvARB == NULL) ||
- (ctxInfo->glMultiTexCoord3fvARB == NULL) ||
- (ctxInfo->glMultiTexCoord4fvARB == NULL) ||
- (ctxInfo->glActiveTextureARB == NULL)) {
- ctxInfo->arb_multitexture = JNI_FALSE;
- }
- }
- if(ctxInfo->arb_transpose_matrix) {
- ctxInfo->glLoadTransposeMatrixdARB =
- (MYPFNGLLOADTRANSPOSEMATRIXDARBPROC)dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixdARB");
- ctxInfo->glMultTransposeMatrixdARB =
- (MYPFNGLMULTTRANSPOSEMATRIXDARBPROC)dlsym(RTLD_DEFAULT, "glMultTransposeMatrixdARB");
- if ((ctxInfo->glLoadTransposeMatrixdARB == NULL) ||
- (ctxInfo->glMultTransposeMatrixdARB == NULL)) {
- ctxInfo->arb_transpose_matrix = JNI_FALSE;
- }
+ if(ctxInfo->gl13){
+ ctxInfo->glClientActiveTexture =
+ (MYPFNGLCLIENTACTIVETEXTUREPROC)dlsym(RTLD_DEFAULT, "glClientActiveTexture");
+ ctxInfo->glMultiTexCoord2fv =
+ (MYPFNGLMULTITEXCOORD2FVPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord2fv");
+ ctxInfo->glMultiTexCoord3fv =
+ (MYPFNGLMULTITEXCOORD3FVPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord3fv");
+ ctxInfo->glMultiTexCoord4fv =
+ (MYPFNGLMULTITEXCOORD4FVPROC)dlsym(RTLD_DEFAULT, "glMultiTexCoord4fv");
+ ctxInfo->glActiveTexture =
+ (MYPFNGLACTIVETEXTUREPROC)dlsym(RTLD_DEFAULT, "glActiveTexture");
+
+ ctxInfo->glLoadTransposeMatrixd =
+ (MYPFNGLLOADTRANSPOSEMATRIXDPROC)dlsym(RTLD_DEFAULT, "glLoadTransposeMatrixd");
+ ctxInfo->glMultTransposeMatrixd =
+ (MYPFNGLMULTTRANSPOSEMATRIXDPROC)dlsym(RTLD_DEFAULT, "glMultTransposeMatrixd");
}
+
if(ctxInfo->global_alpha_sun) {
ctxInfo->glGlobalAlphaFactorfSUN =
(MYPFNGLGLOBALALPHAFACTORFSUNPROC)dlsym(RTLD_DEFAULT, "glGlobalAlphaFactorfSUN");
@@ -914,15 +862,6 @@ getPropertiesFromCurrentContext(
ctxInfo->global_alpha_sun = JNI_FALSE;
}
}
-
- if(ctxInfo->videoResizeAvailable) {
- ctxInfo->glXVideoResizeSUN =
- (MYPFNGLXVIDEORESIZESUN)dlsym(RTLD_DEFAULT, "glXVideoResizeSUN");
- if (ctxInfo->glXVideoResizeSUN == NULL) {
- ctxInfo->videoResizeAvailable = JNI_FALSE;
- ctxInfo->extMask &= ~javax_media_j3d_Canvas3D_SUN_VIDEO_RESIZE;
- }
- }
#endif /* UNIX */
@@ -950,22 +889,20 @@ void setupCanvasProperties(
/* set the canvas.multiTexAccelerated flag */
rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "multiTexAccelerated", "Z");
- (*(table->SetBooleanField))(env, obj, rsc_field, ctxInfo->arb_multitexture);
-
- if (ctxInfo->arb_multitexture) {
- rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxTextureUnits", "I");
- (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxTextureUnits);
- rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxTexCoordSets", "I");
- (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxTexCoordSets);
- rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxTextureImageUnits", "I");
- (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxTextureImageUnits);
- rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxVertexTextureImageUnits", "I");
- (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxVertexTextureImageUnits);
- rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxCombinedTextureImageUnits", "I");
- (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxCombinedTextureImageUnits);
- rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxVertexAttrs", "I");
- (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxVertexAttrs);
- }
+ (*(table->SetBooleanField))(env, obj, rsc_field, ctxInfo->gl13);
+
+ rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxTextureUnits", "I");
+ (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxTextureUnits);
+ rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxTexCoordSets", "I");
+ (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxTexCoordSets);
+ rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxTextureImageUnits", "I");
+ (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxTextureImageUnits);
+ rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxVertexTextureImageUnits", "I");
+ (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxVertexTextureImageUnits);
+ rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxCombinedTextureImageUnits", "I");
+ (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxCombinedTextureImageUnits);
+ rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "maxVertexAttrs", "I");
+ (*(table->SetIntField))(env, obj, rsc_field, ctxInfo->maxVertexAttrs);
rsc_field = (jfieldID) (*(table->GetFieldID))(env, cv_class, "extensionsSupported", "I");
(*(table->SetIntField))(env, obj, rsc_field, ctxInfo->extMask);
@@ -1025,11 +962,11 @@ void setupCanvasProperties(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_destroyContext(
+void JNICALL Java_javax_media_j3d_NativePipeline_destroyContext(
JNIEnv *env,
- jclass cl,
+ jobject obj,
jlong display,
- jint window,
+ jlong window,
jlong ctxInfo)
{
GraphicsContextPropertiesInfo* s = (GraphicsContextPropertiesInfo* )ctxInfo;
@@ -1075,12 +1012,12 @@ LONG WINAPI WndProc( HWND hWnd, UINT msg,
JNIEXPORT
-jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
+jlong JNICALL Java_javax_media_j3d_NativePipeline_createNewContext(
JNIEnv *env,
jobject obj,
+ jobject cv,
jlong display,
- jint window,
- jint vid,
+ jlong window,
jlong fbConfigListPtr,
jlong sharedCtxInfo,
jboolean isSharedCtx,
@@ -1092,9 +1029,6 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
jlong sharedCtx;
int stencilSize=0;
- static GLboolean first_time = GL_TRUE;
- static GLboolean force_normalize = GL_FALSE;
-
GraphicsContextPropertiesInfo *ctxInfo = NULL;
GraphicsContextPropertiesInfo *sharedCtxStructure;
int PixelFormatID=0;
@@ -1133,7 +1067,7 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
else if((fbConfigList == NULL) || (fbConfigList[0] == NULL)) {
/*
* fbConfig must be a valid pointer to an GLXFBConfig struct returned
- * by glXChooseFBConfig() for a physical screen. The visual id in vid
+ * by glXChooseFBConfig() for a physical screen. The visual id
* is not sufficient for handling OpenGL with Xinerama mode disabled:
* it doesn't distinguish between the physical screens making up the
* virtual screen when the X server is running in Xinerama mode.
@@ -1186,7 +1120,7 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
/*
fprintf(stderr, "Canvas3D_createNewContext: \n");
- fprintf(stderr, "vid %d window 0x%x\n", vid, window);
+ fprintf(stderr, "window 0x%x\n", window);
*/
if(sharedCtxInfo == 0)
sharedCtx = 0;
@@ -1198,11 +1132,7 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
hdc = (HDC) window;
/* Need to handle onScreen and offScreen differently */
- /* vid is for onScreen and fbConfigListPtr is for offScreen */
- /*
- * vid must be a PixelFormat returned
- * by wglChoosePixelFormat() or wglChoosePixelFormatARB.
- */
+ /* fbConfigListPtr has both an on-screen and off-screen pixel format */
if(!offScreen) { /* Fix to issue 104 */
if ((PixelFormatInfoPtr == NULL) || (PixelFormatInfoPtr->onScreenPFormat <= 0)) {
@@ -1268,53 +1198,41 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext(
initializeCtxInfo(env, ctxInfo);
ctxInfo->context = gctx;
- if (!getPropertiesFromCurrentContext(env, obj, ctxInfo, (jlong) hdc, PixelFormatID,
+ if (!getPropertiesFromCurrentContext(env, cv, ctxInfo, (jlong) hdc, PixelFormatID,
fbConfigListPtr, offScreen,
glslLibraryAvailable, cgLibraryAvailable)) {
return 0;
}
-
/* setup structure */
if(!isSharedCtx){
/* Setup field in Java side */
- setupCanvasProperties(env, obj, ctxInfo);
- }
-
- /* Set up rescale_normal if extension supported */
- if (first_time && getJavaBoolEnv(env, "isForceNormalized")) {
- force_normalize = GL_TRUE;
- first_time = GL_FALSE;
+ setupCanvasProperties(env, cv, ctxInfo);
}
- if (force_normalize) {
- /* Disable rescale normal */
- ctxInfo->rescale_normal_ext = GL_FALSE;
- }
-
- if (ctxInfo->rescale_normal_ext ) {
- glEnable(ctxInfo->rescale_normal_ext_enum);
- }
- else {
- glEnable(GL_NORMALIZE);
- }
+ /* Enable rescale normal */
+ glEnable(GL_RESCALE_NORMAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glDepthFunc(GL_LEQUAL);
glEnable(GL_COLOR_MATERIAL);
glReadBuffer(GL_FRONT);
+
+ /* Java 3D images are aligned to 1 byte */
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
return ((jlong)ctxInfo);
}
JNIEXPORT
-jboolean JNICALL Java_javax_media_j3d_Canvas3D_useCtx(
+jboolean JNICALL Java_javax_media_j3d_NativePipeline_useCtx(
JNIEnv *env,
- jclass cl,
+ jobject obj,
jlong ctxInfo,
jlong display,
- jint window)
+ jlong window)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
@@ -1351,7 +1269,7 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_useCtx(
}
JNIEXPORT
-jint JNICALL Java_javax_media_j3d_Canvas3D_getNumCtxLights(
+jint JNICALL Java_javax_media_j3d_NativePipeline_getNumCtxLights(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -1362,112 +1280,8 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_getNumCtxLights(
return((jint)nlights);
}
-
-
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_composite(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo,
- jint px,
- jint py,
- jint minX,
- jint minY,
- jint maxX,
- jint maxY,
- jint rasWidth,
- jbyteArray imageYdown,
- jint winWidth,
- jint winHeight)
-{
- GLenum gltype;
- JNIEnv table;
- jbyte *byteData;
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong ctx = ctxProperties->context;
-
- table = *env;
-
-#ifdef VERBOSE
- fprintf(stderr, "Canvas3D.composite()\n");
-#endif
- /* Temporarily disable fragment and most 3D operations */
- /* XXXX: the GL_TEXTURE_BIT may not be necessary here */
- glPushAttrib(GL_ENABLE_BIT|GL_TEXTURE_BIT|GL_DEPTH_BUFFER_BIT);
- disableAttribFor2D(ctxProperties);
-
- glEnable(GL_BLEND);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- /* loaded identity modelview and projection matrix */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, (double)winWidth, 0.0, (double)winHeight, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- /* start from upper left corner */
- glRasterPos2i(px + minX, winHeight-(py + minY));
-
- glPixelZoom(1.0, -1.0);
-
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- imageYdown,
- NULL);
- /* if abgr_ext is supported then the data will be in that format */
- if (ctxProperties->abgr_ext) {
- gltype = GL_ABGR_EXT;
- } else {
- gltype = GL_RGBA;
- }
-
- /*
- * set the actual width of data which is the width of the canvas
- * because what needs to be drawn may be smaller than the canvas
- */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, rasWidth);
-
- /*
- * we only need to skip pixels if width of the area to draw is smaller
- * than the width of the raster
- */
-
- /*
- * skip this many rows in the data because the size of what
- * needs to be drawn may be smaller than the canvas
- */
- glPixelStorei(GL_UNPACK_SKIP_ROWS, minY);
- /*
- * skip this many pixels in the data before drawing because
- * the size of what needs to be drawn may be smaller than the
- * canvas
- */
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, minX);
-
-
- glDrawPixels(maxX - minX, maxY - minY,
- gltype, GL_UNSIGNED_BYTE, byteData);
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
-
- glMatrixMode(GL_PROJECTION);
-
- glLoadIdentity();
-
- (*(table->ReleasePrimitiveArrayCritical))(env, imageYdown, byteData, 0);
-
- /* Java 3D always clears the Z-buffer */
- glDepthMask(GL_TRUE);
- glClear(GL_DEPTH_BUFFER_BIT);
-
- glPopAttrib();
-}
-
-
-JNIEXPORT
-jboolean JNICALL Java_javax_media_j3d_Canvas3D_initTexturemapping(
+jboolean JNICALL Java_javax_media_j3d_NativePipeline_initTexturemapping(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1505,7 +1319,7 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_initTexturemapping(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping(
+void JNICALL Java_javax_media_j3d_NativePipeline_texturemapping(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1545,7 +1359,6 @@ void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping(
/* glGetIntegerv(GL_TEXTURE_BINDING_2D,&binding); */
glDepthMask(GL_FALSE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, objectId);
/* set up texture parameter */
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -1581,10 +1394,10 @@ void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping(
gltype = GL_ABGR_EXT;
} else {
switch (format) {
- case FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_RGBA:
gltype = GL_RGBA;
break;
- case FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGB:
gltype = GL_RGB;
break;
}
@@ -1637,522 +1450,277 @@ void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_clear(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo,
- jfloat r,
- jfloat g,
- jfloat b,
- jint winWidth,
- jint winHeight,
- jobject pa2d,
- jint imageScaleMode,
- jbyteArray pixels_obj)
-
-{
- jclass pa2d_class;
- jfieldID format_field, width_field, height_field;
- int format, width, height;
- GLubyte * pixels;
- JNIEnv table;
- GLenum gltype;
- float xzoom, yzoom, zoom;
- float rasterX, rasterY;
- int repeatX, repeatY, i, j;
- int row_length, skip_pixels, skip_rows, subwidth, subheight;
+void JNICALL Java_javax_media_j3d_NativePipeline_clear(JNIEnv *env,
+ jobject obj,
+ jlong ctxInfo,
+ jfloat r,
+ jfloat g,
+ jfloat b)
+{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong ctx = ctxProperties->context;
- table = *env;
-
-#ifdef VERBOSE
- fprintf(stderr, "Canvas3D.clear()\n");
-#endif
+ jlong ctx = ctxProperties->context;
- if(!pa2d) {
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- else {
- /* Do a cool image blit */
- pa2d_class = (jclass) (*(table->GetObjectClass))(env, pa2d);
- format_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "storedYdownFormat", "I");
- width_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "width", "I");
- height_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "height", "I");
-
- format = (int) (*(table->GetIntField))(env, pa2d, format_field);
- width = (int) (*(table->GetIntField))(env, pa2d, width_field);
- height = (int) (*(table->GetIntField))(env, pa2d, height_field);
-
- pixels = (GLubyte *) (*(table->GetPrimitiveArrayCritical))(env,
- pixels_obj, NULL);
-
- /* Temporarily disable fragment and most 3D operations */
- /* XXXX: the GL_TEXTURE_BIT may not be necessary */
- glPushAttrib(GL_ENABLE_BIT|GL_TEXTURE_BIT);
- disableAttribFor2D(ctxProperties);
-
- /* loaded identity modelview and projection matrix */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- switch (format) {
- case FORMAT_BYTE_RGBA:
- gltype = GL_RGBA;
- break;
- case FORMAT_BYTE_RGB:
- gltype = GL_RGB;
- break;
-
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- gltype = GL_ABGR_EXT;
- }
- break;
-
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- gltype = ctxProperties->bgr_ext_enum ;
- }
- break;
-
- case FORMAT_BYTE_LA:
- gltype = GL_LUMINANCE_ALPHA;
- break;
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- default:
- throwAssert(env, "illegal format");
- break;
- }
-
- /* start from upper left corner */
- glRasterPos3f(-1.0, 1.0, 0.0);
-
- /* setup the pixel zoom */
- xzoom = (float)winWidth/width;
- yzoom = (float)winHeight/height;
- switch(imageScaleMode){
- case javax_media_j3d_Background_SCALE_NONE:
- if(xzoom > 1.0f || yzoom > 1.0f)
- {
- /* else don't need to clear the background with background color */
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- glPixelZoom(1.0, -1.0);
- glDrawPixels(width, height, gltype, GL_UNSIGNED_BYTE,
- pixels);
-
- break;
- case javax_media_j3d_Background_SCALE_FIT_MIN:
- if(xzoom != yzoom ) {
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- zoom = xzoom < yzoom? xzoom:yzoom;
- glPixelZoom(zoom, -zoom);
- glDrawPixels(width, height, gltype, GL_UNSIGNED_BYTE,
- pixels);
- break;
- case javax_media_j3d_Background_SCALE_FIT_MAX:
- zoom = xzoom > yzoom? xzoom:yzoom;
- glPixelZoom(zoom, -zoom);
- glDrawPixels(width, height, gltype, GL_UNSIGNED_BYTE,
- pixels);
-
- break;
- case javax_media_j3d_Background_SCALE_FIT_ALL:
- glPixelZoom(xzoom, -yzoom);
- glDrawPixels(width, height, gltype, GL_UNSIGNED_BYTE,
- pixels);
- break;
- case javax_media_j3d_Background_SCALE_REPEAT:
- glPixelZoom(1.0, -1.0);
- /* get those raster positions */
- repeatX = winWidth/width;
- if(repeatX * width < winWidth)
- repeatX++;
- repeatY = winHeight/height;
- if(repeatY * height < winHeight)
- repeatY++;
- for(i = 0; i < repeatX; i++)
- for(j = 0; j < repeatY; j++) {
- rasterX = -1.0f + (float)width/winWidth * i * 2;
- rasterY = 1.0f - (float)height/winHeight * j * 2;
- glRasterPos3f(rasterX, rasterY, 0.0);
- glDrawPixels(width, height, gltype, GL_UNSIGNED_BYTE,
- pixels);
- }
- break;
-
- case javax_media_j3d_Background_SCALE_NONE_CENTER:
- if(xzoom > 1.0f || yzoom > 1.0f){
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- if(xzoom >= 1.0f){
- rasterX = -(float)width/winWidth;
- subwidth = width;
- }
- else {
- rasterX = -1.0;
- row_length = width;
- glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
- skip_pixels = (width-winWidth)/2;
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
- subwidth = winWidth;
- }
- if(yzoom >= 1.0f){
- rasterY = (float)height/winHeight;
- subheight = height;
- }
- else {
- rasterY = 1.0f;
- skip_rows = (height-winHeight)/2;
- glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
- subheight = winHeight;
- }
- glRasterPos3f(rasterX, rasterY, 0.0);
- glPixelZoom(1.0, -1.0);
- glDrawPixels(subwidth, subheight, gltype, GL_UNSIGNED_BYTE,
- pixels);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- break;
- }
+#ifdef VERBOSE
+ fprintf(stderr, "Canvas3D.clear()\n");
+#endif
+
+ glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
+ glClear(GL_COLOR_BUFFER_BIT);
- /* Restore attributes */
- glPopAttrib();
-
- (*(table->ReleasePrimitiveArrayCritical))(env, pixels_obj,
- (jbyte *)pixels, 0);
- }
/* Java 3D always clears the Z-buffer */
glPushAttrib(GL_DEPTH_BUFFER_BIT);
glDepthMask(GL_TRUE);
glClear(GL_DEPTH_BUFFER_BIT);
glPopAttrib();
+
+#if 0
+
+ /* Java 3D always clears the Z-buffer */
+ glPushAttrib(GL_DEPTH_BUFFER_BIT);
+ glDepthMask(GL_TRUE);
+ glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+ glPopAttrib();
+#endif
+
+
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_textureclear(JNIEnv *env,
+void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground(JNIEnv *env,
jobject obj,
jlong ctxInfo,
- jint maxX,
- jint maxY,
- jfloat r,
- jfloat g,
- jfloat b,
- jint winWidth,
- jint winHeight,
- jint objectId,
- jint imageScaleMode,
- jobject pa2d,
- jboolean update)
+ jfloat texMinU,
+ jfloat texMaxU,
+ jfloat texMinV,
+ jfloat texMaxV,
+ jfloat mapMinX,
+ jfloat mapMaxX,
+ jfloat mapMinY,
+ jfloat mapMaxY)
{
- jclass pa2d_class;
- jfieldID pixels_field, format_field, width_field, height_field;
- jbyteArray pixels_obj;
- int format, width, height;
- GLubyte * pixels;
JNIEnv table;
- GLenum gltype;
- GLfloat texMinU, texMinV, texMaxU, texMaxV, adjustV;
- GLfloat mapMinX, mapMinY, mapMaxX, mapMaxY;
- GLfloat halfWidth, halfHeight;
- float xzoom, yzoom, zoom;
- int i, j;
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
- table = *env;
-
- /* update = 1; */
+ table = *env;
#ifdef VERBOSE
- fprintf(stderr, "Canvas3D.textureclear()\n");
-#endif
- if(!pa2d){
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- /* glPushAttrib(GL_DEPTH_BUFFER_BIT); */
- if (pa2d) {
- /* Do a cool image blit */
- pa2d_class = (jclass) (*(table->GetObjectClass))(env, pa2d);
-
- pixels_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "imageYup", "[B");
- format_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "storedYupFormat", "I");
- pixels_obj = (jbyteArray)(*(table->GetObjectField))(env, pa2d,
- pixels_field);
-
- width_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "width", "I");
- height_field = (jfieldID) (*(table->GetFieldID))(env, pa2d_class,
- "height", "I");
+ fprintf(stderr, "Canvas3D.textureFillBackground()\n");
+#endif
+ /* Temporarily disable fragment and most 3D operations */
+ glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_POLYGON_BIT);
- format = (int) (*(table->GetIntField))(env, pa2d, format_field);
- width = (int) (*(table->GetIntField))(env, pa2d, width_field);
- height = (int) (*(table->GetIntField))(env, pa2d, height_field);
- pixels = (GLubyte *) (*(table->GetPrimitiveArrayCritical))(env,
- pixels_obj, NULL);
+ disableAttribFor2D(ctxProperties);
+ glDepthMask(GL_FALSE);
+ glEnable(GL_TEXTURE_2D);
-#ifdef VERBOSE
- fprintf(stderr, "width = %d height = %d \n", width, height);
-#endif
-
- /* Temporarily disable fragment and most 3D operations */
- glPushAttrib(GL_ENABLE_BIT|GL_TEXTURE_BIT|GL_POLYGON_BIT);
- disableAttribFor2D(ctxProperties);
+ /* reset the polygon mode */
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- Java_javax_media_j3d_Canvas3D_resetTexCoordGeneration(env, obj, ctxInfo);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glEnable(GL_TEXTURE_2D);
+ /* loaded identity modelview and projection matrix */
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glMatrixMode(GL_TEXTURE);
+ glPushMatrix();
+ glLoadIdentity();
+
+#ifdef VERBOSE
+ printf("(texMinU,texMinV,texMaxU,texMaxV) = (%3.2f,%3.2f,%3.2f,%3.2f)\n",
+ texMinU,texMinV,texMaxU,texMaxV);
+ printf("(mapMinX,mapMinY,mapMaxX,mapMaxY) = (%3.2f,%3.2f,%3.2f,%3.2f)\n",
+ mapMinX,mapMinY,mapMaxX,mapMaxY);
+#endif
+
+ glBegin(GL_QUADS);
+ glTexCoord2f((float) texMinU, (float) texMinV);
+ glVertex2f((float) mapMinX, (float) mapMinY);
+ glTexCoord2f((float) texMaxU, (float) texMinV);
+ glVertex2f((float) mapMaxX, (float) mapMinY);
+ glTexCoord2f((float) texMaxU, (float) texMaxV);
+ glVertex2f((float) mapMaxX, (float) mapMaxY);
+ glTexCoord2f((float) texMinU, (float) texMaxV);
+ glVertex2f((float) mapMinX, (float) mapMaxY);
+ glEnd();
+
+ /* Restore texture Matrix transform */
+ glPopMatrix();
+
+ glMatrixMode(GL_MODELVIEW);
+ /* Restore attributes */
+ glPopAttrib();
+}
+
+JNIEXPORT
+void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env,
+ jobject obj,
+ jlong ctxInfo,
+ jfloat texMinU,
+ jfloat texMaxU,
+ jfloat texMinV,
+ jfloat texMaxV,
+ jfloat mapMinX,
+ jfloat mapMaxX,
+ jfloat mapMinY,
+ jfloat mapMaxY,
+ jfloat mapZ,
+ jfloat alpha)
+{
+ JNIEnv table;
+ GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
+ jlong ctx = ctxProperties->context;
+
+ table = *env;
+
+#ifdef VERBOSE
+ fprintf(stderr, "Canvas3D.textureFillRaster()\n");
+#endif
+ /* Temporarily disable fragment and most 3D operations */
+ glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_POLYGON_BIT |
+ GL_CURRENT_BIT);
+
+ disableAttribForRaster(ctxProperties);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glColor4f(1.0f, 1.0f, 1.0f, (float) alpha);
- /* reset the polygon mode */
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ /* reset the polygon mode */
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glDepthMask(GL_FALSE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glBindTexture(GL_TEXTURE_2D, objectId);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- /* set up texture parameter */
- if(update){
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- }
+ /* loaded identity modelview and projection matrix */
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
+
#ifdef VERBOSE
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
-#endif
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
-
-
- if(update){
- switch (format) {
- case FORMAT_BYTE_RGBA:
- gltype = GL_RGBA;
-#ifdef VERBOSE
- fprintf(stderr, "FORMAT_BYTE_RGBA\n");
+ printf("(texMinU,texMinV,texMaxU,texMaxV) = (%3.2f,%3.2f,%3.2f,%3.2f)\n",
+ texMinU,texMinV,texMaxU,texMaxV);
+ printf("(mapMinX,mapMinY,mapMaxX,mapMaxY) = (%3.2f,%3.2f,%3.2f,%3.2f)\n",
+ mapMinX,mapMinY,mapMaxX,mapMaxY);
#endif
- break;
- case FORMAT_BYTE_RGB:
- gltype = GL_RGB;
-#ifdef VERBOSE
- fprintf(stderr, "FORMAT_BYTE_RGB\n");
+
+ glBegin(GL_QUADS);
+
+ glTexCoord2f((float) texMinU, (float) texMinV);
+ glVertex3f((float) mapMinX, (float) mapMinY, (float) mapZ);
+ glTexCoord2f((float) texMaxU, (float) texMinV);
+ glVertex3f((float) mapMaxX, (float) mapMinY, (float) mapZ);
+ glTexCoord2f((float) texMaxU, (float) texMaxV);
+ glVertex3f((float) mapMaxX, (float) mapMaxY, (float) mapZ);
+ glTexCoord2f((float) texMinU, (float) texMaxV);
+ glVertex3f((float) mapMinX, (float) mapMaxY, (float) mapZ);
+
+ glEnd();
+
+ /* Restore matrices */
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ /* Restore attributes */
+ glPopAttrib();
+}
+
+JNIEXPORT
+void JNICALL Java_javax_media_j3d_NativePipeline_executeRasterDepth(JNIEnv *env,
+ jobject obj,
+ jlong ctxInfo,
+ jfloat posX,
+ jfloat posY,
+ jfloat posZ,
+ jint srcOffsetX,
+ jint srcOffsetY,
+ jint rasterWidth,
+ jint rasterHeight,
+ jint depthWidth,
+ jint depthHeight,
+ jint depthFormat,
+ jobject depthData)
+{
+ GLint drawBuf;
+ void *depthObjPtr;
+
+ JNIEnv table;
+ GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
+ jlong ctx = ctxProperties->context;
+
+ table = *env;
+
+#ifdef VERBOSE
+ fprintf(stderr, "Canvas3D.executeRasterDepth()\n");
#endif
- break;
-
- /* GL_ABGR_EXT */
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- gltype = GL_ABGR_EXT;
- }
- break;
-
- /* GL_BGR_EXT or GL_BGR */
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- gltype = ctxProperties->bgr_ext_enum;
- }
- break;
-
- case FORMAT_BYTE_LA:
- gltype = GL_LUMINANCE_ALPHA;
- break;
-
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- default:
- throwAssert(env, "illegal format");
- break;
- }
-
- /* texture map here! */
- glTexImage2D(GL_TEXTURE_2D, 0, gltype, width,
- height, 0, gltype, GL_UNSIGNED_BYTE,
- pixels);
- }
- /* loaded identity modelview and projection matrix */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
- glLoadIdentity();
-
- xzoom = (float)winWidth/maxX;
- yzoom = (float)winHeight/maxY;
- switch(imageScaleMode) {
- case javax_media_j3d_Background_SCALE_NONE:
- if(xzoom > 1.0f || yzoom > 1.0f){
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- texMinU = 0.0f;
- texMinV = 0.0f;
- texMaxU = 1.0f;
- texMaxV = 1.0f;
- halfWidth = (GLfloat)winWidth/2.0f;
- halfHeight = (GLfloat)winHeight/2.0f;
- mapMinX = (float) ((0 - halfWidth)/halfWidth);
- mapMinY = (float) ((0 - halfHeight)/halfHeight);
- mapMaxX = (float) ((maxX - halfWidth)/halfWidth);
- mapMaxY = (float) ((maxY - halfHeight)/halfHeight);
- adjustV = ((float)winHeight - (float)maxY)/halfHeight;
- mapMinY += adjustV;
- mapMaxY += adjustV;
- break;
- case javax_media_j3d_Background_SCALE_FIT_MIN:
- if(xzoom != yzoom){
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
- }
+ glRasterPos3f(posX, posY, posZ);
- zoom = xzoom < yzoom? xzoom: yzoom;
- texMinU = 0.0f;
- texMinV = 0.0f;
- texMaxU = 1.0f;
- texMaxV = 1.0f;
- mapMinX = -1.0f;
- mapMaxY = 1.0f;
- if(xzoom < yzoom){
- mapMaxX = 1.0f;
- mapMinY = -1.0f + 2.0f * ( 1.0f - zoom * (float)maxY/(float) winHeight );
- } else {
- mapMaxX = -1.0f + zoom * (float)maxX/winWidth * 2;
- mapMinY = -1.0f;
- }
- break;
- case javax_media_j3d_Background_SCALE_FIT_MAX:
- zoom = xzoom > yzoom? xzoom: yzoom;
- /*fprintf(stderr, "zoom: %f, xzoom: %f, yzoom: %f\n", zoom, xzoom, yzoom);*/
- mapMinX = -1.0f;
- mapMinY = -1.0f;
- mapMaxX = 1.0f;
- mapMaxY = 1.0f;
- if(xzoom < yzoom) {
- texMinU = 0.0f;
- texMinV = 0.0f;
- texMaxU = (float)winWidth/maxX/zoom;
- texMaxV = 1.0f;
- } else {
- texMinU = 0.0f;
- texMinV = 1.0f - (float)winHeight/maxY/zoom;
- texMaxU = 1.0f;
- texMaxV = 1.0f;
+ glGetIntegerv(GL_DRAW_BUFFER, &drawBuf);
+ /* disable draw buffer */
+ glDrawBuffer(GL_NONE);
+
+ /*
+ * raster position is upper left corner, default for Java3D
+ * ImageComponent currently has the data reverse in Y
+ */
+ glPixelZoom(1.0, -1.0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, depthWidth);
+ if (srcOffsetX >= 0) {
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, srcOffsetX);
+ if (srcOffsetX + rasterWidth > depthWidth) {
+ rasterWidth = depthWidth - srcOffsetX;
}
- break;
- case javax_media_j3d_Background_SCALE_FIT_ALL:
- texMinU = 0.0f;
- texMinV = 0.0f;
- texMaxU = 1.0f;
- texMaxV = 1.0f;
- mapMinX = -1.0f;
- mapMinY = -1.0f;
- mapMaxX = 1.0f;
- mapMaxY = 1.0f;
- break;
- case javax_media_j3d_Background_SCALE_REPEAT:
- /* glScalef(1.0f, -1.0f, 1.0f); */
- i = winWidth/width;
- j = winHeight/height;
- texMinU = 0.0f;
- texMinV = (float)(j + 1) - yzoom;
- texMaxU = xzoom;
- texMaxV = (float)(j + 1);
- mapMinX = -1.0f;
- mapMinY = -1.0f;
- mapMaxX = 1.0f;
- mapMaxY = 1.0f;
- break;
- case javax_media_j3d_Background_SCALE_NONE_CENTER:
- if(xzoom > 1.0f || yzoom > 1.0f){
- glClearColor((float)r, (float)g, (float)b, ctxProperties->alphaClearValue);
- glClear(GL_COLOR_BUFFER_BIT);
+ } else {
+ rasterWidth += srcOffsetX;
+ if (rasterWidth > depthWidth) {
+ rasterWidth = depthWidth;
}
- if(xzoom >= 1.0f){
- texMinU = 0.0f;
- texMaxU = 1.0f;
- mapMinX = -(float)maxX/winWidth;
- mapMaxX = (float)maxX/winWidth;
- } else {
- texMinU = 0.5f - (float)winWidth/maxX/2;
- texMaxU = 0.5f + (float)winWidth/maxX/2;
- mapMinX = -1.0f;
- mapMaxX = 1.0f;
+ }
+ if (srcOffsetY >= 0) {
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, srcOffsetY);
+ if (srcOffsetY + rasterHeight > depthHeight) {
+ rasterHeight = depthHeight - srcOffsetY;
}
- if(yzoom >= 1.0f) {
- texMinV = 0.0f;
- texMaxV = 1.0f;
- mapMinY = -(float)maxY/winHeight;
- mapMaxY = (float)maxY/winHeight;
- }else {
- texMinV = 0.5f - (float)winHeight/maxY/2;
- texMaxV = 0.5f + (float)winHeight/maxY/2;
- mapMinY = -1.0f;
- mapMaxY = 1.0f;
+ } else {
+ rasterHeight += srcOffsetY;
+ if (rasterHeight > depthHeight) {
+ rasterHeight = depthHeight;
}
- break;
}
-#ifdef VERBOSE
- printf("adjustV = %3.2f\n",adjustV);
- printf("(texMinU,texMinV,texMaxU,texMaxV) = (%3.2f,%3.2f,%3.2f,%3.2f)\n",
- texMinU,texMinV,texMaxU,texMaxV);
- printf("(mapMinX,mapMinY,mapMaxX,mapMaxY) = (%3.2f,%3.2f,%3.2f,%3.2f)\n",
- mapMinX,mapMinY,mapMaxX,mapMaxY);
-#endif
+
+ depthObjPtr =
+ (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)depthData, NULL);
+
+ if (depthFormat == javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_INT) {
+ glDrawPixels(rasterWidth, rasterHeight, GL_DEPTH_COMPONENT,
+ GL_UNSIGNED_INT, depthObjPtr);
+ } else { /* javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_FLOAT */
+ glDrawPixels(rasterWidth, rasterHeight, GL_DEPTH_COMPONENT,
+ GL_FLOAT, depthObjPtr);
+ }
- glBegin(GL_QUADS);
-#ifdef VERBOSE
- /* glTexCoord2f(0.2, 0.2); glVertex2f(0.0,0.0); */
- /* glTexCoord2f(0.4, 0.2); glVertex2f(0.2,0.0); */
- /* glTexCoord2f(0.4, 0.4); glVertex2f(0.2,0.2); */
- /* glTexCoord2f(0.2, 0.4); glVertex2f(0.0,0.2); */
- glColor3f(1.0, 0.0, 0.0);
-#endif
- glTexCoord2f(texMinU, texMinV); glVertex2f(mapMinX,mapMinY);
- glTexCoord2f(texMaxU, texMinV); glVertex2f(mapMaxX,mapMinY);
- glTexCoord2f(texMaxU, texMaxV); glVertex2f(mapMaxX,mapMaxY);
- glTexCoord2f(texMinU, texMaxV); glVertex2f(mapMinX,mapMaxY);
- glEnd();
-
- /* Restore texture Matrix transform */
- glPopMatrix();
+ (*(table->ReleasePrimitiveArrayCritical))(env, depthData, depthObjPtr, 0);
+
+
+ /* re-enable draw buffer */
+ glDrawBuffer(drawBuf);
- glMatrixMode(GL_MODELVIEW);
- /* Restore attributes */
- glPopAttrib();
- (*(table->ReleasePrimitiveArrayCritical))(env, pixels_obj,
- (jbyte *)pixels, 0);
- }
-
- /* Java 3D always clears the Z-buffer */
- glPushAttrib(GL_DEPTH_BUFFER_BIT);
- glDepthMask(GL_TRUE);
- glClear(GL_DEPTH_BUFFER_BIT);
- glPopAttrib();
-
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setRenderMode(
+void JNICALL Java_javax_media_j3d_NativePipeline_setRenderMode(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2221,7 +1789,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setRenderMode(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_clearAccum(
+void JNICALL Java_javax_media_j3d_NativePipeline_clearAccum(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -2232,7 +1800,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_clearAccum(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_accum(
+void JNICALL Java_javax_media_j3d_NativePipeline_accum(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2248,7 +1816,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_accum(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_accumReturn(
+void JNICALL Java_javax_media_j3d_NativePipeline_accumReturn(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -2259,7 +1827,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_accumReturn(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setDepthBufferWriteEnable(
+void JNICALL Java_javax_media_j3d_NativePipeline_setDepthBufferWriteEnable(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2274,23 +1842,24 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setDepthBufferWriteEnable(
JNIEXPORT
-jint JNICALL Java_javax_media_j3d_Canvas3D_swapBuffers(
+jint JNICALL Java_javax_media_j3d_NativePipeline_swapBuffers(
JNIEnv *env,
jobject obj,
+ jobject cv,
jlong ctxInfo,
jlong display,
- jint win)
+ jlong window)
{
#if defined(UNIX)
- glXSwapBuffers((Display *)display, (Window)win);
+ glXSwapBuffers((Display *)display, (Window)window);
#endif
#ifdef WIN32
HDC hdc;
- hdc = (HDC) win;
+ hdc = (HDC) window;
SwapBuffers(hdc);
#endif
@@ -2306,7 +1875,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_swapBuffers(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_syncRender(
+void JNICALL Java_javax_media_j3d_NativePipeline_syncRender(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2321,7 +1890,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_syncRender(
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_newDisplayList(
+void JNICALL Java_javax_media_j3d_NativePipeline_newDisplayList(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2336,7 +1905,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_newDisplayList(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_endDisplayList(
+void JNICALL Java_javax_media_j3d_NativePipeline_endDisplayList(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -2346,7 +1915,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_endDisplayList(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_setGlobalAlpha(
+void JNICALL Java_javax_media_j3d_NativePipeline_setGlobalAlpha(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2363,23 +1932,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setGlobalAlpha(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_disableGlobalAlpha(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo)
-{
-
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong ctx = ctxProperties->context;
-
- /* GL_GLOBAL_ALPHA_SUN */
- if(ctxProperties->global_alpha_sun){
- glDisable(GL_GLOBAL_ALPHA_SUN);
- }
-}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_callDisplayList(
+void JNICALL Java_javax_media_j3d_NativePipeline_callDisplayList(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2402,22 +1955,23 @@ void JNICALL Java_javax_media_j3d_Canvas3D_callDisplayList(
return;
}
- /* resale_normal_ext */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ /* Set normalization if non-uniform scale */
+ if (isNonUniformScale) {
glEnable(GL_NORMALIZE);
}
glCallList(id);
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ /* Turn normalization back off */
+ if (isNonUniformScale) {
glDisable(GL_NORMALIZE);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_freeDisplayList(
+void JNICALL Java_javax_media_j3d_NativePipeline_freeDisplayList(
JNIEnv *env,
- jclass cl,
+ jobject obj,
jlong ctxInfo,
jint id)
{
@@ -2431,9 +1985,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_freeDisplayList(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_freeTexture(
+void JNICALL Java_javax_media_j3d_NativePipeline_freeTexture(
JNIEnv *env,
- jclass cl,
+ jobject obj,
jlong ctxInfo,
jint id)
{
@@ -2455,15 +2009,14 @@ void JNICALL Java_javax_media_j3d_Canvas3D_freeTexture(
int getTextureColorTableSize(
JNIEnv *env,
jobject obj,
- jlong ctxInfo,
- char *extensionStr,
- int minorVersion)
+ GraphicsContextPropertiesInfo *ctxInfo,
+ char *extensionStr)
{
- GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo;
+ GraphicsContextPropertiesInfo* ctxProperties = ctxInfo;
int size;
-
- if(minorVersion >= 2 && isExtensionSupported(extensionStr, "GL_ARB_imaging")){
-
+
+ if (isExtensionSupported(extensionStr, "GL_ARB_imaging")) {
+
#ifdef WIN32
ctxProperties->glColorTable = (MYPFNGLCOLORTABLEPROC)wglGetProcAddress("glColorTable");
ctxProperties->glGetColorTableParameteriv =
@@ -2477,6 +2030,7 @@ int getTextureColorTableSize(
#endif
} else if(isExtensionSupported(extensionStr, "GL_SGI_color_table")) {
+
#ifdef WIN32
ctxProperties->glColorTable = (MYPFNGLCOLORTABLEPROC)wglGetProcAddress("glColorTableSGI");
ctxProperties->glGetColorTableParameteriv =
@@ -2488,16 +2042,16 @@ int getTextureColorTableSize(
ctxProperties->glGetColorTableParameteriv =
(MYPFNGLGETCOLORTABLEPARAMETERIVPROC)dlsym(RTLD_DEFAULT, "glGetColorTableParameterivSGI");
#endif
-
+
} else {
return 0;
}
if ((ctxProperties->glColorTable == NULL) ||
- (ctxProperties->glGetColorTableParameteriv == NULL)) {
+ (ctxProperties->glGetColorTableParameteriv == NULL)) {
return 0;
}
-
+
ctxProperties->glColorTable(GL_PROXY_TEXTURE_COLOR_TABLE_SGI, GL_RGBA, 256, GL_RGB,
GL_INT, NULL);
ctxProperties->glGetColorTableParameteriv(GL_PROXY_TEXTURE_COLOR_TABLE_SGI,
@@ -2505,62 +2059,13 @@ int getTextureColorTableSize(
return size;
}
-/* For dvr support */
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_videoResize(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo,
- jlong display,
- jint win,
- jfloat dvrFactor)
-{
-#if defined(UNIX)
-
- GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo;
-
- /* Not need to do ext. supported checking. This check is done in java. */
-
- /* fprintf(stderr, "Canvas3D.c -- glXVideoResize -- %d %f\n", win, dvrFactor); */
- ctxProperties->glXVideoResizeSUN((Display *)display, (Window)win, (float) dvrFactor);
-#endif
-
-}
-
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_videoResizeCompensation(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo,
- jboolean enable)
-{
-
-#if defined(UNIX)
- GraphicsContextPropertiesInfo *ctxProperties =
- (GraphicsContextPropertiesInfo *)ctxInfo;
-
- if (ctxProperties->videoResizeAvailable) {
- if(enable == JNI_TRUE) {
- /* fprintf(stderr, "videoResizeCompensation - glEnable"); */
- glEnable(GL_VIDEO_RESIZE_COMPENSATION_SUN);
- }
- else {
- /* fprintf(stderr, "videoResizeCompensation - glDisable"); */
- glDisable(GL_VIDEO_RESIZE_COMPENSATION_SUN);
- }
- }
-
-#endif
-
-}
-
-JNIEXPORT
-jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
+jlong JNICALL Java_javax_media_j3d_NativePipeline_createOffScreenBuffer(
JNIEnv *env,
jobject obj,
+ jobject cv,
jlong ctxInfo,
jlong display,
- jint vid,
jlong fbConfigListPtr,
jint width,
jint height)
@@ -2586,7 +2091,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
*/
-
+
/* Query DRAWABLE_TYPE. Will use Pbuffer if fbConfig support it,
else will try for Pixmap. If neither one exists, flag error message
and return None */
@@ -2616,7 +2121,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
fprintf(stderr, "Java 3D ERROR : glXCreateGLXPbuffer() returns None\n");
}
- return pbuff;
+ return (jlong)pbuff;
}
else if((val & GLX_PIXMAP_BIT) != 0) {
Pixmap pixmap;
@@ -2666,11 +2171,11 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
}
/* fprintf(stderr, "glxpixmap %d\n",(int) glxpixmap); */
- return glxpixmap;
+ return (jlong)glxpixmap;
}
else {
fprintf(stderr, "Java 3D ERROR : FBConfig doesn't support pbuffer or pixmap returns None\n");
- return None;
+ return (jlong)None;
}
@@ -2710,7 +2215,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
(int) display, pFormatInfoPtr->offScreenPFormat, width, height);
*/
- cv_class = (jclass) (*(table->GetObjectClass))(env, obj);
+ cv_class = (jclass) (*(table->GetObjectClass))(env, cv);
offScreenBuffer_field =
(jfieldID) (*(table->GetFieldID))(env, cv_class, "offScreenBufferInfo", "J");
@@ -2801,9 +2306,9 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
offScreenBufferInfo->isPbuffer = GL_TRUE;
offScreenBufferInfo->hpbuf = hpbuf;
- (*(table->SetLongField))(env, obj, offScreenBuffer_field, (jlong)offScreenBufferInfo);
+ (*(table->SetLongField))(env, cv, offScreenBuffer_field, (jlong)offScreenBufferInfo);
- return (jint) hpbufdc;
+ return (jlong) hpbufdc;
}
/* fprintf(stderr, "***** Use Bitmap for offscreen ******\n"); */
@@ -2856,21 +2361,23 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer(
offScreenBufferInfo->isPbuffer = GL_FALSE;
offScreenBufferInfo->hpbuf = 0;
- (*(table->SetLongField))(env, obj, offScreenBuffer_field, (jlong)offScreenBufferInfo);
+ (*(table->SetLongField))(env, cv, offScreenBuffer_field, (jlong)offScreenBufferInfo);
+
+ return ((jlong)bitmapHdc);
- return ((jint)bitmapHdc);
-
#endif /* WIN32 */
}
+
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_destroyOffScreenBuffer(
+void JNICALL Java_javax_media_j3d_NativePipeline_destroyOffScreenBuffer(
JNIEnv *env,
jobject obj,
+ jobject cv,
jlong ctxInfo,
jlong display,
jlong fbConfigListPtr,
- jint window)
+ jlong window)
{
jclass cv_class;
jfieldID offScreenBuffer_field;
@@ -2900,12 +2407,12 @@ void JNICALL Java_javax_media_j3d_Canvas3D_destroyOffScreenBuffer(
OffScreenBufferInfo *offScreenBufferInfo = NULL;
HDC hpbufdc = (HDC) window;
- cv_class = (jclass) (*(table->GetObjectClass))(env, obj);
+ cv_class = (jclass) (*(table->GetObjectClass))(env, cv);
offScreenBuffer_field =
(jfieldID) (*(table->GetFieldID))(env, cv_class, "offScreenBufferInfo", "J");
offScreenBufferInfo =
- (OffScreenBufferInfo *) (*(table->GetLongField))(env, obj, offScreenBuffer_field);
+ (OffScreenBufferInfo *) (*(table->GetLongField))(env, cv, offScreenBuffer_field);
/*
fprintf(stderr,"Canvas3D_destroyOffScreenBuffer : offScreenBufferInfo 0x%x\n",
@@ -2935,81 +2442,131 @@ void JNICALL Java_javax_media_j3d_Canvas3D_destroyOffScreenBuffer(
}
free(offScreenBufferInfo);
- (*(table->SetLongField))(env, obj, offScreenBuffer_field, (jlong)0);
+ (*(table->SetLongField))(env, cv, offScreenBuffer_field, (jlong)0);
#endif /* WIN32 */
}
-
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_readOffScreenBuffer(
+void JNICALL Java_javax_media_j3d_NativePipeline_readOffScreenBuffer(
JNIEnv *env,
jobject obj,
+ jobject cv,
jlong ctxInfo,
jint format,
+ jint dataType,
+ jobject data,
jint width,
jint height)
{
JNIEnv table = *env;
- jclass cv_class;
- jfieldID byteData_field;
- jbyteArray byteData_array;
- jbyte *byteData;
int type;
-
+ void *imageObjPtr;
+
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
glPixelStorei(GL_PACK_ROW_LENGTH, width);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
- cv_class = (jclass) (*(table->GetObjectClass))(env, obj);
- byteData_field = (jfieldID) (*(table->GetFieldID))(env, cv_class,
- "byteBuffer", "[B");
- byteData_array = (jbyteArray)(*(table->GetObjectField))(env, obj,
- byteData_field);
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- byteData_array, NULL);
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ imageObjPtr = (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)data, NULL);
+ }
+ else {
+ imageObjPtr = (void *)(*(table->GetDirectBufferAddress))(env, data);
+ }
-
- switch (format) {
- case FORMAT_BYTE_RGBA:
- type = GL_RGBA;
- break;
- case FORMAT_BYTE_RGB:
- type = GL_RGB;
- break;
-
- /* GL_ABGR_EXT */
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- type = GL_ABGR_EXT;
- }
- break;
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_BYTE_BUFFER)) {
+ switch (format) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_BYTE_BGR:
+ type = GL_BGR;
+ break;
+ case IMAGE_FORMAT_BYTE_RGB:
+ type = GL_RGB;
+ break;
+ /* GL_ABGR_EXT */
+ case IMAGE_FORMAT_BYTE_ABGR:
+ if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
+ type = GL_ABGR_EXT;
+ }
+ else {
+ throwAssert(env, "GL_ABGR_EXT format is unsupported");
+ return;
+ }
+ break;
+ case IMAGE_FORMAT_BYTE_RGBA:
+ type = GL_RGBA;
+ break;
+
+ /* This method only supports 3 and 4 components formats and BYTE types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_INT_BGR:
+ case IMAGE_FORMAT_INT_RGB:
+ case IMAGE_FORMAT_INT_ARGB:
+ default:
+ throwAssert(env, "illegal format");
+ return;
+ }
+
+ glReadPixels(0, 0, width, height, type, GL_UNSIGNED_BYTE, imageObjPtr);
+
+ }
+ else if((dataType == IMAGE_DATA_TYPE_INT_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_BUFFER)) {
+ GLenum intType = GL_UNSIGNED_INT_8_8_8_8;
+ GLboolean forceAlphaToOne = GL_FALSE;
- /* GL_BGR_EXT */
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- type = ctxProperties->bgr_ext_enum;
+ switch (format) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_INT_BGR: /* Assume XBGR format */
+ type = GL_RGBA;
+ intType = GL_UNSIGNED_INT_8_8_8_8_REV;
+ forceAlphaToOne = GL_TRUE;
+ break;
+ case IMAGE_FORMAT_INT_RGB: /* Assume XRGB format */
+ forceAlphaToOne = GL_TRUE;
+ /* Fall through to next case */
+ case IMAGE_FORMAT_INT_ARGB:
+ type = GL_BGRA;
+ intType = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ /* This method only supports 3 and 4 components formats and INT types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_BGR:
+ case IMAGE_FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_ABGR:
+ default:
+ throwAssert(env, "illegal format");
+ return;
+ }
+
+ /* Force Alpha to 1.0 if needed */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
}
- break;
- case FORMAT_BYTE_LA:
- type = GL_LUMINANCE_ALPHA;
- break;
+ glReadPixels(0, 0, width, height, type, intType, imageObjPtr);
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- default:
- throwAssert(env, "illegal format");
- break;
+ /* Restore Alpha scale and bias */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
+ }
+ }
+ else {
+ throwAssert(env, "illegal image data type");
}
-
- glReadPixels(0, 0, width, height, type, GL_UNSIGNED_BYTE, byteData);
+ if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) {
+ (*(table->ReleasePrimitiveArrayCritical))(env, data, imageObjPtr, 0);
+ }
- (*(table->ReleasePrimitiveArrayCritical))(env, byteData_array,
- byteData, 0);
}
static void
@@ -3023,17 +2580,12 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
ctxInfo->rendererStr = NULL;
ctxInfo->extensionStr = NULL;
ctxInfo->versionNumbers[0] = 1;
- ctxInfo->versionNumbers[1] = 1;
+ ctxInfo->versionNumbers[1] = 1;
+ ctxInfo->gl13 = JNI_FALSE;
+ ctxInfo->gl20 = JNI_FALSE;
- /* both in 1.2 core part and 1.1 extensions */
- ctxInfo->rescale_normal_ext = JNI_FALSE;
- ctxInfo->bgr_ext = JNI_FALSE;
- ctxInfo->texture3DAvailable = JNI_FALSE;
- ctxInfo->seperate_specular_color = JNI_FALSE;
-
/* 1.2 and GL_ARB_imaging */
ctxInfo->blend_color_ext = JNI_FALSE;
- ctxInfo->color_table_ext = JNI_FALSE;
ctxInfo->blendFunctionTable[BLEND_ZERO] = GL_ZERO;
ctxInfo->blendFunctionTable[BLEND_ONE] = GL_ONE;
ctxInfo->blendFunctionTable[BLEND_SRC_ALPHA] = GL_SRC_ALPHA;
@@ -3049,9 +2601,9 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
ctxInfo->multi_draw_arrays_sun = JNI_FALSE;
ctxInfo->compiled_vertex_array_ext = JNI_FALSE;
- ctxInfo->videoResizeAvailable = JNI_FALSE;
+ ctxInfo->texture_clamp_to_border_enum = GL_CLAMP;
+
ctxInfo->global_alpha_sun = JNI_FALSE;
- ctxInfo->constant_data_sun = JNI_FALSE;
/* EXT extensions */
ctxInfo->abgr_ext = JNI_FALSE;
@@ -3063,11 +2615,9 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
/* by MIK OF CLASSX */
ctxInfo->alphaClearValue = (getJavaBoolEnv(env, "transparentOffScreen") ? 0.0f : 1.0f);
- /* ARB extensions */
- ctxInfo->arb_transpose_matrix = JNI_FALSE;
- ctxInfo->arb_multitexture = JNI_FALSE;
+ ctxInfo->multisample = JNI_FALSE;
- ctxInfo->arb_multisample = JNI_FALSE;
+ /* Multitexture support */
ctxInfo->maxTexCoordSets = 1;
ctxInfo->maxTextureUnits = 1;
ctxInfo->maxTextureImageUnits = 0;
@@ -3077,7 +2627,6 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
ctxInfo->textureEnvCombineAvailable = JNI_FALSE;
ctxInfo->textureCombineDot3Available = JNI_FALSE;
ctxInfo->textureCombineSubtractAvailable = JNI_FALSE;
- ctxInfo->textureCubeMapAvailable = JNI_FALSE;
/* NV extensions */
ctxInfo->textureRegisterCombinersAvailable = JNI_FALSE;
@@ -3091,6 +2640,7 @@ 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;
@@ -3105,17 +2655,17 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
ctxInfo->glGetColorTableParameteriv = NULL;
ctxInfo->glTexImage3DEXT = NULL;
ctxInfo->glTexSubImage3DEXT = NULL;
- ctxInfo->glClientActiveTextureARB = NULL;
+ ctxInfo->glClientActiveTexture = NULL;
ctxInfo->glMultiDrawArraysEXT = NULL;
ctxInfo->glMultiDrawElementsEXT = NULL;
ctxInfo->glLockArraysEXT = NULL;
ctxInfo->glUnlockArraysEXT = NULL;
- ctxInfo->glMultiTexCoord2fvARB = NULL;
- ctxInfo->glMultiTexCoord3fvARB = NULL;
- ctxInfo->glMultiTexCoord4fvARB = NULL;
- ctxInfo->glLoadTransposeMatrixdARB = NULL;
- ctxInfo->glMultTransposeMatrixdARB = NULL;
- ctxInfo->glActiveTextureARB = NULL;
+ ctxInfo->glMultiTexCoord2fv = NULL;
+ ctxInfo->glMultiTexCoord3fv = NULL;
+ ctxInfo->glMultiTexCoord4fv = NULL;
+ ctxInfo->glLoadTransposeMatrixd = NULL;
+ ctxInfo->glMultTransposeMatrixd = NULL;
+ ctxInfo->glActiveTexture = NULL;
ctxInfo->glGlobalAlphaFactorfSUN = NULL;
ctxInfo->glCombinerInputNV = NULL;
@@ -3148,10 +2698,6 @@ initializeCtxInfo(JNIEnv *env , GraphicsContextPropertiesInfo* ctxInfo)
/* Initialize shader info pointers */
ctxInfo->glslCtxInfo = NULL;
ctxInfo->cgCtxInfo = NULL;
-
-#if defined(UNIX)
- ctxInfo->glXVideoResizeSUN = NULL;
-#endif /* UNIX */
}
static void
@@ -3231,12 +2777,12 @@ HWND createDummyWindow(const char* szAppName) {
#endif
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
+void JNICALL Java_javax_media_j3d_NativePipeline_createQueryContext(
JNIEnv *env,
jobject obj,
+ jobject cv,
jlong display,
- jint window,
- jint vid,
+ jlong window,
jlong fbConfigListPtr,
jboolean offScreen,
jint width,
@@ -3247,7 +2793,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
JNIEnv table = *env;
jlong gctx;
int stencilSize=0;
- jint newWin;
+ jlong newWin;
int PixelFormatID=0;
GraphicsContextPropertiesInfo* ctxInfo = (GraphicsContextPropertiesInfo *)malloc(sizeof(GraphicsContextPropertiesInfo));
@@ -3309,14 +2855,14 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
glWin = XCreateWindow((Display *)display, root, 0, 0, width, height, 0,
vinfo->depth, InputOutput, vinfo->visual,
win_mask, &win_attrs);
- newWin = (jint)glWin;
+ newWin = (jlong)glWin;
}
}
else if(window == 0 && offScreen){
- newWin = Java_javax_media_j3d_Canvas3D_createOffScreenBuffer( env, obj, 0,
- display, window,
- fbConfigListPtr,
- width, height);
+ newWin = Java_javax_media_j3d_NativePipeline_createOffScreenBuffer(env,
+ obj, cv, 0, display,
+ fbConfigListPtr,
+ width, height);
}
else if(window != 0) {
newWin = window;
@@ -3350,11 +2896,6 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
fprintf(stderr, "Canvas3D_createQueryContext:\n");
fprintf(stderr, "window is 0x%x, offScreen %d\n", window, offScreen);
*/
-
- /*
- * vid must be valid PixelFormat returned
- * by wglChoosePixelFormat() or wglChoosePixelFormatARB.
- */
/* Fix to issue 104 */
if(!offScreen) {
@@ -3387,16 +2928,17 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
}
else if(window == 0 && offScreen){
/* fprintf(stderr, "CreateQueryContext : window == 0 && offScreen\n"); */
- hdc = (HDC)Java_javax_media_j3d_Canvas3D_createOffScreenBuffer( env, obj, 0, display,
- vid, fbConfigListPtr,
- width, height);
+ hdc = (HDC)Java_javax_media_j3d_NativePipeline_createOffScreenBuffer(env,
+ obj, cv, 0, display,
+ fbConfigListPtr,
+ width, height);
}
else if(window != 0){
/* fprintf(stderr, "CreateQueryContext : window != 0 0x%x\n", window); */
hdc = (HDC) window;
}
- newWin = (jint)hdc;
+ newWin = (jlong)hdc;
SetPixelFormat(hdc, PixelFormatID, NULL);
@@ -3430,18 +2972,18 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
ctxInfo->context = gctx;
/* get current context properties */
- if (getPropertiesFromCurrentContext(env, obj, ctxInfo, (jlong) hdc, PixelFormatID,
+ if (getPropertiesFromCurrentContext(env, cv, ctxInfo, (jlong) hdc, PixelFormatID,
fbConfigListPtr, offScreen,
glslLibraryAvailable, cgLibraryAvailable)) {
/* put the properties to the Java side */
- setupCanvasProperties(env, obj, ctxInfo);
+ setupCanvasProperties(env, cv, ctxInfo);
}
/* clear up the context , colormap and window if appropriate */
if(window == 0 && !offScreen){
#if defined(UNIX)
- Java_javax_media_j3d_Canvas3D_destroyContext(env, obj, display, newWin, (jlong)ctxInfo);
+ Java_javax_media_j3d_NativePipeline_destroyContext(env, obj, display, newWin, (jlong)ctxInfo);
XDestroyWindow((Display *)display, glWin);
XFreeColormap((Display *)display, cmap);
#endif /* UNIX */
@@ -3450,33 +2992,33 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext(
ReleaseDC(hDummyWnd, hdc);
/* Destroy context */
/* This will free ctxInfo also */
- Java_javax_media_j3d_Canvas3D_destroyContext(env, obj, display,newWin, (jlong)ctxInfo);
+ Java_javax_media_j3d_NativePipeline_destroyContext(env, obj, display,newWin, (jlong)ctxInfo);
DestroyWindow(hDummyWnd);
UnregisterClass(szAppName, (HINSTANCE)NULL);
#endif /* WIN32 */
}
else if(window == 0 && offScreen) {
- Java_javax_media_j3d_Canvas3D_destroyOffScreenBuffer(env, obj, gctx, display, fbConfigListPtr, newWin);
- Java_javax_media_j3d_Canvas3D_destroyContext(env, obj, display, newWin, (jlong)ctxInfo);
+ Java_javax_media_j3d_NativePipeline_destroyOffScreenBuffer(env, obj, cv, gctx, display, fbConfigListPtr, newWin);
+ Java_javax_media_j3d_NativePipeline_destroyContext(env, obj, display, newWin, (jlong)ctxInfo);
}
else if(window != 0){
- Java_javax_media_j3d_Canvas3D_destroyContext(env, obj, display, newWin, (jlong)ctxInfo);
+ Java_javax_media_j3d_NativePipeline_destroyContext(env, obj, display, newWin, (jlong)ctxInfo);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_beginScene(
+void JNICALL Java_javax_media_j3d_NativePipeline_beginScene(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
{
- /* Not used by OGL version */
+ /* Not used by OGL renderer */
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_Canvas3D_endScene(
+void JNICALL Java_javax_media_j3d_NativePipeline_endScene(
JNIEnv *env,
jobject obj,
jlong ctxInfo)
@@ -3488,18 +3030,18 @@ void JNICALL Java_javax_media_j3d_Canvas3D_endScene(
}
/* Setup the multisampling for full scene antialiasing */
-JNIEXPORT void JNICALL Java_javax_media_j3d_Canvas3D_setFullSceneAntialiasing
+JNIEXPORT void JNICALL Java_javax_media_j3d_NativePipeline_setFullSceneAntialiasing
(JNIEnv *env, jobject obj, jlong ctxInfo, jboolean enable)
{
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
- if (ctxProperties->arb_multisample && !ctxProperties->implicit_multisample) {
+ if (ctxProperties->multisample && !ctxProperties->implicit_multisample) {
if(enable == JNI_TRUE) {
- glEnable(GL_MULTISAMPLE_ARB);
+ glEnable(GL_MULTISAMPLE);
}
else {
- glDisable(GL_MULTISAMPLE_ARB);
+ glDisable(GL_MULTISAMPLE);
}
}
@@ -3511,7 +3053,7 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_Canvas3D_setFullSceneAntialiasing
* Return false if <= 8 bit color under windows
*/
JNIEXPORT
-jboolean JNICALL Java_javax_media_j3d_Canvas3D_validGraphicsMode(
+jboolean JNICALL Java_javax_media_j3d_NativePipeline_validGraphicsMode(
JNIEnv *env,
jobject obj)
{
@@ -3528,9 +3070,18 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_validGraphicsMode(
}
+JNIEXPORT
+void JNICALL Java_javax_media_j3d_NativePipeline_cleanupRenderer(
+ JNIEnv *env,
+ jobject obj)
+{
+ /* No-op for OGL pipeline */
+}
+
+
/*
* Function to disable most rendering attributes when doing a 2D
- * clear, image copy, or image composite operation. Note that the
+ * clear, or image copy operation. Note that the
* caller must save/restore the attributes with
* pushAttrib(GL_ENABLE_BIT|...) and popAttrib()
*/
@@ -3560,13 +3111,8 @@ disableAttribFor2D(GraphicsContextPropertiesInfo *ctxProperties)
glDisable(GL_CLIP_PLANE0 + i);
}
- if (ctxProperties->texture3DAvailable) {
- glDisable(ctxProperties->texture_3D_ext_enum);
- }
-
- if (ctxProperties->textureCubeMapAvailable) {
- glDisable(ctxProperties->texture_cube_map_ext_enum);
- }
+ glDisable(GL_TEXTURE_3D);
+ glDisable(GL_TEXTURE_CUBE_MAP);
if (ctxProperties->textureRegisterCombinersAvailable) {
glDisable(GL_REGISTER_COMBINERS_NV);
@@ -3580,3 +3126,28 @@ disableAttribFor2D(GraphicsContextPropertiesInfo *ctxProperties)
glDisable(GL_GLOBAL_ALPHA_SUN);
}
}
+
+/*
+ * Function to disable most rendering attributes when doing a Raster
+ * clear, or image copy operation. Note that the
+ * caller must save/restore the attributes with
+ * pushAttrib(GL_ENABLE_BIT|...) and popAttrib()
+ */
+static void
+disableAttribForRaster(GraphicsContextPropertiesInfo *ctxProperties)
+{
+ glDisable(GL_COLOR_MATERIAL);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_POLYGON_OFFSET_FILL);
+ glDisable(GL_POLYGON_STIPPLE);
+
+ // TODO: Disable if Raster.CLIP_POSITION is true
+// for (int i = 0; i < 6; i++) {
+// glDisable(GL_CLIP_PLANE0 + i);
+// }
+
+ if (ctxProperties->global_alpha_sun) {
+ glDisable(GL_GLOBAL_ALPHA_SUN);
+ }
+}
diff --git a/src/native/ogl/CgShaderProgram.c b/src/native/ogl/CgShaderProgram.c
index 04286e2..a4bfce0 100644
--- a/src/native/ogl/CgShaderProgram.c
+++ b/src/native/ogl/CgShaderProgram.c
@@ -56,14 +56,14 @@ static CgWrapperInfo *globalCgWrapperInfo = NULL;
/*
- * Class: javax_media_j3d_MasterControl
+ * Class: javax_media_j3d_NativePipeline
* Method: loadNativeCgLibrary
- * Signature: ()Z
+ * Signature: ([Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_javax_media_j3d_MasterControl_loadNativeCgLibrary(
+Java_javax_media_j3d_NativePipeline_loadNativeCgLibrary(
JNIEnv *env,
- jclass clazz,
+ jobject thiz,
jobjectArray libpath)
{
CgWrapperInfo *cgWrapperInfo;
@@ -83,7 +83,7 @@ Java_javax_media_j3d_MasterControl_loadNativeCgLibrary(
/* Assertion check that we don't get called more than once */
if (globalCgWrapperInfo != NULL) {
- throwAssert(env, "MasterControl.loadNativeCgLibrary called more than once");
+ throwAssert(env, "NativePipeline.loadNativeCgLibrary called more than once");
return JNI_FALSE;
}
@@ -403,12 +403,12 @@ checkCgShaderExtensions(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: createNativeShader
+ * Class: javax_media_j3d_NativePipeline
+ * Method: createCgShader
* Signature: (JI[J)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_createNativeShader(
+Java_javax_media_j3d_NativePipeline_createCgShader(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -427,7 +427,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_createNativeShader(
CgShaderInfo *cgShaderInfo;
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.createNativeShader\n");
+ fprintf(stderr, "CgShaderProgramRetained.createCgShader\n");
#endif /* VERBOSE */
cgShaderInfo = (CgShaderInfo*)malloc(sizeof(CgShaderInfo));
@@ -470,12 +470,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_createNativeShader(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: destroyNativeShader
+ * Class: javax_media_j3d_NativePipeline
+ * Method: destroyCgShader
* Signature: (JJ)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_destroyNativeShader(
+Java_javax_media_j3d_NativePipeline_destroyCgShader(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -492,7 +492,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_destroyNativeShader(
CgShaderInfo *cgShaderInfo = (CgShaderInfo *)shaderId;
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.destroyNativeShader\n");
+ fprintf(stderr, "CgShaderProgramRetained.destroyCgShader\n");
#endif /* VERBOSE */
if (cgShaderInfo != NULL) {
@@ -517,12 +517,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_destroyNativeShader(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: compileNativeShader
+ * Class: javax_media_j3d_NativePipeline
+ * Method: compileCgShader
* Signature: (JJLjava/lang/String;)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_compileNativeShader(
+Java_javax_media_j3d_NativePipeline_compileCgShader(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -542,7 +542,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_compileNativeShader(
GLcharARB *shaderString = NULL;
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.compileNativeShader\n");
+ fprintf(stderr, "CgShaderProgramRetained.compileCgShader\n");
#endif /* VERBOSE */
/* Assertion check the cgShaderInfo pointer */
@@ -610,12 +610,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_compileNativeShader(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: createNativeShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: createCgShaderProgram
* Signature: (J[J)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_createNativeShaderProgram(
+Java_javax_media_j3d_NativePipeline_createCgShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -631,7 +631,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_createNativeShaderProgram(
(CgShaderProgramInfo*)malloc(sizeof(CgShaderProgramInfo));
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.createNativeShaderProgram\n");
+ fprintf(stderr, "CgShaderProgramRetained.createCgShaderProgram\n");
#endif /* VERBOSE */
shaderProgramInfo->vShader = NULL;
@@ -657,12 +657,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_createNativeShaderProgram(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: destroyNativeShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: destroyCgShaderProgram
* Signature: (JJ)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_destroyNativeShaderProgram(
+Java_javax_media_j3d_NativePipeline_destroyCgShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -675,7 +675,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_destroyNativeShaderProgram(
CgShaderProgramInfo *shaderProgramInfo = (CgShaderProgramInfo*)shaderProgramId;
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.destroyNativeShaderProgram\n");
+ fprintf(stderr, "CgShaderProgramRetained.destroyCgShaderProgram\n");
#endif /* VERBOSE */
if (shaderProgramInfo != NULL) {
@@ -700,12 +700,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_destroyNativeShaderProgram(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: linkNativeShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: linkCgShaderProgram
* Signature: (JJ[J)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_linkNativeShaderProgram(
+Java_javax_media_j3d_NativePipeline_linkCgShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -729,7 +729,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_linkNativeShaderProgram(
CgShaderProgramInfo *shaderProgramInfo = (CgShaderProgramInfo*)shaderProgramId;
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.linkNativeShaderProgram\n");
+ fprintf(stderr, "CgShaderProgramRetained.linkCgShaderProgram\n");
#endif /* VERBOSE */
/*
@@ -789,12 +789,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_linkNativeShaderProgram(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: lookupNativeVertexAttrNames
+ * Class: javax_media_j3d_NativePipeline
+ * Method: lookupCgVertexAttrNames
* Signature: (JJI[Ljava/lang/String;[Z)V
*/
JNIEXPORT void JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_lookupNativeVertexAttrNames(
+Java_javax_media_j3d_NativePipeline_lookupCgVertexAttrNames(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -831,7 +831,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_lookupNativeVertexAttrNames(
shaderProgramInfo->vtxAttrs = (CGparameter *)malloc(numAttrNames * sizeof(CGparameter));
#ifdef VERBOSE
- fprintf(stderr, "CgShaderProgramRetained.lookupNativeVertexAttrNames()\n");
+ fprintf(stderr, "CgShaderProgramRetained.lookupCgVertexAttrNames()\n");
#endif /* VERBOSE */
for (i = 0; i < numAttrNames; i++) {
@@ -974,12 +974,12 @@ lookupParams(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: lookupNativeShaderAttrNames
+ * Class: javax_media_j3d_NativePipeline
+ * Method: lookupCgShaderAttrNames
* Signature: (JJI[Ljava/lang/String;[J[I[I[Z)V
*/
JNIEXPORT void JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_lookupNativeShaderAttrNames(
+Java_javax_media_j3d_NativePipeline_lookupCgShaderAttrNames(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1050,7 +1050,7 @@ Java_javax_media_j3d_CgShaderProgramRetained_lookupNativeShaderAttrNames(
* same type and dimensionality, then a struct is allocated
* containing the list of parameters.
*
- * When any of the setUniform methods are called, the attribute
+ * When any of the setCgUniform methods are called, the attribute
* will be set for each parameter in the list.
*/
cgParamInfo = (CgParameterInfo *)malloc(sizeof(CgParameterInfo));
@@ -1150,12 +1150,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_lookupNativeShaderAttrNames(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: useShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: useCgShaderProgram
* Signature: (JJ)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_useShaderProgram(
+Java_javax_media_j3d_NativePipeline_useCgShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1201,12 +1201,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_useShaderProgram(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform1i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform1i
* Signature: (JJJI)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform1i(
+Java_javax_media_j3d_NativePipeline_setCgUniform1i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1245,12 +1245,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform1i(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform1f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform1f
* Signature: (JJJF)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform1f(
+Java_javax_media_j3d_NativePipeline_setCgUniform1f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1289,12 +1289,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform1f(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform2i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform2i
* Signature: (JJJ[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform2i(
+Java_javax_media_j3d_NativePipeline_setCgUniform2i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1345,12 +1345,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform2i(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform2f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform2f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform2f(
+Java_javax_media_j3d_NativePipeline_setCgUniform2f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1401,12 +1401,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform2f(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform3i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform3i
* Signature: (JJJ[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform3i(
+Java_javax_media_j3d_NativePipeline_setCgUniform3i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1459,12 +1459,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform3i(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform3f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform3f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform3f(
+Java_javax_media_j3d_NativePipeline_setCgUniform3f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1517,12 +1517,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform3f(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform4i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform4i
* Signature: (JJJ[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform4i(
+Java_javax_media_j3d_NativePipeline_setCgUniform4i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1577,12 +1577,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform4i(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform4f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform4f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform4f(
+Java_javax_media_j3d_NativePipeline_setCgUniform4f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1637,12 +1637,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform4f(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniformMatrix3f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniformMatrix3f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3f(
+Java_javax_media_j3d_NativePipeline_setCgUniformMatrix3f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1689,12 +1689,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3f(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniformMatrix4f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniformMatrix4f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix4f(
+Java_javax_media_j3d_NativePipeline_setCgUniformMatrix4f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1741,12 +1741,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix4f(
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform1iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform1iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform1iArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform1iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1802,12 +1802,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform1iArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform1fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform1fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform1fArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform1fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1856,12 +1856,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform1fArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform2iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform2iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform2iArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform2iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1917,12 +1917,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform2iArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform2fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform2fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform2fArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform2fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1971,12 +1971,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform2fArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform3iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform3iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform3iArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform3iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2032,12 +2032,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform3iArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform3fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform3fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform3fArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform3fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2086,12 +2086,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform3fArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform4iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform4iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform4iArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform4iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2147,12 +2147,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform4iArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniform4fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniform4fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniform4fArray(
+Java_javax_media_j3d_NativePipeline_setCgUniform4fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2201,12 +2201,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform4fArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniformMatrix3fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniformMatrix3fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3fArray(
+Java_javax_media_j3d_NativePipeline_setCgUniformMatrix3fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -2255,12 +2255,12 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3fArray(
}
/*
- * Class: javax_media_j3d_CgShaderProgramRetained
- * Method: setUniformMatrix4fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setCgUniformMatrix4fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix4fArray(
+Java_javax_media_j3d_NativePipeline_setCgUniformMatrix4fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
diff --git a/src/native/ogl/DrawingSurfaceObjectAWT.c b/src/native/ogl/DrawingSurfaceObjectAWT.c
index 25f8bd1..867a78d 100644
--- a/src/native/ogl/DrawingSurfaceObjectAWT.c
+++ b/src/native/ogl/DrawingSurfaceObjectAWT.c
@@ -23,7 +23,7 @@
#include <math.h>
#include <jawt_md.h>
-#include "javax_media_j3d_MasterControl.h"
+#include "javax_media_j3d_NativePipeline.h"
#include "javax_media_j3d_DrawingSurfaceObjectAWT.h"
#ifdef DEBUG
@@ -47,7 +47,7 @@
JNIEXPORT jlong JNICALL
-Java_javax_media_j3d_MasterControl_getAWT(
+Java_javax_media_j3d_NativePipeline_getAWT(
JNIEnv *env, jobject obj)
{
JAWT *awt;
diff --git a/src/native/ogl/GLSLInfo.h b/src/native/ogl/GLSLInfo.h
index 00b3368..e9accfa 100644
--- a/src/native/ogl/GLSLInfo.h
+++ b/src/native/ogl/GLSLInfo.h
@@ -17,6 +17,8 @@
/* Structure used to hold GLSL context information; stored in ctxInfo */
struct GLSLCtxInfoRec {
+ int vertexAttrOffset;
+
PFNGLATTACHOBJECTARBPROC pfnglAttachObjectARB;
PFNGLCOMPILESHADERARBPROC pfnglCompileShaderARB;
PFNGLCREATEPROGRAMOBJECTARBPROC pfnglCreateProgramObjectARB;
diff --git a/src/native/ogl/GLSLShaderProgram.c b/src/native/ogl/GLSLShaderProgram.c
index bbc29da..26c19f6 100644
--- a/src/native/ogl/GLSLShaderProgram.c
+++ b/src/native/ogl/GLSLShaderProgram.c
@@ -33,6 +33,7 @@
#endif /* DEBUG */
+extern jint getJavaIntEnv(JNIEnv *env, char* envStr);
extern char *strJavaToC(JNIEnv *env, jstring str);
extern void throwAssert(JNIEnv *env, char *str);
extern jobject createShaderError(JNIEnv *env,
@@ -265,10 +266,14 @@ checkGLSLShaderExtensions(
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &ctxInfo->maxTextureImageUnits);
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &ctxInfo->maxVertexTextureImageUnits);
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &ctxInfo->maxCombinedTextureImageUnits);
+
+ /* Initialize GLSL VertexAttr info */
+ glslCtxInfo->vertexAttrOffset = getJavaIntEnv(env, "glslVertexAttrOffset");
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &ctxInfo->maxVertexAttrs);
- if (ctxInfo->maxVertexAttrs > 0) {
- /* decr count, since vertexAttr[0] is reserved for position */
- ctxInfo->maxVertexAttrs -= 1;
+ /* decr count to allow for reserved vertex attrs */
+ ctxInfo->maxVertexAttrs -= glslCtxInfo->vertexAttrOffset;
+ if (ctxInfo->maxVertexAttrs < 0) {
+ ctxInfo->maxVertexAttrs = 0;
}
if (glslCtxInfo->pfnglCreateShaderObjectARB != NULL) {
@@ -319,12 +324,12 @@ getInfoLog(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: createNativeShader
+ * Class: javax_media_j3d_NativePipeline
+ * Method: createGLSLShader
* Signature: (JI[J)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_createNativeShader(
+Java_javax_media_j3d_NativePipeline_createGLSLShader(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -369,12 +374,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_createNativeShader(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: destroyNativeShader
+ * Class: javax_media_j3d_NativePipeline
+ * Method: destroyGLSLShader
* Signature: (JJ)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_destroyNativeShader(
+Java_javax_media_j3d_NativePipeline_destroyGLSLShader(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -389,12 +394,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_destroyNativeShader(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: compileNativeShader
+ * Class: javax_media_j3d_NativePipeline
+ * Method: compileGLSLShader
* Signature: (JJLjava/lang/String;)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_compileNativeShader(
+Java_javax_media_j3d_NativePipeline_compileGLSLShader(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -451,12 +456,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_compileNativeShader(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: createNativeShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: createGLSLShaderProgram
* Signature: (J[J)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_createNativeShaderProgram(
+Java_javax_media_j3d_NativePipeline_createGLSLShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -487,12 +492,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_createNativeShaderProgram(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: destroyNativeShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: destroyGLSLShaderProgram
* Signature: (JJ)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_destroyNativeShaderProgram(
+Java_javax_media_j3d_NativePipeline_destroyGLSLShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -507,12 +512,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_destroyNativeShaderProgram(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: linkNativeShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: linkGLSLShaderProgram
* Signature: (JJ[J)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_linkNativeShaderProgram(
+Java_javax_media_j3d_NativePipeline_linkGLSLShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -558,12 +563,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_linkNativeShaderProgram(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: bindNativeVertexAttrName
+ * Class: javax_media_j3d_NativePipeline
+ * Method: bindGLSLVertexAttrName
* Signature: (JJLjava/lang/String;I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_bindNativeVertexAttrName(
+Java_javax_media_j3d_NativePipeline_bindGLSLVertexAttrName(
JNIEnv * env,
jobject obj,
jlong ctxInfo,
@@ -578,12 +583,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_bindNativeVertexAttrName(
/*
fprintf(stderr,
- "GLSLShaderProgramRetained.bindNativeVertexAttrName: %s\n",
+ "GLSLShaderProgramRetained.bindGLSLVertexAttrName: %s\n",
attrNameString);
*/
glslCtxInfo->pfnglBindAttribLocationARB((GLhandleARB)shaderProgramId,
- attrIndex + 1,
+ attrIndex + glslCtxInfo->vertexAttrOffset,
attrNameString);
/* No error checking needed, so just return */
@@ -651,12 +656,12 @@ glslToJ3dType(GLint type)
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: lookupNativeShaderAttrNames
+ * Class: javax_media_j3d_NativePipeline
+ * Method: lookupGLSLShaderAttrNames
* Signature: (JJI[Ljava/lang/String;[J[I[I[Z)V
*/
JNIEXPORT void JNICALL
-Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames(
+Java_javax_media_j3d_NativePipeline_lookupGLSLShaderAttrNames(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -686,7 +691,7 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames(
JNIEnv table = *env;
#ifdef VERBOSE
- fprintf(stderr, "GLSLShaderProgramRetained.lookupNativeShaderAttrNames\n");
+ fprintf(stderr, "GLSLShaderProgramRetained.lookupGLSLShaderAttrNames\n");
#endif
locPtr = (*env)->GetLongArrayElements(env, locArr, NULL);
@@ -736,6 +741,8 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames(
#endif
for (i = 0; i < numActiveUniforms; i++) {
+ int len;
+
glslCtxInfo->pfnglGetActiveUniformARB((GLhandleARB) shaderProgramId,
i,
maxStrLen,
@@ -743,9 +750,27 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames(
&size,
&type,
name);
+
+ /*
+ * Issue 247 - we need to workaround an ATI bug where they erroneously
+ * report individual elements of arrays rather than the array itself
+ */
+ len = strlen(name);
+ if (len >= 3 && name[len-1] == ']') {
+ if (strcmp(&name[len-3], "[0]") == 0) {
+ /* fprintf(stderr, "**** changing \"%s\" ", name); */
+ name[len-3] = '\0';
+ /* fprintf(stderr, "to \"%s\"\n", name); */
+ } else {
+ /* Ignore this name */
+ /* fprintf(stderr, "Uniform[%d] : %s ignored\n", i, name); */
+ continue;
+ }
+ }
+
#ifdef VERBOSE
fprintf(stderr,
- "Uniform[%d] : name = %s, type = %d, size = %d\n",
+ "Uniform[%d] : name = %s ; type = %d ; size = %d\n",
i, name, type, size);
#endif
@@ -794,12 +819,12 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: useShaderProgram
+ * Class: javax_media_j3d_NativePipeline
+ * Method: useGLSLShaderProgram
* Signature: (JI)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_useShaderProgram(
+JNICALL Java_javax_media_j3d_NativePipeline_useGLSLShaderProgram(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -816,12 +841,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_useShaderProgram(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform1i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform1i
* Signature: (JJJI)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1i(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform1i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -842,12 +867,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1i(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform1f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform1f
* Signature: (JJJF)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1f(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform1f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -868,12 +893,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1f(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform2i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform2i
* Signature: (JJJ[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2i(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform2i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -904,12 +929,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2i(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform2f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform2f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2f(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform2f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -942,12 +967,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2f(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform3i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform3i
* Signature: (JJJ[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3i(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform3i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -978,12 +1003,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3i(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform3f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform3f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3f(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform3f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1014,12 +1039,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3f(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform4i
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform4i
* Signature: (JJJ[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4i(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform4i(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1048,12 +1073,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4i(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform4f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform4f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4f(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform4f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1083,11 +1108,11 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4f(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniformMatrix3f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniformMatrix3f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
-JNIEXPORT jobject JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniformMatrix3f(
+JNIEXPORT jobject JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniformMatrix3f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1117,11 +1142,11 @@ JNIEXPORT jobject JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUnif
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniformMatrix4f
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniformMatrix4f
* Signature: (JJJ[F)Ljavax/media/j3d/ShaderError;
*/
-JNIEXPORT jobject JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniformMatrix4f(
+JNIEXPORT jobject JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniformMatrix4f(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1151,12 +1176,12 @@ JNIEXPORT jobject JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUnif
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform1iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform1iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1iArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform1iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1190,12 +1215,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1iArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform1fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform1fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1fArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform1fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1228,12 +1253,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform1fArray(
}
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform2iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform2iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2iArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform2iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1268,12 +1293,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2iArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform2fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform2fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2fArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform2fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1307,12 +1332,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform2fArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform3iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform3iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3iArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform3iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1346,12 +1371,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3iArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform3fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform3fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3fArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform3fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1385,12 +1410,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform3fArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform4iArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform4iArray
* Signature: (JJJI[I)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4iArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform4iArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1424,12 +1449,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4iArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniform4fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniform4fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4fArray(
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniform4fArray(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -1463,12 +1488,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniform4fArray(
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniformMatrix3fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniformMatrix3fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniformMatrix3fArray
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniformMatrix3fArray
(
JNIEnv *env,
jobject obj,
@@ -1504,12 +1529,12 @@ JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniformMatrix3fArray
/*
- * Class: javax_media_j3d_GLSLShaderProgramRetained
- * Method: setUniformMatrix4fArray
+ * Class: javax_media_j3d_NativePipeline
+ * Method: setGLSLUniformMatrix4fArray
* Signature: (JJJI[F)Ljavax/media/j3d/ShaderError;
*/
JNIEXPORT jobject
-JNICALL Java_javax_media_j3d_GLSLShaderProgramRetained_setUniformMatrix4fArray
+JNICALL Java_javax_media_j3d_NativePipeline_setGLSLUniformMatrix4fArray
(
JNIEnv *env,
jobject obj,
@@ -1556,8 +1581,8 @@ glslVertexAttrPointer(
{
GLSLCtxInfo *glslCtxInfo = ctxProperties->glslCtxInfo;
- glslCtxInfo->pfnglVertexAttribPointerARB(index+1, size, type,
- GL_FALSE, stride, pointer);
+ glslCtxInfo->pfnglVertexAttribPointerARB(index+glslCtxInfo->vertexAttrOffset,
+ size, type, GL_FALSE, stride, pointer);
}
static void
@@ -1567,7 +1592,7 @@ glslEnableVertexAttrArray(
{
GLSLCtxInfo *glslCtxInfo = ctxProperties->glslCtxInfo;
- glslCtxInfo->pfnglEnableVertexAttribArrayARB(index+1);
+ glslCtxInfo->pfnglEnableVertexAttribArrayARB(index+glslCtxInfo->vertexAttrOffset);
}
static void
@@ -1577,7 +1602,7 @@ glslDisableVertexAttrArray(
{
GLSLCtxInfo *glslCtxInfo = ctxProperties->glslCtxInfo;
- glslCtxInfo->pfnglDisableVertexAttribArrayARB(index+1);
+ glslCtxInfo->pfnglDisableVertexAttribArrayARB(index+glslCtxInfo->vertexAttrOffset);
}
static void
@@ -1590,7 +1615,7 @@ glslVertexAttr1fv(
#ifdef VERBOSE
fprintf(stderr, "glslVertexAttr1fv()\n");
#endif
- glslCtxInfo->pfnglVertexAttrib1fvARB(index+1, v);
+ glslCtxInfo->pfnglVertexAttrib1fvARB(index+glslCtxInfo->vertexAttrOffset, v);
}
static void
@@ -1603,7 +1628,7 @@ glslVertexAttr2fv(
#ifdef VERBOSE
fprintf(stderr, "glslVertexAttr2fv()\n");
#endif
- glslCtxInfo->pfnglVertexAttrib2fvARB(index+1, v);
+ glslCtxInfo->pfnglVertexAttrib2fvARB(index+glslCtxInfo->vertexAttrOffset, v);
}
static void
@@ -1616,7 +1641,7 @@ glslVertexAttr3fv(
#ifdef VERBOSE
fprintf(stderr, "glslVertexAttr3fv()\n");
#endif
- glslCtxInfo->pfnglVertexAttrib3fvARB(index+1, v);
+ glslCtxInfo->pfnglVertexAttrib3fvARB(index+glslCtxInfo->vertexAttrOffset, v);
}
static void
@@ -1629,6 +1654,6 @@ glslVertexAttr4fv(
#ifdef VERBOSE
fprintf(stderr, "glslVertexAttr4fv()\n");
#endif
- glslCtxInfo->pfnglVertexAttrib4fvARB(index+1, v);
+ glslCtxInfo->pfnglVertexAttrib4fvARB(index+glslCtxInfo->vertexAttrOffset, v);
}
diff --git a/src/native/ogl/GeometryArrayRetained.c b/src/native/ogl/GeometryArrayRetained.c
index fd638b7..c75ba72 100644
--- a/src/native/ogl/GeometryArrayRetained.c
+++ b/src/native/ogl/GeometryArrayRetained.c
@@ -55,16 +55,12 @@ static void enableTexCoordPointer(GraphicsContextPropertiesInfo *, int, int,
static void disableTexCoordPointer(GraphicsContextPropertiesInfo *, int);
static void clientActiveTextureUnit(GraphicsContextPropertiesInfo *, int);
-/*
- * texUnitIndex < 0 implies send all texture unit state info in one pass
- * texUnitIndex >= 0 implies one texture unit state info in one pass using
- * the underlying texture unit 0
- */
+
static void
-executeTexture(int texUnitIndex, int texCoordSetMapLen,
+executeTexture(int texCoordSetMapLen,
int texSize, int bstride, int texCoordoff,
jint texCoordSetMapOffset[],
- jint numActiveTexUnit, jint texUnitStateMap[],
+ jint numActiveTexUnit,
float verts[], jlong ctxInfo)
{
int i;
@@ -72,69 +68,24 @@ executeTexture(int texUnitIndex, int texCoordSetMapLen,
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
int tus; /* texture unit state index */
-
- if (texUnitIndex < 0) {
- if(ctxProperties->arb_multitexture) {
- for (i = 0; i < numActiveTexUnit; i++) {
- /*
- * NULL texUnitStateMap means
- * one to one mapping from texture unit to
- * texture unit state. It is NULL in build display list,
- * when the mapping is according to the texCoordSetMap
- */
- if (texUnitStateMap != NULL) {
- tus = texUnitStateMap[i];
- } else {
- tus = i;
- }
- /*
- * it's possible that texture unit state index (tus)
- * is greater than the texCoordSetMapOffsetLen, in this
- * case, just disable TexCoordPointer.
- */
- if ((tus < texCoordSetMapLen) &&
- (texCoordSetMapOffset[tus] != -1)) {
- enableTexCoordPointer(ctxProperties, i,
- texSize, GL_FLOAT, bstride,
- &(verts[texCoordoff + texCoordSetMapOffset[tus]]));
-
- } else {
- disableTexCoordPointer(ctxProperties, i);
- }
- }
- }/* GL_ARB_multitexture */
+ for (i = 0; i < numActiveTexUnit; i++) {
- else {
+ tus = i;
-#ifdef VERBOSE
- if (numActiveTexUnit > 1) {
- fprintf(stderr, "No multi-texture support\n");
- }
-#endif /* VERBOSE */
+ /*
+ * it's possible that texture unit state index (tus)
+ * is greater than the texCoordSetMapOffsetLen, in this
+ * case, just disable TexCoordPointer.
+ */
+ if ((tus < texCoordSetMapLen) &&
+ (texCoordSetMapOffset[tus] != -1)) {
+ enableTexCoordPointer(ctxProperties, i,
+ texSize, GL_FLOAT, bstride,
+ &(verts[texCoordoff + texCoordSetMapOffset[tus]]));
- if (texUnitStateMap != NULL) {
- tus = texUnitStateMap[0];
- } else {
- tus = 0;
- }
- if (texCoordSetMapOffset[tus] != -1) {
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(texSize, GL_FLOAT, bstride,
- &(verts[texCoordoff + texCoordSetMapOffset[tus]]));
-
- } else {
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- }
- }
- } else {
- if ((texUnitIndex < texCoordSetMapLen) &&
- (texCoordSetMapOffset[texUnitIndex] != -1)) {
- enableTexCoordPointer(ctxProperties, 0,
- texSize, GL_FLOAT, bstride,
- &(verts[texCoordoff + texCoordSetMapOffset[texUnitIndex]]));
} else {
- disableTexCoordPointer(ctxProperties, 0);
+ disableTexCoordPointer(ctxProperties, i);
}
}
}
@@ -146,16 +97,12 @@ resetTexture(jlong ctxInfo)
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- if(ctxProperties->arb_multitexture) {
- /* Disable texture coordinate arrays for all texture units */
- for (i = 0; i < ctxProperties->maxTexCoordSets; i++) {
- disableTexCoordPointer(ctxProperties, i);
- }
- /* Reset client active texture unit to 0 */
- clientActiveTextureUnit(ctxProperties, 0);
- } else {
- disableTexCoordPointer(ctxProperties, 0);
+ /* Disable texture coordinate arrays for all texture units */
+ for (i = 0; i < ctxProperties->maxTexCoordSets; i++) {
+ disableTexCoordPointer(ctxProperties, i);
}
+ /* Reset client active texture unit to 0 */
+ clientActiveTextureUnit(ctxProperties, 0);
}
@@ -200,7 +147,6 @@ executeGeometryArray(
JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo, jint geo_type,
jboolean isNonUniformScale, jboolean useAlpha,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint startVIndex,
jint vcount, jint vformat,
@@ -208,10 +154,9 @@ executeGeometryArray(
jintArray texCoordSetMap, jint texCoordSetMapLen,
jintArray texUnitOffset,
jint numActiveTexUnit,
- jintArray texUnitStateMapArray,
jint vertexAttrCount, jintArray vertexAttrSizes,
jfloatArray varray, jobject varrayBuffer, jfloatArray carray,
- jint texUnitIndex, jint cDirty)
+ jint cDirty)
{
jclass geo_class;
JNIEnv table;
@@ -231,8 +176,7 @@ executeGeometryArray(
jfieldID strip_field;
jarray sarray;
- jint texSize, texStride, *texCoordSetMapOffset = NULL,
- *texUnitStateMap = NULL;
+ jint texSize, texStride, *texCoordSetMapOffset = NULL;
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
@@ -358,12 +302,8 @@ executeGeometryArray(
texCoordSetMapOffset = (jint *) (*(table->GetPrimitiveArrayCritical))(env, texUnitOffset, NULL);
}
- if (texUnitStateMapArray != NULL) {
- texUnitStateMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env, texUnitStateMapArray, NULL);
- }
-
/* Enable normalize for non-uniform scale (which rescale can't handle) */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glEnable(GL_NORMALIZE);
}
@@ -416,10 +356,10 @@ executeGeometryArray(
if (vformat & GA_TEXTURE_COORDINATE) {
- executeTexture(texUnitIndex, texCoordSetMapLen,
+ executeTexture(texCoordSetMapLen,
texSize, bstride, texCoordoff,
texCoordSetMapOffset,
- numActiveTexUnit, texUnitStateMap,
+ numActiveTexUnit,
startVertex, ctxInfo);
}
@@ -509,10 +449,10 @@ executeGeometryArray(
if (vformat & GA_TEXTURE_COORDINATE) {
- executeTexture(texUnitIndex, texCoordSetMapLen,
+ executeTexture(texCoordSetMapLen,
texSize, bstride, texCoordoff,
texCoordSetMapOffset,
- numActiveTexUnit, texUnitStateMap,
+ numActiveTexUnit,
startVertex, ctxInfo);
}
@@ -536,7 +476,7 @@ executeGeometryArray(
}
/* clean up if we turned on normalize */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glDisable(GL_NORMALIZE);
}
@@ -555,9 +495,6 @@ executeGeometryArray(
(*(table->ReleasePrimitiveArrayCritical))(env, texUnitOffset,
texCoordSetMapOffset, 0);
- if (texUnitStateMap != NULL)
- (*(table->ReleasePrimitiveArrayCritical))(env, texUnitStateMapArray,
- texUnitStateMap, 0);
if(varray != NULL)
(*(table->ReleasePrimitiveArrayCritical))(env, varray, verts, 0);
@@ -568,15 +505,14 @@ executeGeometryArray(
/*
- * Class: javax_media_j3d_GeometryArrayRetained
+ * Class: javax_media_j3d_NativePipeline
* Method: execute
* Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZZZIIII[II[II[II[I[F[FII)V
*/
JNIEXPORT void JNICALL
-Java_javax_media_j3d_GeometryArrayRetained_execute(JNIEnv *env,
+Java_javax_media_j3d_NativePipeline_execute(JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo, jint geo_type,
jboolean isNonUniformScale, jboolean useAlpha,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint startVIndex,
jint vcount, jint vformat,
@@ -584,10 +520,9 @@ Java_javax_media_j3d_GeometryArrayRetained_execute(JNIEnv *env,
jintArray texCoordSetMap, jint texCoordSetMapLen,
jintArray texUnitOffset,
jint numActiveTexUnit,
- jintArray texUnitStateMapArray,
jint vertexAttrCount, jintArray vertexAttrSizes,
jfloatArray varray, jfloatArray carray,
- jint texUnitIndex, jint cDirty)
+ jint cDirty)
{
#ifdef VERBOSE
@@ -596,21 +531,20 @@ Java_javax_media_j3d_GeometryArrayRetained_execute(JNIEnv *env,
/* call executeGeometryArray */
executeGeometryArray(env, obj, ctxInfo, geo, geo_type, isNonUniformScale, useAlpha,
- multiScreen, ignoreVertexColors, startVIndex, vcount, vformat,
+ ignoreVertexColors, startVIndex, vcount, vformat,
texCoordSetCount, texCoordSetMap, texCoordSetMapLen,
- texUnitOffset, numActiveTexUnit, texUnitStateMapArray,
+ texUnitOffset, numActiveTexUnit,
vertexAttrCount, vertexAttrSizes,
- varray, NULL, carray, texUnitIndex, cDirty);
+ varray, NULL, carray, cDirty);
}
/* interleaved data with nio buffer as data format */
JNIEXPORT void JNICALL
-Java_javax_media_j3d_GeometryArrayRetained_executeInterleavedBuffer(
+Java_javax_media_j3d_NativePipeline_executeInterleavedBuffer(
JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo, jint geo_type,
- jboolean isNonUniformScale, jboolean useAlpha,
- jboolean multiScreen,
+ jboolean isNonUniformScale, jboolean useAlpha,
jboolean ignoreVertexColors,
jint startVIndex,
jint vcount, jint vformat,
@@ -618,9 +552,8 @@ Java_javax_media_j3d_GeometryArrayRetained_executeInterleavedBuffer(
jintArray texCoordSetMap, jint texCoordSetMapLen,
jintArray texUnitOffset,
jint numActiveTexUnit,
- jintArray texUnitStateMapArray,
jobject varray, jfloatArray carray,
- jint texUnitIndex, jint cDirty)
+ jint cDirty)
{
#ifdef VERBOSE
@@ -629,22 +562,22 @@ Java_javax_media_j3d_GeometryArrayRetained_executeInterleavedBuffer(
/* call executeGeometryArray */
executeGeometryArray(env, obj, ctxInfo, geo, geo_type, isNonUniformScale, useAlpha,
- multiScreen, ignoreVertexColors, startVIndex, vcount, vformat,
+ ignoreVertexColors, startVIndex, vcount, vformat,
texCoordSetCount, texCoordSetMap, texCoordSetMapLen,
- texUnitOffset, numActiveTexUnit, texUnitStateMapArray,
+ texUnitOffset, numActiveTexUnit,
0, NULL,
- NULL, varray, carray, texUnitIndex, cDirty);
+ NULL, varray, carray, cDirty);
}
/*
- * Class: javax_media_j3d_GeometryArrayRetained
+ * Class: javax_media_j3d_NativePipeline
* Method: buildGA
* Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZFZIIII[II[II[I[D[D[F)V
*/
JNIEXPORT
- void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGA(JNIEnv *env,
+ void JNICALL Java_javax_media_j3d_NativePipeline_buildGA(JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo,
jint geo_type,
jboolean isNonUniformScale, jboolean updateAlpha, float alpha,
@@ -911,12 +844,12 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
if (texCoordSetMapLen > 0) {
- if (ctxProperties->arb_multitexture) {
+ if (ctxProperties->gl13) {
if (vformat & GA_TEXTURE_COORDINATE_2) {
for (k = 0; k < texCoordSetMapLen; k++) {
if (texCoordSetMapOffset[k] != -1) {
- ctxProperties->glMultiTexCoord2fvARB(
- GL_TEXTURE0_ARB + k,
+ ctxProperties->glMultiTexCoord2fv(
+ GL_TEXTURE0 + k,
&verts[texCoordoff +
texCoordSetMapOffset[k]]);
}
@@ -924,8 +857,8 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
} else if (vformat & GA_TEXTURE_COORDINATE_3) {
for (k = 0; k < texCoordSetMapLen; k++) {
if (texCoordSetMapOffset[k] != -1) {
- ctxProperties->glMultiTexCoord3fvARB(
- GL_TEXTURE0_ARB + k,
+ ctxProperties->glMultiTexCoord3fv(
+ GL_TEXTURE0 + k,
&verts[texCoordoff +
texCoordSetMapOffset[k]]);
}
@@ -933,15 +866,15 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
} else {
for (k = 0; k < texCoordSetMapLen; k++) {
if (texCoordSetMapOffset[k] != -1) {
- ctxProperties->glMultiTexCoord4fvARB(
- GL_TEXTURE0_ARB + k,
+ ctxProperties->glMultiTexCoord4fv(
+ GL_TEXTURE0 + k,
&verts[texCoordoff +
texCoordSetMapOffset[k]]);
}
}
}
}
- else { /* GL_ARB_multitexture */
+ else { /* no multitexture */
if (texCoordSetMapOffset[0] != -1) {
if (vformat & GA_TEXTURE_COORDINATE_2) {
@@ -955,7 +888,7 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
texCoordSetMapOffset[0]]);
}
}
- } /* GL_ARB_multitexture */
+ } /* no multitexture */
}
/*
* texCoordSetMapLen can't be 0 if texture coordinates
@@ -1121,12 +1054,12 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
if (texCoordSetMapLen > 0) {
- if(ctxProperties->arb_multitexture) {
+ if(ctxProperties->gl13) {
if (vformat & GA_TEXTURE_COORDINATE_2) {
for (k = 0; k < texCoordSetMapLen; k++) {
if (texCoordSetMapOffset[k] != -1) {
- ctxProperties->glMultiTexCoord2fvARB(
- GL_TEXTURE0_ARB + k,
+ ctxProperties->glMultiTexCoord2fv(
+ GL_TEXTURE0 + k,
&verts[texCoordoff +
texCoordSetMapOffset[k]]);
}
@@ -1134,8 +1067,8 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
} else if (vformat & GA_TEXTURE_COORDINATE_3) {
for (k = 0; k < texCoordSetMapLen; k++) {
if (texCoordSetMapOffset[k] != -1) {
- ctxProperties->glMultiTexCoord3fvARB(
- GL_TEXTURE0_ARB + k,
+ ctxProperties->glMultiTexCoord3fv(
+ GL_TEXTURE0 + k,
&verts[texCoordoff +
texCoordSetMapOffset[k]]);
}
@@ -1143,15 +1076,15 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
} else {
for (k = 0; k < texCoordSetMapLen; k++) {
if (texCoordSetMapOffset[k] != -1) {
- ctxProperties->glMultiTexCoord4fvARB(
- GL_TEXTURE0_ARB + k,
+ ctxProperties->glMultiTexCoord4fv(
+ GL_TEXTURE0 + k,
&verts[texCoordoff +
texCoordSetMapOffset[k]]);
}
}
}
}
- else { /* GL_ARB_multitexture */
+ else { /* no multitexture */
if (texCoordSetMapOffset[0] != -1) {
if (vformat & GA_TEXTURE_COORDINATE_2) {
@@ -1165,7 +1098,7 @@ printf("orig: < %g %g %g > transformed: < %g %g %g >\n",
texCoordSetMapOffset[0]]);
}
}
- } /* GL_ARB_multitexture */
+ } /* no multitexture */
}
/*
@@ -1265,8 +1198,8 @@ clientActiveTextureUnit(
GraphicsContextPropertiesInfo *ctxProperties,
int texUnit)
{
- if (ctxProperties->arb_multitexture) {
- ctxProperties->glClientActiveTextureARB(texUnit + GL_TEXTURE0_ARB);
+ if (ctxProperties->gl13) {
+ ctxProperties->glClientActiveTexture(texUnit + GL_TEXTURE0);
}
}
@@ -1279,7 +1212,6 @@ executeGeometryArrayVA(
jobject geo,
jint geo_type,
jboolean isNonUniformScale,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint vcount,
jint vformat,
@@ -1295,12 +1227,10 @@ executeGeometryArrayVA(
jint vertexAttrCount,
jintArray vertexAttrSizes,
jintArray vertexAttrIndices,
- jfloat ** vertexAttrPointer,
- jint pass,
+ jfloat ** vertexAttrPointer,
jint texCoordMapLength,
jintArray tcoordsetmap,
jint numActiveTexUnit,
- jint* texUnitStateMap,
jintArray texindices,
jint texStride,
jfloat** texCoordPointer,
@@ -1341,7 +1271,7 @@ executeGeometryArrayVA(
#endif /* VERBOSE */
/* Enable normalize for non-uniform scale (which rescale can't handle) */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glEnable(GL_NORMALIZE);
}
@@ -1405,42 +1335,21 @@ executeGeometryArrayVA(
initialTexIndices = (jint *) (*(table->GetPrimitiveArrayCritical))(env,texindices, NULL);
texCoordSetMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env,tcoordsetmap, NULL);
- if (pass < 0) {
- for (i = 0; i < numActiveTexUnit; i++) {
- tus = texUnitStateMap[i];
- if ((tus < texCoordMapLength) && (
- ((texSet=texCoordSetMap[tus]) != -1))) {
-
- ptexCoords = texCoordPointer[texSet];
+ for (i = 0; i < numActiveTexUnit; i++) {
+ if ((i < texCoordMapLength) && (
+ ((texSet=texCoordSetMap[i]) != -1))) {
- enableTexCoordPointer(ctxProperties, i, texStride,
- GL_FLOAT, 0,
- &ptexCoords[texStride * initialTexIndices[texSet]]);
-
- } else {
- disableTexCoordPointer(ctxProperties, i);
- }
- }
- }
- else {
- texUnitStateMap = NULL;
- texSet = texCoordSetMap[pass];
- if (texSet != -1) {
- ptexCoords = texCoordPointer[texSet];
- enableTexCoordPointer(ctxProperties, 0, texStride,
- GL_FLOAT, 0,
- &ptexCoords[texStride * initialTexIndices[texSet]]);
+ ptexCoords = texCoordPointer[texSet];
+
+ enableTexCoordPointer(ctxProperties, i, texStride,
+ GL_FLOAT, 0,
+ &ptexCoords[texStride * initialTexIndices[texSet]]);
+
+ } else {
+ disableTexCoordPointer(ctxProperties, i);
+ }
+ }
- /*
- * in a non-multitexturing case, only the first texture
- * unit is used, it will be the core library responsibility
- * to disable all texture units before enabling "the"
- * texture unit for multi-pass purpose
- */
- } else {
- disableTexCoordPointer(ctxProperties, 0);
- }
- }
/* Reset client active texture unit to 0 */
clientActiveTextureUnit(ctxProperties, 0);
}
@@ -1494,7 +1403,7 @@ executeGeometryArrayVA(
}
}
/* clean up if we turned on normalize */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glDisable(GL_NORMALIZE);
}
@@ -1513,19 +1422,18 @@ executeGeometryArrayVA(
/* execute geometry array with java array format */
/*
- * Class: javax_media_j3d_GeometryArrayRetained
+ * Class: javax_media_j3d_NativePipeline
* Method: executeVA
* Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZZIIII[F[DI[F[BI[FI[I[I[[FII[II[I[II[Ljava/lang/Object;I)V
*/
JNIEXPORT void JNICALL
-Java_javax_media_j3d_GeometryArrayRetained_executeVA(
+Java_javax_media_j3d_NativePipeline_executeVA(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
jobject geo,
jint geo_type,
jboolean isNonUniformScale,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint vcount,
jint vformat,
@@ -1541,12 +1449,10 @@ Java_javax_media_j3d_GeometryArrayRetained_executeVA(
jint vertexAttrCount,
jintArray vertexAttrSizes,
jintArray vertexAttrIndices,
- jobjectArray vertexAttrData,
- jint pass,
+ jobjectArray vertexAttrData,
jint texCoordMapLength,
jintArray tcoordsetmap,
jint numActiveTexUnit,
- jintArray tunitstatemap,
jintArray texindices,
jint texStride,
jobjectArray texCoords,
@@ -1570,7 +1476,6 @@ Java_javax_media_j3d_GeometryArrayRetained_executeVA(
jfloat **vertexAttrPointer = NULL;
jfloat **texCoordPointer = NULL;
jarray *texobjs = NULL;
- jint* texUnitStateMap = NULL;
int i;
jboolean floatCoordDefined = ((vdefined & javax_media_j3d_GeometryArrayRetained_COORD_FLOAT) != 0);
@@ -1631,10 +1536,7 @@ Java_javax_media_j3d_GeometryArrayRetained_executeVA(
else
texCoordPointer[i] = NULL;
}
- if (pass < 0) {
- texUnitStateMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env,tunitstatemap, NULL);
- }
- }
+ }
/* get coordinate array */
if (floatCoordDefined) {
@@ -1660,15 +1562,15 @@ Java_javax_media_j3d_GeometryArrayRetained_executeVA(
#endif /* VERBOSE */
executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type,
- isNonUniformScale, multiScreen, ignoreVertexColors,
+ isNonUniformScale, ignoreVertexColors,
vcount, vformat, vdefined, initialCoordIndex,
fverts, dverts, initialColorIndex,
fclrs, bclrs, initialNormalIndex,
norms,
vertexAttrCount, vertexAttrSizes,
vertexAttrIndices, vertexAttrPointer,
- pass, texCoordMapLength,
- tcoordsetmap,numActiveTexUnit, texUnitStateMap,
+ texCoordMapLength,
+ tcoordsetmap,numActiveTexUnit,
texindices,texStride,texCoordPointer,cdirty, sarray, strip_len, start_array);
@@ -1691,9 +1593,6 @@ Java_javax_media_j3d_GeometryArrayRetained_executeVA(
(*(table->ReleasePrimitiveArrayCritical))(env, texobjs[i], texCoordPointer[i], 0);
}
}
- if (texUnitStateMap != NULL) {
- (*(table->ReleasePrimitiveArrayCritical))(env, tunitstatemap, texUnitStateMap, 0);
- }
}
if (texobjs != NULL) {
@@ -1726,18 +1625,17 @@ Java_javax_media_j3d_GeometryArrayRetained_executeVA(
/* execute geometry array with java array format */
/*
- * Class: javax_media_j3d_GeometryArrayRetained
+ * Class: javax_media_j3d_NativePipeline
* Method: executeVABuffer
* Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZZIIIILjava/lang/Object;ILjava/lang/Object;[F[BILjava/lang/Object;I[I[I[Ljava/lang/Object;II[II[I[II[Ljava/lang/Object;I)V
*/
-JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffer(
+JNIEXPORT void JNICALL Java_javax_media_j3d_NativePipeline_executeVABuffer(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
jobject geo,
jint geo_type,
jboolean isNonUniformScale,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint vcount,
jint vformat,
@@ -1753,12 +1651,10 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffe
jint vertexAttrCount,
jintArray vertexAttrSizes,
jintArray vertexAttrIndices,
- jobjectArray vertexAttrData,
- jint pass,
+ jobjectArray vertexAttrData,
jint texCoordMapLength,
jintArray tcoordsetmap,
jint numActiveTexUnit,
- jintArray tunitstatemap,
jintArray texindices,
jint texStride,
jobjectArray texCoords,
@@ -1781,7 +1677,6 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffe
jfloat **vertexAttrPointer = NULL;
jfloat **texCoordPointer = NULL;
jarray *texobjs = NULL;
- jint* texUnitStateMap = NULL;
int i;
jboolean floatCoordDefined = ((vdefined & javax_media_j3d_GeometryArrayRetained_COORD_FLOAT) != 0);
@@ -1872,9 +1767,6 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffe
else
texCoordPointer[i] = NULL;
}
- if (pass < 0) {
- texUnitStateMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env,tunitstatemap, NULL);
- }
}
@@ -1883,15 +1775,15 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffe
#endif /* VERBOSE */
executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type,
- isNonUniformScale, multiScreen, ignoreVertexColors,
+ isNonUniformScale, ignoreVertexColors,
vcount, vformat, vdefined, initialCoordIndex,
fverts, dverts, initialColorIndex,
fclrs, bclrs, initialNormalIndex,
norms,
vertexAttrCount, vertexAttrSizes,
vertexAttrIndices, vertexAttrPointer,
- pass, texCoordMapLength,
- tcoordsetmap,numActiveTexUnit, texUnitStateMap,
+ texCoordMapLength,
+ tcoordsetmap,numActiveTexUnit,
texindices,texStride,texCoordPointer,cdirty, sarray, strip_len, start_array);
if (vaobjs != NULL) {
@@ -1900,12 +1792,6 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffe
if (vertexAttrPointer != NULL) {
free(vertexAttrPointer);
}
-
- if (textureDefined) {
- if (texUnitStateMap != NULL) {
- (*(table->ReleasePrimitiveArrayCritical))(env, tunitstatemap, texUnitStateMap, 0);
- }
- }
if (texobjs != NULL) {
free(texobjs);
@@ -1923,10 +1809,11 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffe
JNIEXPORT
-void JNICALL Java_javax_media_j3d_GeometryArrayRetained_disableGlobalAlpha(
+void JNICALL Java_javax_media_j3d_NativePipeline_disableGlobalAlpha(
JNIEnv *env,
jobject obj,
- jlong ctxInfo,
+ jlong ctxInfo,
+ jobject geo,
jint vformat,
jboolean useAlpha,
jboolean ignoreVertexColors)
@@ -1945,15 +1832,16 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_disableGlobalAlpha(
/*
- * Class: javax_media_j3d_GeometryArrayRetained
+ * Class: javax_media_j3d_NativePipeline
* Method: setVertexFormat
* Signature: (JIZZI[I)V
*/
JNIEXPORT
-void JNICALL Java_javax_media_j3d_GeometryArrayRetained_setVertexFormat(
+void JNICALL Java_javax_media_j3d_NativePipeline_setVertexFormat(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
+ jobject geo,
jint vformat,
jboolean useAlpha,
jboolean ignoreVertexColors)
@@ -1999,28 +1887,11 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_setVertexFormat(
}
}
-JNIEXPORT jboolean JNICALL
-Java_javax_media_j3d_GeometryArrayRetained_globalAlphaSUN(
- JNIEnv *env,
- jobject obj,
- jlong ctxInfo)
-{
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong ctx = ctxProperties->context;
-
- if (ctxProperties->global_alpha_sun == 1)
- return JNI_TRUE ;
- else
- return JNI_FALSE ;
-}
-
-
static void
executeIndexedGeometryArray(
JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo, jint geo_type,
jboolean isNonUniformScale, jboolean useAlpha,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint initialIndexIndex,
jint indexCount,
@@ -2031,9 +1902,8 @@ executeIndexedGeometryArray(
jintArray texCoordSetMap, jint texCoordSetMapLen,
jintArray texUnitOffset,
jint numActiveTexUnit,
- jintArray texUnitStateMapArray,
jfloatArray varray, jobject varrayBuffer, jfloatArray carray,
- jint texUnitIndex, jint cDirty,
+ jint cDirty,
jintArray indexCoord)
{
jclass geo_class;
@@ -2060,8 +1930,7 @@ executeIndexedGeometryArray(
jint** multiDrawElementsIndices = NULL;
jint allocated = 0;
- jint texSize, texStride, *texCoordSetMapOffset = NULL,
- *texUnitStateMap = NULL;
+ jint texSize, texStride, *texCoordSetMapOffset = NULL;
GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
jlong ctx = ctxProperties->context;
@@ -2178,12 +2047,8 @@ executeIndexedGeometryArray(
texCoordSetMapOffset = (jint *) (*(table->GetPrimitiveArrayCritical))(env, texUnitOffset, NULL);
}
- if (texUnitStateMapArray != NULL) {
- texUnitStateMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env, texUnitStateMapArray, NULL);
- }
-
/* Enable normalize for non-uniform scale (which rescale can't handle) */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glEnable(GL_NORMALIZE);
}
@@ -2233,10 +2098,10 @@ executeIndexedGeometryArray(
if (vformat & GA_TEXTURE_COORDINATE) {
/* XXXX: texCoordoff == 0 ???*/
- executeTexture(texUnitIndex, texCoordSetMapLen,
+ executeTexture(texCoordSetMapLen,
texSize, bstride, texCoordoff,
texCoordSetMapOffset,
- numActiveTexUnit, texUnitStateMap,
+ numActiveTexUnit,
verts, ctxInfo);
}
@@ -2336,10 +2201,10 @@ executeIndexedGeometryArray(
if (vformat & GA_TEXTURE_COORDINATE) {
/* XXXX: texCoordoff == 0 ???*/
- executeTexture(texUnitIndex, texCoordSetMapLen,
+ executeTexture(texCoordSetMapLen,
texSize, bstride, texCoordoff,
texCoordSetMapOffset,
- numActiveTexUnit, texUnitStateMap,
+ numActiveTexUnit,
verts, ctxInfo);
}
@@ -2377,7 +2242,7 @@ executeIndexedGeometryArray(
/* clean up if we turned on normalize */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glDisable(GL_NORMALIZE);
}
if(varray != NULL)
@@ -2392,20 +2257,16 @@ executeIndexedGeometryArray(
(*(table->ReleasePrimitiveArrayCritical))(env, texUnitOffset,
texCoordSetMapOffset, 0);
- if (texUnitStateMap != NULL)
- (*(table->ReleasePrimitiveArrayCritical))(env, texUnitStateMapArray,
- texUnitStateMap, 0);
if (vAttrSizesPtr != NULL) {
table->ReleaseIntArrayElements(env, vertexAttrSizes, vAttrSizesPtr, JNI_ABORT);
}
}
JNIEXPORT void JNICALL
-Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometry(
+Java_javax_media_j3d_NativePipeline_executeIndexedGeometry(
JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo, jint geo_type,
jboolean isNonUniformScale, jboolean useAlpha,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint initialIndexIndex,
jint indexCount,
@@ -2416,9 +2277,8 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometry(
jintArray texCoordSetMap, jint texCoordSetMapLen,
jintArray texUnitOffset,
jint numActiveTexUnit,
- jintArray texUnitStateMapArray,
jfloatArray varray, jfloatArray carray,
- jint texUnitIndex, jint cDirty,
+ jint cDirty,
jintArray indexCoord)
{
@@ -2427,7 +2287,7 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometry(
#endif /* VERBOSE */
executeIndexedGeometryArray(env, obj, ctxInfo, geo, geo_type,
- isNonUniformScale, useAlpha, multiScreen,
+ isNonUniformScale, useAlpha,
ignoreVertexColors,
initialIndexIndex,
indexCount,
@@ -2438,18 +2298,16 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometry(
texCoordSetMap, texCoordSetMapLen,
texUnitOffset,
numActiveTexUnit,
- texUnitStateMapArray,
varray, NULL, carray,
- texUnitIndex, cDirty,
+ cDirty,
indexCoord);
}
JNIEXPORT void JNICALL
-Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryBuffer(
+Java_javax_media_j3d_NativePipeline_executeIndexedGeometryBuffer(
JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo, jint geo_type,
jboolean isNonUniformScale, jboolean useAlpha,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint initialIndexIndex,
jint indexCount,
@@ -2459,9 +2317,8 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryBuffer(
jintArray texCoordSetMap, jint texCoordSetMapLen,
jintArray texUnitOffset,
jint numActiveTexUnit,
- jintArray texUnitStateMapArray,
jobject varray, jfloatArray carray,
- jint texUnitIndex, jint cDirty,
+ jint cDirty,
jintArray indexCoord)
{
@@ -2470,7 +2327,7 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryBuffer(
#endif /* VERBOSE */
executeIndexedGeometryArray(env, obj, ctxInfo, geo, geo_type,
- isNonUniformScale, useAlpha, multiScreen,
+ isNonUniformScale, useAlpha,
ignoreVertexColors,
initialIndexIndex,
indexCount,
@@ -2481,9 +2338,8 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryBuffer(
texCoordSetMap, texCoordSetMapLen,
texUnitOffset,
numActiveTexUnit,
- texUnitStateMapArray,
NULL, varray, carray,
- texUnitIndex, cDirty,
+ cDirty,
indexCoord);
}
@@ -2496,7 +2352,6 @@ executeIndexedGeometryArrayVA(
jobject geo,
jint geo_type,
jboolean isNonUniformScale,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint initialIndexIndex,
jint validIndexCount,
@@ -2510,12 +2365,10 @@ executeIndexedGeometryArrayVA(
jfloat* norms,
jint vertexAttrCount,
jintArray vertexAttrSizes,
- jfloat ** vertexAttrPointer,
- jint pass,
+ jfloat ** vertexAttrPointer,
jint texCoordMapLength,
jintArray tcoordsetmap,
jint numActiveTexUnit,
- jintArray tunitstatemap,
jint texStride,
jfloat** texCoordPointer,
jint cdirty,
@@ -2543,7 +2396,7 @@ executeIndexedGeometryArrayVA(
jlong ctx = ctxProperties->context;
int texSet;
- jint *texCoordSetMap, *texUnitStateMap;
+ jint *texCoordSetMap;
GLsizei *countArray;
jint* vAttrSizes;
jint offset = 0;
@@ -2557,7 +2410,7 @@ executeIndexedGeometryArrayVA(
#endif /* VERBOSE */
/* Enable normalize for non-uniform scale (which rescale can't handle) */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glEnable(GL_NORMALIZE);
}
@@ -2608,43 +2461,23 @@ executeIndexedGeometryArrayVA(
int tus = 0;
float *ptexCoords;
- texCoordSetMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env,tcoordsetmap, NULL);
- if (pass < 0) {
- texUnitStateMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env,tunitstatemap, NULL);
- for (i = 0; i < numActiveTexUnit; i++) {
- tus = texUnitStateMap[i];
- if ((tus < texCoordMapLength) && (
- ((texSet=texCoordSetMap[tus]) != -1))) {
-
- ptexCoords = texCoordPointer[texSet];
+ texCoordSetMap = (jint *) (*(table->GetPrimitiveArrayCritical))(env,tcoordsetmap, NULL);
+ for (i = 0; i < numActiveTexUnit; i++) {
+ if ((i < texCoordMapLength) && (
+ ((texSet=texCoordSetMap[i]) != -1))) {
- enableTexCoordPointer(ctxProperties, i, texStride,
- GL_FLOAT, 0,
- ptexCoords);
-
- } else {
+ ptexCoords = texCoordPointer[texSet];
- disableTexCoordPointer(ctxProperties, i);
- }
- }
- }
- else {
- texUnitStateMap = NULL;
- texSet = texCoordSetMap[pass];
- if (texSet != -1) {
- ptexCoords = texCoordPointer[texSet];
- enableTexCoordPointer(ctxProperties, 0, texStride,
- GL_FLOAT, 0,
- ptexCoords);
+ enableTexCoordPointer(ctxProperties, i, texStride,
+ GL_FLOAT, 0,
+ ptexCoords);
+
+ } else {
+
+ disableTexCoordPointer(ctxProperties, i);
+ }
+ }
- /*
- * in a non-multitexturing case, only the first texture
- * unit is used, it will be the core library responsibility
- * to disable all texture units before enabling "the"
- * texture unit for multi-pass purpose
- */
- }
- }
/* Reset client active texture unit to 0 */
clientActiveTextureUnit(ctxProperties, 0);
}
@@ -2714,7 +2547,7 @@ executeIndexedGeometryArrayVA(
unlockArray(ctxProperties);
/* clean up if we turned on normalize */
- if (ctxProperties->rescale_normal_ext && isNonUniformScale) {
+ if (isNonUniformScale) {
glDisable(GL_NORMALIZE);
}
@@ -2728,21 +2561,18 @@ executeIndexedGeometryArrayVA(
resetTexture(ctxInfo);
(*(table->ReleasePrimitiveArrayCritical))(env, tcoordsetmap, texCoordSetMap, 0);
- if (texUnitStateMap != NULL)
- (*(table->ReleasePrimitiveArrayCritical))(env, tunitstatemap, texUnitStateMap, 0);
}
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryVA(
+void JNICALL Java_javax_media_j3d_NativePipeline_executeIndexedGeometryVA(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
jobject geo,
jint geo_type,
jboolean isNonUniformScale,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint initialIndexIndex,
jint validIndexCount,
@@ -2756,12 +2586,10 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
jfloatArray ndata,
jint vertexAttrCount,
jintArray vertexAttrSizes,
- jobjectArray vertexAttrData,
- jint pass,
+ jobjectArray vertexAttrData,
jint texCoordMapLength,
jintArray tcoordsetmap,
jint numActiveTexUnit,
- jintArray tunitstatemap,
jint texStride,
jobjectArray texCoords,
jint cdirty,
@@ -2871,7 +2699,6 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
geo,
geo_type,
isNonUniformScale,
- multiScreen,
ignoreVertexColors,
initialIndexIndex,
validIndexCount,
@@ -2885,12 +2712,10 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
norms,
vertexAttrCount,
vertexAttrSizes,
- vertexAttrPointer,
- pass,
+ vertexAttrPointer,
texCoordMapLength,
tcoordsetmap,
numActiveTexUnit,
- tunitstatemap,
texStride,
texCoordPointer,
cdirty,
@@ -2946,14 +2771,13 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryVABuffer(
+void JNICALL Java_javax_media_j3d_NativePipeline_executeIndexedGeometryVABuffer(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
jobject geo,
jint geo_type,
jboolean isNonUniformScale,
- jboolean multiScreen,
jboolean ignoreVertexColors,
jint initialIndexIndex,
jint validIndexCount,
@@ -2967,12 +2791,10 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
jobject ndata,
jint vertexAttrCount,
jintArray vertexAttrSizes,
- jobjectArray vertexAttrData,
- jint pass,
+ jobjectArray vertexAttrData,
jint texCoordMapLength,
jintArray tcoordsetmap,
jint numActiveTexUnit,
- jintArray tunitstatemap,
jint texStride,
jobjectArray texCoords,
jint cdirty,
@@ -3089,7 +2911,6 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
geo,
geo_type,
isNonUniformScale,
- multiScreen,
ignoreVertexColors,
initialIndexIndex,
validIndexCount,
@@ -3104,11 +2925,9 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
vertexAttrCount,
vertexAttrSizes,
vertexAttrPointer,
- pass,
texCoordMapLength,
tcoordsetmap,
numActiveTexUnit,
- tunitstatemap,
texStride,
texCoordPointer,
cdirty,
@@ -3137,7 +2956,7 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo
}
JNIEXPORT void JNICALL
-Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeometry(
+Java_javax_media_j3d_NativePipeline_buildIndexedGeometry(
JNIEnv *env,
jobject obj, jlong ctxInfo, jobject geo,
jint geo_type,
@@ -3414,10 +3233,10 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeometry(
if (vformat & GA_TEXTURE_COORDINATE) {
- executeTexture(-1, texCoordSetMapLen,
+ executeTexture(texCoordSetMapLen,
texSize, bstride, texCoordoff,
texCoordSetMapOffset,
- texCoordSetMapLen, NULL,
+ texCoordSetMapLen,
verts, ctxInfo);
}
@@ -3536,10 +3355,10 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeometry(
}
if (vformat & GA_TEXTURE_COORDINATE) {
- executeTexture(-1, texCoordSetMapLen,
+ executeTexture(texCoordSetMapLen,
texSize, bstride, texCoordoff,
texCoordSetMapOffset,
- texCoordSetMapLen, NULL,
+ texCoordSetMapLen,
verts, ctxInfo);
}
@@ -3607,7 +3426,7 @@ Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeometry(
* Method: buildGAForByRef
* Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZFZIIII[F[DI[F[BI[FI[I[I[[FI[I[II[Ljava/lang/Object;[D[D)V
*/
-JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRef(
+JNIEXPORT void JNICALL Java_javax_media_j3d_NativePipeline_buildGAForByRef(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -3665,7 +3484,6 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRe
jfloat **vertexAttrPointer = NULL;
jfloat **texCoordPointer = NULL;
jarray *texobjs = NULL;
- jint *tunitstatemap = NULL;
int offset = 0;
jboolean floatCoordDefined = ((vdefined & javax_media_j3d_GeometryArrayRetained_COORD_FLOAT) != 0);
@@ -3741,14 +3559,11 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRe
/* get texture arrays */
if (textureDefined) {
- tunitstatemap = (int *)malloc(texCoordMapLength * sizeof(int));
for (i = 0; i < texCoordMapLength; i++) {
- tunitstatemap[i] = i;
if (texobjs[i] != NULL)
texCoordPointer[i] = (jfloat*)(*(table->GetPrimitiveArrayCritical))(env,texobjs[i], NULL);
else
- texCoordPointer[i] = NULL;
-
+ texCoordPointer[i] = NULL;
}
}
@@ -3917,17 +3732,14 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRe
fprintf(stderr, "GeometryArrayRetained.buildGAForByRef() -- calling executeGeometryArrayVA\n");
#endif /* VERBOSE */
- executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type,
- isNonUniformScale, JNI_FALSE, ignoreVertexColors,
- vcount, vformat, vdefined, initialCoordIndex,
- fvptr, dvptr, initialColorIndex,
+ executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type, isNonUniformScale,
+ ignoreVertexColors, vcount, vformat, vdefined,
+ initialCoordIndex, fvptr, dvptr, initialColorIndex,
fcptr, bcptr, initialNormalIndex,
- nptr,
- vertexAttrCount, vertexAttrSizes,
- vertexAttrIndices, vertexAttrPointer,
- -1, texCoordMapLength,
- tcoordsetmap, texCoordMapLength, tunitstatemap,
- texindices,texStride,texCoordPointer,0, sarray,
+ nptr, vertexAttrCount, vertexAttrSizes,
+ vertexAttrIndices, vertexAttrPointer, texCoordMapLength,
+ tcoordsetmap, texCoordMapLength,
+ texindices, texStride, texCoordPointer, 0, sarray,
strip_len, start_array);
if (vattrDefined) {
@@ -3944,9 +3756,6 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRe
}
if (textureDefined) {
- if (tunitstatemap != NULL) {
- free(tunitstatemap);
- }
for (i = 0; i < texCoordMapLength; i++) {
if (texCoordPointer[i] != NULL) {
(*(table->ReleasePrimitiveArrayCritical))(env, texobjs[i], texCoordPointer[i], 0);
@@ -3992,7 +3801,7 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRe
else if (doubleCoordDefined) {
(*env)->ReleasePrimitiveArrayCritical(env, vdcoords, dverts, 0);
if (tmpDoubleCoordArray != NULL) {
- free(tmpFloatCoordArray);
+ free(tmpDoubleCoordArray);
}
}
}
@@ -4002,7 +3811,7 @@ JNIEXPORT void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRe
#if 0
/* execute geometry array with java array format */
JNIEXPORT
-void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer(
+void JNICALL Java_javax_media_j3d_NativePipeline_buildGAForBuffer(
JNIEnv *env,
jobject obj,
jlong ctxInfo,
@@ -4052,7 +3861,6 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer(
jbyte* bcptr = NULL;
jfloat **texCoordPointer = NULL;
jarray *texobjs = NULL;
- jint *tunitstatemap = NULL;
jboolean floatCoordDefined = ((vdefined & javax_media_j3d_GeometryArrayRetained_COORD_FLOAT) != 0);
jboolean doubleCoordDefined = ((vdefined & javax_media_j3d_GeometryArrayRetained_COORD_DOUBLE) != 0);
jboolean floatColorsDefined = ((vdefined & javax_media_j3d_GeometryArrayRetained_COLOR_FLOAT) != 0);
@@ -4110,9 +3918,7 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer(
}
/* get texture arrays */
if (textureDefined) {
- tunitstatemap = (int *)malloc( texCoordMapLength * sizeof(int));
for (i = 0; i < texCoordMapLength; i++) {
- tunitstatemap[i] = i;
if (texobjs[i] != NULL)
texCoordPointer[i] = (jfloat*)(*(table->GetPrimitiveArrayCritical))(env,texobjs[i], NULL);
else
@@ -4287,20 +4093,17 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer(
#endif /* VERBOSE */
executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type,
- isNonUniformScale, JNI_FALSE, ignoreVertexColors,
+ isNonUniformScale, ignoreVertexColors,
vcount, vformat, vdefined, initialCoordIndex,
fvptr, dvptr, initialColorIndex,
fcptr, bcptr, initialNormalIndex,
nptr,
/* TODO: vertexAttrCount, vertexAttrSizes, */
/* TODO: vertexAttrIndices, vertexAttrPointer, */
- -1, texCoordMapLength,
- tcoordsetmap, texCoordMapLength, tunitstatemap,
+ texCoordMapLength,
+ tcoordsetmap, texCoordMapLength,
texindices,texStride,texCoordPointer,0, sarray, strip_len, start_array);
if (textureDefined) {
- if (tunitstatemap != NULL) {
- free(tunitstatemap);
- }
for (i = 0; i < texCoordMapLength; i++) {
if (texCoordPointer[i] != NULL) {
(*(table->ReleasePrimitiveArrayCritical))(env, texobjs[i], texCoordPointer[i], 0);
diff --git a/src/native/ogl/GraphicsContext3D.c b/src/native/ogl/GraphicsContext3D.c
index da656a6..50f73bf 100644
--- a/src/native/ogl/GraphicsContext3D.c
+++ b/src/native/ogl/GraphicsContext3D.c
@@ -17,21 +17,163 @@
extern void throwAssert(JNIEnv *env, char *str);
+JNIEXPORT
+void JNICALL Java_javax_media_j3d_NativePipeline_readRaster(
+ JNIEnv *env, jobject obj, jlong ctx,
+ jint type, jint xOffset, jint yOffset,
+ jint wRaster, jint hRaster, jint hCanvas,
+ jint imageDataType,
+ jint imageFormat, jobject imageBuffer,
+ jint depthFormat, jobject depthBuffer)
+{
+ JNIEnv table;
+ int yAdjusted;
+ GLenum oglFormat;
+ void *imageObjPtr;
+ void *depthObjPtr;
+
+ GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctx;
+
+ table = *env;
+
+ glPixelStorei(GL_PACK_ROW_LENGTH, wRaster);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ yAdjusted = hCanvas - hRaster - yOffset;
+
+ if ((type & javax_media_j3d_Raster_RASTER_COLOR) != 0) {
+
+ imageObjPtr =
+ (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)imageBuffer, NULL);
+
+ if(imageDataType == IMAGE_DATA_TYPE_BYTE_ARRAY) {
+
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_BYTE_BGR:
+ oglFormat = GL_BGR;
+ break;
+ case IMAGE_FORMAT_BYTE_RGB:
+ oglFormat = GL_RGB;
+ break;
+ /* GL_ABGR_EXT */
+ case IMAGE_FORMAT_BYTE_ABGR:
+ if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
+ oglFormat = GL_ABGR_EXT;
+ }
+ else {
+ throwAssert(env, "readRaster : GL_ABGR_EXT format is unsupported");
+ return;
+ }
+ break;
+ case IMAGE_FORMAT_BYTE_RGBA:
+ oglFormat = GL_RGBA;
+ break;
+ case IMAGE_FORMAT_BYTE_LA:
+ /* all LA types are stored as LA8 */
+ oglFormat = GL_LUMINANCE_ALPHA;
+ break;
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_INT_BGR:
+ case IMAGE_FORMAT_INT_RGB:
+ case IMAGE_FORMAT_INT_ARGB:
+ default:
+ throwAssert(env, "readRaster : imageFormat illegal format");
+ return;
+ }
+
+ glReadPixels(xOffset, yAdjusted, wRaster, hRaster,
+ oglFormat, GL_UNSIGNED_BYTE, imageObjPtr);
+
+ }
+ else if(imageDataType == IMAGE_DATA_TYPE_INT_ARRAY) {
+ GLenum intType = GL_UNSIGNED_INT_8_8_8_8;
+ GLboolean forceAlphaToOne = GL_FALSE;
+
+ switch (imageFormat) {
+ /* GL_BGR */
+ case IMAGE_FORMAT_INT_BGR: /* Assume XBGR format */
+ oglFormat = GL_RGBA;
+ intType = GL_UNSIGNED_INT_8_8_8_8_REV;
+ forceAlphaToOne = GL_TRUE;
+ break;
+ case IMAGE_FORMAT_INT_RGB: /* Assume XRGB format */
+ forceAlphaToOne = GL_TRUE;
+ /* Fall through to next case */
+ case IMAGE_FORMAT_INT_ARGB:
+ oglFormat = GL_BGRA;
+ intType = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ /* This method only supports 3 and 4 components formats and INT types. */
+ case IMAGE_FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_BGR:
+ case IMAGE_FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_ABGR:
+ default:
+ throwAssert(env, "readRaster : imageFormat illegal format");
+ return;
+ }
+
+ /* Force Alpha to 1.0 if needed */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
+ }
+
+ glReadPixels(xOffset, yAdjusted, wRaster, hRaster,
+ oglFormat, intType, imageObjPtr);
+
+ /* Restore Alpha scale and bias */
+ if(forceAlphaToOne) {
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+ glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
+ }
+ }
+ else {
+ throwAssert(env, "readRaster : illegal image data type");
+ return;
+ }
+
+ (*(table->ReleasePrimitiveArrayCritical))(env, imageBuffer, imageObjPtr, 0);
+ }
+
+ if ((type & javax_media_j3d_Raster_RASTER_DEPTH) != 0) {
+ GLenum depthType = 0;
+ depthObjPtr =
+ (void *)(*(table->GetPrimitiveArrayCritical))(env, (jarray)depthBuffer, NULL);
+
+ if (depthFormat == javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_INT) {
+ depthType = GL_UNSIGNED_INT;
+ } else { /* javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_FLOAT */
+ depthType = GL_FLOAT;
+ }
+
+ /* yOffset is adjusted for OpenGL - Y upward */
+ glReadPixels(xOffset, yAdjusted, wRaster, hRaster,
+ GL_DEPTH_COMPONENT, depthType , depthObjPtr);
+
+ (*(table->ReleasePrimitiveArrayCritical))(env, depthBuffer, depthObjPtr, 0);
+ }
+
+}
+
JNIEXPORT
-void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative(
- JNIEnv *env, jobject obj, jlong ctxInfo,
+void JNICALL Java_javax_media_j3d_NativePipeline_readRasterNative(
+ JNIEnv *env, jobject obj, jlong ctx,
jint type, jint xOffset, jint yOffset,
jint wRaster, jint hRaster, jint hCanvas,
- jint format, jobject image, jobject depth, jobject ctx)
-{
+ jint format, jobject image, jobject depth, jobject gc)
+{
JNIEnv table;
int yAdjusted;
- jclass ctx_class;
+ jclass gc_class;
GLenum gltype;
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong d3dctx = ctxProperties->context;
+ GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctx;
table = *env;
@@ -39,7 +181,7 @@ void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative(
glPixelStorei(GL_PACK_ALIGNMENT, 1);
yAdjusted = hCanvas - hRaster - yOffset;
- ctx_class = (jclass) (*(table->GetObjectClass))(env, ctx);
+ gc_class = (jclass) (*(table->GetObjectClass))(env, gc);
if ((type & javax_media_j3d_Raster_RASTER_COLOR) != 0) {
@@ -50,8 +192,8 @@ void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative(
jbyte *byteData;
byteData_field = (jfieldID)(*(table->GetFieldID))(env,
- ctx_class, "byteBuffer","[B");
- byteData_array = (jarray)(*(table->GetObjectField))(env, ctx,
+ gc_class, "byteBuffer","[B");
+ byteData_array = (jarray)(*(table->GetObjectField))(env, gc,
byteData_field);
image_class = (jclass) (*(table->GetObjectClass))(env, image);
@@ -61,30 +203,28 @@ void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative(
}
switch (format) {
- case FORMAT_BYTE_RGBA:
+ case IMAGE_FORMAT_BYTE_RGBA:
gltype = GL_RGBA;
break;
- case FORMAT_BYTE_RGB:
+ case IMAGE_FORMAT_BYTE_RGB:
gltype = GL_RGB;
break;
- case FORMAT_BYTE_ABGR:
+ case IMAGE_FORMAT_BYTE_ABGR:
if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
gltype = GL_ABGR_EXT;
}
break;
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- gltype = ctxProperties->bgr_ext_enum;
- }
+ case IMAGE_FORMAT_BYTE_BGR:
+ gltype = GL_BGR;
break;
- case FORMAT_BYTE_LA:
+ case IMAGE_FORMAT_BYTE_LA:
gltype = GL_LUMINANCE_ALPHA;
break;
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
+ case IMAGE_FORMAT_BYTE_GRAY:
+ case IMAGE_FORMAT_USHORT_GRAY:
default:
throwAssert(env, "illegal format");
break;
@@ -139,8 +279,8 @@ void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative(
jint *intData;
intData_field = (jfieldID)(*(table->GetFieldID))(env,
- ctx_class, "intBuffer","[I");
- intData_array = (jarray)(*(table->GetObjectField))(env, ctx,
+ gc_class, "intBuffer","[I");
+ intData_array = (jarray)(*(table->GetObjectField))(env, gc,
intData_field);
intData = (jint *)(*(table->GetPrimitiveArrayCritical))(env,
@@ -158,8 +298,8 @@ void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative(
jfloat *floatData;
floatData_field = (jfieldID)(*(table->GetFieldID))(env,
- ctx_class, "floatBuffer","[F");
- floatData_array = (jarray)(*(table->GetObjectField))(env, ctx,
+ gc_class, "floatBuffer","[F");
+ floatData_array = (jarray)(*(table->GetObjectField))(env, gc,
floatData_field);
floatData = (jfloat *)(*(table->GetPrimitiveArrayCritical))(env,
floatData_array, NULL);
diff --git a/src/native/ogl/Lights.c b/src/native/ogl/Lights.c
index db0c54f..2acece8 100644
--- a/src/native/ogl/Lights.c
+++ b/src/native/ogl/Lights.c
@@ -27,9 +27,9 @@
const float black[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
JNIEXPORT
-void JNICALL Java_javax_media_j3d_DirectionalLightRetained_updateLight(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateDirectionalLight(
JNIEnv *env,
- jobject light,
+ jobject obj,
jlong ctxInfo,
jint lightSlot,
jfloat red,
@@ -70,9 +70,9 @@ void JNICALL Java_javax_media_j3d_DirectionalLightRetained_updateLight(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_PointLightRetained_updateLight(
+void JNICALL Java_javax_media_j3d_NativePipeline_updatePointLight(
JNIEnv *env,
- jobject light,
+ jobject obj,
jlong ctxInfo,
jint lightSlot,
jfloat red,
@@ -114,9 +114,9 @@ void JNICALL Java_javax_media_j3d_PointLightRetained_updateLight(
}
JNIEXPORT
-void JNICALL Java_javax_media_j3d_SpotLightRetained_updateLight(
+void JNICALL Java_javax_media_j3d_NativePipeline_updateSpotLight(
JNIEnv *env,
- jobject light,
+ jobject obj,
jlong ctxInfo,
jint lightSlot,
jfloat red,
diff --git a/src/native/ogl/MasterControl.c b/src/native/ogl/MasterControl.c
index 2ca2b08..027b640 100644
--- a/src/native/ogl/MasterControl.c
+++ b/src/native/ogl/MasterControl.c
@@ -72,7 +72,7 @@ extern int isExtensionSupported(const char *allExtensions,
const char *extension);
JNIEXPORT jboolean JNICALL
-Java_javax_media_j3d_MasterControl_initializeJ3D(
+Java_javax_media_j3d_NativePipeline_initializeJ3D(
JNIEnv *env, jobject obj, jboolean disableXinerama)
{
jboolean glIsMTSafe = JNI_TRUE;
@@ -164,84 +164,8 @@ DWORD countBits(DWORD mask)
#endif /* WIN32 */
-/*
- * Class: javax_media_j3d_MasterControl
- * Method: getNumberOfProcessor
- * Signature: ()I
- *
- * This function get the number of active processor in the system
- */
-JNIEXPORT jint JNICALL Java_javax_media_j3d_MasterControl_getNumberOfProcessor
- (JNIEnv *env, jobject obj)
-{
-#if defined(UNIX)
- return sysconf(_SC_NPROCESSORS_ONLN);
-#endif /* UNIX_ */
-
-#ifdef WIN32
- SYSTEM_INFO sysInfo;
-
- GetSystemInfo(&sysInfo);
- return countBits(sysInfo.dwActiveProcessorMask);
-#endif /* WIN32 */
-}
-
-
-/*
- * Class: javax_media_j3d_MasterControl
- * Method: getThreadConcurrency
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL
-Java_javax_media_j3d_MasterControl_getThreadConcurrency(JNIEnv *env,
- jobject obj)
-{
- /*
- * Return the number of concurrent threads that can be run,
- * -1 if unknown.
- */
-
-#ifdef SOLARIS
- return (jint) thr_getconcurrency();
-#endif /* SOLARIS */
-
-#ifdef LINUX
- return -1;
-#endif /* LINUX */
-
-#ifdef WIN32
- return -1;
-#endif /* WIN32 */
-}
-
-
-/*
- * Class: javax_media_j3d_MasterControl
- * Method: setThreadConcurrency
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_javax_media_j3d_MasterControl_setThreadConcurrency(JNIEnv *env,
- jobject obj,
- jint newLevel)
-{
-#ifdef SOLARIS
- thr_setconcurrency((int)newLevel);
-#endif /* SOLARIS */
-
-#ifdef WIN32
- /* No-op on windows */
-#endif /* WIN32 */
-
-#ifdef LINUX
- /* No-op on linux */
-#endif /* LINUX */
-}
-
-
-
JNIEXPORT
-jint JNICALL Java_javax_media_j3d_MasterControl_getMaximumLights(
+jint JNICALL Java_javax_media_j3d_NativePipeline_getMaximumLights(
JNIEnv *env,
jobject obj
) {
@@ -258,86 +182,3 @@ jint JNICALL Java_javax_media_j3d_MasterControl_getMaximumLights(
return 8;
#endif /* LINUX */
}
-
-
-/* ======================================================================= */
-
-/*
- * The following method implements a high-resolution timer (based on the
- * native code in the J3DTimer class). It will no longer be needed once
- * we drop support for JDK 1.4.2, at which time it will be replaced by
- * a call to System.nanoTime().
- */
-
-#define NSEC_PER_SEC ((jlong)1000000000)
-
-#ifdef __linux__
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#endif
-
-#ifdef SOLARIS
-#include <time.h>
-#include <sys/systeminfo.h>
-#include <string.h>
-#ifndef CLOCK_HIGHRES
-#define CLOCK_HIGHRES 4 /* Solaris 7 does not define this */
-#endif /* constant. When run on Solaris 7 */
-#endif /* CLOCK_HIGHRES is not used. */
-
-#ifdef WIN32
-#include <Windows.h>
-#include <math.h>
-static double timerScale = -1.0;
-#endif
-
-/*
- * Class: javax_media_j3d_MasterControl
- * Method: getNativeTimerValue
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL
-Java_javax_media_j3d_MasterControl_getNativeTimerValue(JNIEnv *env, jclass clazz)
-{
- jlong timerNsec;
-
-#ifdef SOLARIS
- /*
- struct timespec tp;
- clock_gettime( CLOCK_HIGHRES, &tp );
-
- return (jlong)tp.tv_nsec + (jlong)tp.tv_sec * NSEC_PER_SEC;
- */
-
- timerNsec = (jlong)gethrtime();
-#endif /* SOLARIS */
-
-#ifdef WIN32
- LARGE_INTEGER time;
- LARGE_INTEGER freq;
-
- if (timerScale < 0.0) {
- QueryPerformanceFrequency( &freq );
- if (freq.QuadPart <= 0) {
- timerScale = 0.0;
- }
- else {
- timerScale = (double) NSEC_PER_SEC / (double)freq.QuadPart;
- }
- }
-
- QueryPerformanceCounter(&time);
- timerNsec = (jlong)((double)time.QuadPart * timerScale);
-
-#endif /* WIN32 */
-
-#ifdef __linux__
- struct timeval t;
-
- gettimeofday(&t, 0);
- timerNsec = ((jlong)t.tv_sec) * NSEC_PER_SEC + ((jlong)t.tv_usec) * ((jlong)1000);
-#endif /* __linux__ */
-
- return timerNsec;
-}
diff --git a/src/native/ogl/NativeAPIInfo.c b/src/native/ogl/NativeAPIInfo.c
deleted file mode 100644
index 47dff76..0000000
--- a/src/native/ogl/NativeAPIInfo.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-/*
- * Portions of this code were derived from work done by the Blackdown
- * group (www.blackdown.org), who did the initial Linux implementation
- * of the Java 3D API.
- */
-
-#include <jni.h>
-
-#include "javax_media_j3d_MasterControl.h"
-#include "javax_media_j3d_NativeAPIInfo.h"
-
-JNIEXPORT
-jint JNICALL Java_javax_media_j3d_NativeAPIInfo_getRenderingAPI(
- JNIEnv *env, jobject obj)
-{
-#ifdef WIN32
- return (jint)javax_media_j3d_MasterControl_RENDER_OPENGL_WIN32;
-#endif /* WIN32 */
-
-#ifdef SOLARIS
- return (jint)javax_media_j3d_MasterControl_RENDER_OPENGL_SOLARIS;
-#endif /* SOLARIS */
-
-#ifdef LINUX
- return (jint)javax_media_j3d_MasterControl_RENDER_OPENGL_LINUX;
-#endif /* LINUX */
-}
diff --git a/src/native/ogl/NativeConfigTemplate3D.c b/src/native/ogl/NativeConfigTemplate3D.c
index 9241c05..2d7ace7 100644
--- a/src/native/ogl/NativeConfigTemplate3D.c
+++ b/src/native/ogl/NativeConfigTemplate3D.c
@@ -617,23 +617,6 @@ jboolean JNICALL Java_javax_media_j3d_NativeConfigTemplate3D_isSceneAntialiasing
return JNI_FALSE;
}
-
-
-JNIEXPORT
-jboolean JNICALL Java_javax_media_j3d_J3dGraphicsConfig_isValidVisualID(
- JNIEnv *env,
- jclass cls,
- jlong display,
- jint vid)
-{
- XVisualInfo template;
- int nitems;
-
- template.visualid = vid;
- XGetVisualInfo((Display *)display, VisualIDMask, &template, &nitems);
- return (nitems == 1);
-
-}
#endif /* UNIX_ */
diff --git a/src/native/ogl/NativeWSInfo.c b/src/native/ogl/NativeWSInfo.c
deleted file mode 100644
index aa44776..0000000
--- a/src/native/ogl/NativeWSInfo.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-/*
- * Portions of this code were derived from work done by the Blackdown
- * group (www.blackdown.org), who did the initial Linux implementation
- * of the Java 3D API.
- */
-
-#include <jni.h>
-#include <math.h>
-
-#include "gldefs.h"
-
-#if defined(UNIX)
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#endif
-
-#ifdef WIN32
-#include <windows.h>
-#endif
-
-#ifdef WIN32
-
-/*
- * Workaround for bug 4169320: Resizing a Java 3D canvas
- * on Win95 crashes the application
- */
-
-#ifdef STRICT
-static WNDPROC g_lpDefWindowProc;
-#else
-static FARPROC g_lpDefWindowProc;
-#endif
-
-static
-LRESULT CALLBACK canvas3dWndProc(
- HWND hWnd,
- UINT message,
- WPARAM wParam,
- LPARAM lParam)
-{
- switch (message) {
- case WM_WINDOWPOSCHANGED:
- return 0;
- default:
- return CallWindowProc(g_lpDefWindowProc, hWnd, message,
- wParam, lParam);
- }
-}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_NativeWSInfo_subclass(
- JNIEnv * env,
- jobject obj,
- jint hWnd)
-{
-#ifdef STRICT
- g_lpDefWindowProc = (WNDPROC) SetWindowLong((HWND) hWnd, GWL_WNDPROC,
- (LONG) canvas3dWndProc);
-#else
- g_lpDefWindowProc = (FARPROC) SetWindowLong((HWND) hWnd, GWL_WNDPROC,
- (LONG) canvas3dWndProc);
-#endif
-}
-
-#endif
diff --git a/src/native/ogl/RasterRetained.c b/src/native/ogl/RasterRetained.c
deleted file mode 100644
index 2f54146..0000000
--- a/src/native/ogl/RasterRetained.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * $RCSfile$
- *
- * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * $Revision$
- * $Date$
- * $State$
- */
-
-#include <stdio.h>
-#include <jni.h>
-
-#include "gldefs.h"
-
-#ifdef DEBUG
-/* Uncomment the following for VERBOSE debug messages */
-/* #define VERBOSE */
-#endif /* DEBUG */
-
-
-extern void throwAssert(JNIEnv *env, char *str);
-
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_RasterRetained_execute(JNIEnv *env,
- jobject obj, jlong ctxInfo, jobject geo,
- jboolean updateAlpha, jfloat alpha,
- jint type, jint w_raster, jint h_raster,
- jint x_offset, jint y_offset, jfloat x, jfloat y, jfloat z, jbyteArray imageYdown)
-
-
-{
- jclass geo_class;
- JNIEnv table;
-
- jfieldID w_field, h_field;
- int width, height;
-
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong ctx = ctxProperties->context;
-
- table = *env;
-
- geo_class = (jclass) (*(table->GetObjectClass))(env, geo);
-
-#ifdef VERBOSE
- fprintf(stderr,
- "x %g ,y %g ,z %g ,w_raster %d,h_raster %d, x_offset %d, y_offset %d\n",
- x,y,z,w_raster,h_raster,x_offset,y_offset);
-#endif
-
- if ((type == javax_media_j3d_Raster_RASTER_COLOR) ||
- (type == javax_media_j3d_Raster_RASTER_COLOR_DEPTH)) {
- jobject image;
- jclass image_class;
- jfieldID image_field, format_field;
- jbyte *byteData;
- int format;
- int glformat;
-
- image_field = (jfieldID)(*(table->GetFieldID))(env, geo_class,
- "image","Ljavax/media/j3d/ImageComponent2DRetained;");
- image = (jobject) (*(table->GetObjectField))(env, geo, image_field);
-
- if (image == NULL) {
- return;
- }
- image_class = (jclass) (*(table->GetObjectClass))(env, image);
-
- format_field = (jfieldID) (*(table->GetFieldID))(env, image_class,
- "storedYdownFormat", "I");
- format = (jint)(*(table->GetIntField))(env, image, format_field);
- w_field = (jfieldID) (*(table->GetFieldID))(env, image_class,
- "width", "I");
- width = (jint)(*(table->GetIntField))(env, image, w_field);
- h_field = (jfieldID)(*(table->GetFieldID))(env, image_class,
- "height", "I");
- height = (jint)(*(table->GetIntField))(env, image, h_field);
-
-
- /*
- * raster position is upper left corner, default for Java3D
- * ImageComponent currently has the data reverse in Y
- */
- glPixelZoom(1.0, -1.0);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
- if (x_offset >= 0) {
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x_offset);
- if (x_offset + w_raster > width) {
- w_raster = width - x_offset;
- }
- } else {
- w_raster += x_offset;
- if (w_raster > width) {
- w_raster = width;
- }
- }
- if (y_offset >= 0) {
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y_offset);
- if (y_offset + h_raster > height) {
- h_raster = height - y_offset;
- }
- } else {
- h_raster += y_offset;
- if (h_raster > height) {
- h_raster = height;
- }
- }
-
-
-
- glRasterPos3f(x, y, z);
-
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- imageYdown, NULL);
-
-/*
- {
- int i, j, *intData;
-
- fprintf(stderr, "format = %d, w_raster = %d, h_raster = %d\n\n", format, w_raster, h_raster);
- intData = (int*)byteData;
- for (i = 0; i < w_raster; i++) {
- for (j = 0; j < h_raster; j++, intData++) {
- fprintf(stderr, " 0x%x", *intData);
- }
- fprintf(stderr, "\n");
- }
- }
- */
- switch (format) {
- case FORMAT_BYTE_RGBA:
- glformat = GL_RGBA;
- break;
- case FORMAT_BYTE_RGB:
- glformat = GL_RGB;
- break;
-
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- glformat = GL_ABGR_EXT;
- }
- break;
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- glformat = ctxProperties->bgr_ext_enum;
- }
- break;
- case FORMAT_BYTE_LA:
- glformat = GL_LUMINANCE_ALPHA;
- break;
-
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- default:
- throwAssert(env, "illegal format");
- break;
- }
- glDrawPixels(w_raster, h_raster, glformat, GL_UNSIGNED_BYTE,
- byteData);
-
- (*(table->ReleasePrimitiveArrayCritical))(env,
- imageYdown, byteData, 0);
- }
-
- if ((type == javax_media_j3d_Raster_RASTER_DEPTH) ||
- (type == javax_media_j3d_Raster_RASTER_COLOR_DEPTH)) {
- GLint draw_buf;
- jobject depth;
- jclass depth_class;
- jfieldID depth_field, depth_type_field;
- int depth_type;
-
- depth_field = (jfieldID)(*(table->GetFieldID))(env, geo_class,
- "depthComponent","Ljavax/media/j3d/DepthComponentRetained;");
-
- depth = (jobject) (*(table->GetObjectField))(env, geo, depth_field);
- if (depth == NULL) {
- return;
- }
- depth_class = (jclass) (*(table->GetObjectClass))(env, depth);
-
- depth_type_field = (jfieldID) (*(table->GetFieldID))(env,
- depth_class, "type", "I");
- depth_type = (jint)(*(table->GetIntField))(env, depth,
- depth_type_field);
-
- w_field = (jfieldID) (*(table->GetFieldID))(env, depth_class,
- "width", "I");
- width = (jint)(*(table->GetIntField))(env, depth, w_field);
- h_field = (jfieldID)(*(table->GetFieldID))(env, depth_class,
- "height", "I");
- height = (jint)(*(table->GetIntField))(env, depth, h_field);
-
-
- glGetIntegerv(GL_DRAW_BUFFER, &draw_buf);
- /* disable draw buffer */
- glDrawBuffer(GL_NONE);
- /* glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); */
-
- /*
- * raster position is upper left corner, default for Java3D
- * ImageComponent currently has the data reverse in Y
- */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
- if (x_offset >= 0) {
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x_offset);
- if (x_offset + w_raster > width) {
- w_raster = width - x_offset;
- }
- } else {
- w_raster += x_offset;
- if (w_raster > width) {
- w_raster = width;
- }
- }
- if (y_offset >= 0) {
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y_offset);
- if (y_offset + h_raster > height) {
- h_raster = height - y_offset;
- }
- } else {
- h_raster += y_offset;
- if (h_raster > height) {
- h_raster = height;
- }
- }
-
-
- if (depth_type == javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_INT) {
- jfieldID intData_field;
- jintArray intData_array;
- jint *intData;
-
- intData_field = (jfieldID)(*(table->GetFieldID))(env,
- depth_class, "depthData","[I");
-
- intData_array = (jintArray)(*(table->GetObjectField))(env, depth,
- intData_field);
- intData = (jint *)(*(table->GetPrimitiveArrayCritical))(env,
- intData_array, NULL);
- glDrawPixels(w_raster, h_raster, GL_DEPTH_COMPONENT,
- GL_UNSIGNED_INT, intData);
- (*(table->ReleasePrimitiveArrayCritical))(env, intData_array,
- intData, 0);
- } else { /* javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_FLOAT */
- jfieldID floatData_field;
- jfloatArray floatData_array;
- jfloat *floatData;
-
- floatData_field = (jfieldID)(*(table->GetFieldID))(env,
- depth_class, "depthData","[F");
- floatData_array = (jfloatArray)(*(table->GetObjectField))(env, depth,
- floatData_field);
- floatData = (jfloat *)(*(table->GetPrimitiveArrayCritical))(env,
- floatData_array, NULL);
- glDrawPixels(w_raster, h_raster, GL_DEPTH_COMPONENT,
- GL_FLOAT, floatData);
- (*(table->ReleasePrimitiveArrayCritical))(env, floatData_array,
- floatData, 0);
- }
-
- /* re-enable draw buffer */
- glDrawBuffer(draw_buf);
-
- }
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
-
-}
-
-
-#if 0
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_RasterRetained_executeTiled(JNIEnv *env,
- jobject obj, jlong ctxInfo, jobject geo,
- jint format, jint w_raster, jint h_raster,
- jint x_offset, jint y_offset, jint deltaw, jint deltah, jfloat x, jfloat y, jfloat z, jbyteArray tile)
-
-
-{
- jclass geo_class;
- JNIEnv table;
- jint j;
- int alphaChanged = 0; /* used so we can get alpha data from */
- /* JNI before using it so we can use */
- /* GetPrimitiveArrayCritical */
- jobject image;
- jclass image_class;
- jfieldID byteData_field, image_field, format_field;
- jbyteArray byteData_array;
- jbyte *byteData;
- int glformat;
- float rasterPos[3];
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo;
- jlong ctx = ctxProperties->context;
-
- table = *env;
-
-
-#ifdef VERBOSE
- fprintf(stderr,
- "x %g ,y %g ,z %g ,w_raster %d,h_raster %d, x_offset %d, y_offset %d\n",
- x,y,z,w_raster,h_raster,x_offset,y_offset);
-#endif
-
-
- /*
- * raster position is upper left corner, default for Java3D
- * ImageComponent currently has the data reverse in Y
- */
- glPixelZoom(1.0, -1.0);
- /* glPixelStorei(GL_UNPACK_ROW_LENGTH, width);*/
- if (x_offset >= 0) {
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x_offset);
- if (x_offset + w_raster > width) {
- w_raster = width - x_offset;
- }
- } else {
- w_raster += x_offset;
- if (w_raster > width) {
- w_raster = width;
- }
- }
- if (y_offset >= 0) {
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y_offset);
- if (y_offset + h_raster > height) {
- h_raster = height - y_offset;
- }
- } else {
- h_raster += y_offset;
- if (h_raster > height) {
- h_raster = height;
- }
- }
-
- if (deltaw == 0 && deltah == 0) {
- glRasterPos3f(x, y, z);
- }
- else {
- glGetFloatv(GL_CURRENT_RASTER_POSITION,rasterPos);
- rasterPos[0] += (float)deltaw;
- rasterPos[1] += (float)deltah;
- glRasterPos3f(rasterPos[0], rasterPos[1], rasterPos[2]);
- }
-
-
-
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- tile, NULL);
- switch (format) {
- case FORMAT_BYTE_RGBA:
- glformat = GL_RGBA;
- break;
- case FORMAT_BYTE_RGB:
- glformat = GL_RGB;
- break;
-
- case FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- glformat = GL_ABGR_EXT;
- }
- break;
-
-
- case FORMAT_BYTE_BGR:
- if (ctxProperties->bgr_ext) { /* If its zero, should never come here! */
- glformat = ctxProperties->bgr_ext_enum;
- }
- break;
-
- case FORMAT_BYTE_LA:
- glformat = GL_LUMINANCE_ALPHA;
- break;
- case FORMAT_BYTE_GRAY:
- case FORMAT_USHORT_GRAY:
- default:
- throwAssert(env, "illegal format");
- break;
- }
- fprintf(stderr, "w_raster = %d, h_raster = %d, glformat = %d\n",w_raster, h_raster, glformat);
- glDrawPixels(w_raster, h_raster, glformat, GL_UNSIGNED_BYTE,
- byteData);
-
- (*(table->ReleasePrimitiveArrayCritical))(env,
- tile, byteData, 0);
-
- /* glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);*/
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
-
-}
-#endif
diff --git a/src/native/ogl/build-linux-amd64.xml b/src/native/ogl/build-linux-amd64.xml
index 9510591..c4a1e1a 100644
--- a/src/native/ogl/build-linux-amd64.xml
+++ b/src/native/ogl/build-linux-amd64.xml
@@ -38,12 +38,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-m64 -march=k8 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-m64 -march=k8 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib64 -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/amd64 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/X11R6/lib64 -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/amd64 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
</target>
diff --git a/src/native/ogl/build-linux-i586.xml b/src/native/ogl/build-linux-i586.xml
index d47b155..a1d8c9f 100644
--- a/src/native/ogl/build-linux-i586.xml
+++ b/src/native/ogl/build-linux-i586.xml
@@ -38,12 +38,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-w -m32 -mcpu=i386 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-w -m32 -mcpu=i386 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
</target>
diff --git a/src/native/ogl/build-linux-ia64.xml b/src/native/ogl/build-linux-ia64.xml
index 28c924d..12903b5 100644
--- a/src/native/ogl/build-linux-ia64.xml
+++ b/src/native/ogl/build-linux-ia64.xml
@@ -35,15 +35,16 @@
<!-- Compile the c source files; based on build-linux-amd64.xml-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file; based on build-linux-amd64.xml-->
<!-- Must use gcc to link, not ld, hence also need -shared; refer to http://www.gelato.unsw.edu.au/linux-ia64/0006/0212.html -->
<!-- Removed -R/usr/openwin/lib - an ld specific option (should be a filename, not a dir?!?) -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -shared -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/ia64 -ljawt -L${java.home}/lib/ia64/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -shared -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/ia64 -ljawt -L${java.home}/lib/ia64/jrockit -ljvm -o libj3dcore-ogl.so"/>
</exec>
+<!-- -L${java.home}/lib/ia64/server -ljvm -o libj3dcore-ogl.so"/> -->
<!-- Copy the copyright library file -->
<copy file="${build}/${platform}/${bldType}/native/ogl/objs/libj3dcore-ogl.so"
diff --git a/src/native/ogl/build-linux-ppc.xml b/src/native/ogl/build-linux-ppc.xml
index 8cea9f6..daef73b 100644
--- a/src/native/ogl/build-linux-ppc.xml
+++ b/src/native/ogl/build-linux-ppc.xml
@@ -13,7 +13,7 @@
*/
-->
-<!-- Ant file for building native ogl renderer files for Solaris -->
+<!-- Ant file for building native ogl renderer files for Linux PPC -->
<project name="Java 3D" default="compile">
<target name="compile">
@@ -36,12 +36,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-w -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I/usr/X11R6/include -I${javahCoreTarget} ${bldFlag} -DLINUX -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/CompressedGeometryRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-w -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I/usr/X11R6/include -I${javahCoreTarget} ${bldFlag} -DLINUX -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o CompressedGeometryRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/bin -ljawt -L${java.home}/bin/classic -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/bin -ljawt -L${java.home}/bin/classic -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
diff --git a/src/native/ogl/build-solaris-sparc-forte.xml b/src/native/ogl/build-solaris-sparc-forte.xml
index 28f9bf6..7ef8c46 100644
--- a/src/native/ogl/build-solaris-sparc-forte.xml
+++ b/src/native/ogl/build-solaris-sparc-forte.xml
@@ -30,12 +30,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cc">
- <arg line="-v -xCC -xchip=ultra -xarch=v8a -xcode=pic32 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-v -xCC -xchip=ultra -xarch=v8a -xcode=pic32 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -L${java.home}/lib/sparc/motif21 -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -L${java.home}/lib/sparc/motif21 -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
@@ -51,12 +51,12 @@
<!-- Compile the c source files-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/sparcv9" executable="cc">
- <arg line="-v -xCC -xchip=ultra -xarch=v9a -xcode=pic32 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-v -xCC -xchip=ultra -xarch=v9a -xcode=pic32 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/sparcv9" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -L${java.home}/lib/sparcv9/motif21 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -L${java.home}/lib/sparcv9/motif21 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
diff --git a/src/native/ogl/build-solaris-sparc-gcc.xml b/src/native/ogl/build-solaris-sparc-gcc.xml
index d759268..e69ad28 100644
--- a/src/native/ogl/build-solaris-sparc-gcc.xml
+++ b/src/native/ogl/build-solaris-sparc-gcc.xml
@@ -30,12 +30,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-w -m32 -mcpu=v9 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-w -m32 -mcpu=v9 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -L${java.home}/lib/sparc/motif21 -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/sparc -L${java.home}/lib/sparc/motif21 -ljawt -L${java.home}/lib/sparc/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
@@ -51,12 +51,12 @@
<!-- Compile the c source files-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/sparcv9" executable="gcc">
- <arg line="-m64 -mcpu=v9 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-m64 -mcpu=v9 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/sparcv9" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -L${java.home}/lib/sparcv9/motif21 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib/sparcv9 -ldga -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/sparcv9 -L${java.home}/lib/sparcv9 -L${java.home}/lib/sparcv9/motif21 -ljawt -L${java.home}/lib/sparcv9/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
diff --git a/src/native/ogl/build-solaris-x86-forte.xml b/src/native/ogl/build-solaris-x86-forte.xml
index 7a36050..ac56d67 100644
--- a/src/native/ogl/build-solaris-x86-forte.xml
+++ b/src/native/ogl/build-solaris-x86-forte.xml
@@ -30,12 +30,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cc">
- <arg line="-v -xCC -xchip=pentium3 -xarch=generic -KPIC -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-v -xCC -xchip=pentium3 -xarch=generic -KPIC -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -L${java.home}/lib/i386/motif21 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -L${java.home}/lib/i386/motif21 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
@@ -58,12 +58,12 @@
<!-- Compile the c source files-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/amd64" executable="cc">
- <arg line="-v -xCC -xchip=opteron -xarch=generic64 -KPIC -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-v -xCC -xchip=opteron -xarch=generic64 -KPIC -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/amd64" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib/amd64 -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/amd64 -L${java.home}/lib/amd64 -L${java.home}/lib/amd64/motif21 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib/amd64 -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/amd64 -L${java.home}/lib/amd64 -L${java.home}/lib/amd64/motif21 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
diff --git a/src/native/ogl/build-solaris-x86-gcc.xml b/src/native/ogl/build-solaris-x86-gcc.xml
index cfa20ba..7676b5d 100644
--- a/src/native/ogl/build-solaris-x86-gcc.xml
+++ b/src/native/ogl/build-solaris-x86-gcc.xml
@@ -30,12 +30,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-w -m32 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-w -m32 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -L${java.home}/lib/i386/motif21 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -L${java.home}/lib/i386/motif21 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
@@ -58,12 +58,12 @@
<!-- Compile the c source files-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/amd64" executable="gcc">
- <arg line="-m64 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-m64 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/solaris -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DSOLARIS -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs/amd64" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/openwin/lib/amd64 -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/amd64 -L${java.home}/lib/amd64 -L${java.home}/lib/amd64/motif21 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -G -z defs -L/usr/openwin/lib/amd64 -ldl -lGL -lX11 -lXext -lm -lsocket -lnsl -lc -R/usr/openwin/lib/amd64 -L${java.home}/lib/amd64 -L${java.home}/lib/amd64/motif21 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
<!-- Copy the copyright library file -->
diff --git a/src/native/ogl/build-windows-amd64-vc.xml b/src/native/ogl/build-windows-amd64-vc.xml
new file mode 100644
index 0000000..91d038b
--- /dev/null
+++ b/src/native/ogl/build-windows-amd64-vc.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+
+<!--
+/*
+ * $RCSfile$
+ *
+ * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * $Revision$
+ * $Date$
+ * $State$
+ */
+ -->
+
+<!--
+/* 1. define the following property to change the location of the CG library:
+ *
+ * ant -Dcg.home="path-to-cg-installation"
+ */
+ -->
+
+<!-- Ant file for building native ogl renderer files for Windows-amd64 -->
+<project name="Java 3D" default="compile">
+
+
+
+ <target name="init" depends="init-cg,init-nocg">
+ <!-- Create the build directories for win32 -->
+ <mkdir dir="${build}/${platform}/${bldType}/native/ogl/objs"/>
+ <mkdir dir="${build}/${platform}/${bldType}/bin"/>
+
+ <echo message="Executing 64 bit native renderer build [${bldType}]"/>
+
+ <property name="javaInclude"
+ location="${java.home}/../include"/>
+
+ <property name="javaWin32Include"
+ location="${java.home}/../include/win32"/>
+
+ <property name="oglsrc" location="${src}/native/ogl"/>
+ </target>
+
+ <target name="init-cg" if="build.cg">
+ <property name="cflags.cg" value="-DCOMPILE_CG_SHADERS=1"/>
+ <property name="cg.home" location="c:/Program Files/NVIDIA Corporation/Cg"/>
+ </target>
+
+ <target name="init-nocg" unless="build.cg">
+ <property name="cflags.cg" value=""/>
+ <property name="cg.home" value=""/>
+ </target>
+
+ <target name="compile-ogl">
+ <!-- Compile the c source files-->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cl">
+ <arg line="-I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; -I&quot;${cg.home}\include&quot; -nologo -MT -W3 -EHsc -wd4996 -Ox -FD ${bldFlag} ${cflags.cg} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot;"/>
+ </exec>
+
+ <!-- Create the library file-->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="link">
+ <arg line="-nologo -dll -subsystem:windows -pdb:none -out:j3dcore-ogl.dll DrawingSurfaceObjectAWT.obj Canvas3D.obj GraphicsContext3D.obj NativeScreenInfo.obj NativeConfigTemplate3D.obj MasterControl.obj GeometryArrayRetained.obj Attributes.obj CgShaderProgram.obj GLSLShaderProgram.obj Lights.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -DELAYLOAD:jawt.dll -LIBPATH:&quot;${java.home}\..\lib&quot; jawt.lib"/>
+ </exec>
+
+ </target>
+
+
+ <target name="compile-ogl-cg" if="build.cg">
+ <!-- Compile the c source files-->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cl">
+ <arg line="-I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; -I&quot;${cg.home}\include&quot; -nologo -MT -W3 -EHsc -Ox -FD ${bldFlag} ${cflags.cg} -c &quot;${oglsrc}/CgWrapper.c&quot;"/>
+ </exec>
+
+ <!-- Create the library file-->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="link">
+ <arg line="-nologo -dll -subsystem:windows -pdb:none -machine:I386 -out:j3dcore-ogl-cg.dll CgWrapper.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -LIBPATH:&quot;${cg.home}\lib&quot; cg.lib cgGL.lib"/>
+ </exec>
+
+ </target>
+
+
+
+ <target name="compile" depends="init,compile-ogl,compile-ogl-cg">
+
+ <!-- Copy the library file -->
+ <copy todir="${build}/${platform}/${bldType}/bin">
+ <fileset dir="${build}/${platform}/${bldType}/native/ogl/objs"
+ includes="j3dcore-ogl*.dll"
+ />
+ </copy>
+
+ </target>
+
+ <target name="dist">
+ <!-- Create the distribution directory -->
+ <mkdir dir="${dist}/${platform}/bin"/>
+
+ <!-- Copy the library files -->
+ <copy todir="${dist}/${platform}/bin">
+ <fileset dir="${build}/${platform}/opt/bin"
+ includes="j3dcore-ogl*.dll"
+ />
+ </copy>
+
+ </target>
+
+</project>
diff --git a/src/native/ogl/build-windows-i586-gcc.xml b/src/native/ogl/build-windows-i586-gcc.xml
index 976bcc1..8307d92 100644
--- a/src/native/ogl/build-windows-i586-gcc.xml
+++ b/src/native/ogl/build-windows-i586-gcc.xml
@@ -52,12 +52,12 @@
<!-- Inhibit all warning for native build. Remove -w to switch warning on -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-w -D_WINGDI_ -D_JNI_IMPLEMENTATION_ -I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; ${bldFlag} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeWSInfo.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/RasterRetained.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot; &quot;${oglsrc}/NativeAPIInfo.c&quot;"/>
+ <arg line="-w -D_WINGDI_ -D_JNI_IMPLEMENTATION_ -I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; ${bldFlag} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot;"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-shared -o j3dcore-ogl.dll DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -Wl,--kill-at -L&quot;${java.home}\..\lib&quot; -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32 -ljawt"/>
+ <arg line="-shared -o j3dcore-ogl.dll DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -Wl,--kill-at -L&quot;${java.home}\..\lib&quot; -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32 -ljawt"/>
</exec>
<!-- Copy the copyright library file -->
diff --git a/src/native/ogl/build-windows-i586-vc.xml b/src/native/ogl/build-windows-i586-vc.xml
index d1a49ac..8e62417 100644
--- a/src/native/ogl/build-windows-i586-vc.xml
+++ b/src/native/ogl/build-windows-i586-vc.xml
@@ -55,12 +55,12 @@
<target name="compile-ogl">
<!-- Compile the c source files-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="cl">
- <arg line="-I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; -I&quot;${cg.home}\include&quot; -nologo -MT -W3 -GX -Ox -YX -FD ${bldFlag} ${cflags.cg} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeWSInfo.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/RasterRetained.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot; &quot;${oglsrc}/NativeAPIInfo.c&quot;"/>
+ <arg line="-I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; -I&quot;${cg.home}\include&quot; -nologo -MT -W3 -GX -Ox -YX -FD ${bldFlag} ${cflags.cg} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot;"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="link">
- <arg line="-nologo -dll -subsystem:windows -pdb:none -machine:I386 -out:j3dcore-ogl.dll DrawingSurfaceObjectAWT.obj Canvas3D.obj GraphicsContext3D.obj NativeWSInfo.obj NativeScreenInfo.obj NativeConfigTemplate3D.obj MasterControl.obj RasterRetained.obj GeometryArrayRetained.obj Attributes.obj CgShaderProgram.obj GLSLShaderProgram.obj Lights.obj NativeAPIInfo.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -DELAYLOAD:jawt.dll -LIBPATH:&quot;${java.home}\..\lib&quot; jawt.lib"/>
+ <arg line="-nologo -dll -subsystem:windows -pdb:none -machine:I386 -out:j3dcore-ogl.dll DrawingSurfaceObjectAWT.obj Canvas3D.obj GraphicsContext3D.obj NativeScreenInfo.obj NativeConfigTemplate3D.obj MasterControl.obj GeometryArrayRetained.obj Attributes.obj CgShaderProgram.obj GLSLShaderProgram.obj Lights.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -DELAYLOAD:jawt.dll -LIBPATH:&quot;${java.home}\..\lib&quot; jawt.lib"/>
</exec>
</target>
diff --git a/src/native/ogl/gldefs.h b/src/native/ogl/gldefs.h
index 7112a79..e278f1d 100644
--- a/src/native/ogl/gldefs.h
+++ b/src/native/ogl/gldefs.h
@@ -109,7 +109,6 @@
#include "javax_media_j3d_ColoringAttributes.h"
#include "javax_media_j3d_ColoringAttributesRetained.h"
#include "javax_media_j3d_DepthComponentRetained.h"
-#include "javax_media_j3d_DetailTextureImage.h"
#include "javax_media_j3d_DirectionalLightRetained.h"
#include "javax_media_j3d_DisplayListRenderMethod.h"
#include "javax_media_j3d_DrawingSurfaceObjectAWT.h"
@@ -129,8 +128,8 @@
#include "javax_media_j3d_Material.h"
#include "javax_media_j3d_MaterialRetained.h"
#include "javax_media_j3d_ModelClipRetained.h"
-#include "javax_media_j3d_NativeAPIInfo.h"
#include "javax_media_j3d_NativeConfigTemplate3D.h"
+#include "javax_media_j3d_NativePipeline.h"
#include "javax_media_j3d_NodeRetained.h"
#include "javax_media_j3d_PointAttributesRetained.h"
#include "javax_media_j3d_PointLightRetained.h"
@@ -162,24 +161,6 @@
#include "javax_media_j3d_ShaderAttributeObjectRetained.h"
#include "javax_media_j3d_ShaderError.h"
-/*
- * Define these constants here as a workaround for conflicting
- * glext.h files between Mesa and Solaris
- */
-
-#ifndef GL_CLAMP_TO_BORDER_SGIS
-#define GL_CLAMP_TO_BORDER_SGIS 0x812D
-#endif
-
-#ifndef GL_VIDEO_RESIZE_COMPENSATION_SUN
-#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD
-#endif
-
-/*
- * End constant workaround
- */
-
-
/* Used to compare floating point values close to 0.0 */
#define J3D_SMALL_FLOAT 0.00001f
@@ -265,13 +246,21 @@
/* now the imagecomponent formats are reduced the ones below */
-#define FORMAT_BYTE_RGBA javax_media_j3d_ImageComponentRetained_BYTE_RGBA
-#define FORMAT_BYTE_ABGR javax_media_j3d_ImageComponentRetained_BYTE_ABGR
-#define FORMAT_BYTE_GRAY javax_media_j3d_ImageComponentRetained_BYTE_GRAY
-#define FORMAT_USHORT_GRAY javax_media_j3d_ImageComponentRetained_USHORT_GRAY
-#define FORMAT_BYTE_LA javax_media_j3d_ImageComponentRetained_BYTE_LA
-#define FORMAT_BYTE_BGR javax_media_j3d_ImageComponentRetained_BYTE_BGR
-#define FORMAT_BYTE_RGB javax_media_j3d_ImageComponentRetained_BYTE_RGB
+#define IMAGE_FORMAT_BYTE_BGR javax_media_j3d_ImageComponentRetained_TYPE_BYTE_BGR
+#define IMAGE_FORMAT_BYTE_RGB javax_media_j3d_ImageComponentRetained_TYPE_BYTE_RGB
+#define IMAGE_FORMAT_BYTE_ABGR javax_media_j3d_ImageComponentRetained_TYPE_BYTE_ABGR
+#define IMAGE_FORMAT_BYTE_RGBA javax_media_j3d_ImageComponentRetained_TYPE_BYTE_RGBA
+#define IMAGE_FORMAT_BYTE_LA javax_media_j3d_ImageComponentRetained_TYPE_BYTE_LA
+#define IMAGE_FORMAT_BYTE_GRAY javax_media_j3d_ImageComponentRetained_TYPE_BYTE_GRAY
+#define IMAGE_FORMAT_USHORT_GRAY javax_media_j3d_ImageComponentRetained_TYPE_USHORT_GRAY
+#define IMAGE_FORMAT_INT_BGR javax_media_j3d_ImageComponentRetained_TYPE_INT_BGR
+#define IMAGE_FORMAT_INT_RGB javax_media_j3d_ImageComponentRetained_TYPE_INT_RGB
+#define IMAGE_FORMAT_INT_ARGB javax_media_j3d_ImageComponentRetained_TYPE_INT_ARGB
+
+#define IMAGE_DATA_TYPE_BYTE_ARRAY javax_media_j3d_ImageComponentRetained_IMAGE_DATA_TYPE_BYTE_ARRAY
+#define IMAGE_DATA_TYPE_INT_ARRAY javax_media_j3d_ImageComponentRetained_IMAGE_DATA_TYPE_INT_ARRAY
+#define IMAGE_DATA_TYPE_BYTE_BUFFER javax_media_j3d_ImageComponentRetained_IMAGE_DATA_TYPE_BYTE_BUFFER
+#define IMAGE_DATA_TYPE_INT_BUFFER javax_media_j3d_ImageComponentRetained_IMAGE_DATA_TYPE_INT_BUFFER
/* These match the definitions in GeometryArray.java */
@@ -360,53 +349,7 @@
-
#ifndef D3D
-#if defined(UNIX)
-extern void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf);
-extern void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf);
-extern void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-extern void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-extern void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *);
-extern void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *);
-extern void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
-extern void APIENTRY glMultiDrawArraysSUN (GLenum, GLint *, GLsizei *, GLsizei);
-extern void APIENTRY glMultiDrawElementsEXT (GLenum, GLsizei *, GLenum, const GLvoid**, GLsizei);
-extern void APIENTRY glMultiDrawElementsSUN (GLenum, GLsizei *, GLenum, const GLvoid**, GLsizei);
-extern void APIENTRY glLockArraysEXT (GLint first, GLsizei count);
-extern void APIENTRY glUnlockArraysEXT (void);
-
-
-extern void APIENTRY glClientActiveTextureARB (GLenum);
-extern void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *);
-extern void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *);
-extern void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *);
-extern void APIENTRY glGlobalAlphaFactorfSUN (GLfloat);
-extern void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *);
-extern void APIENTRY glMultTransposeMatrixdARB (const GLdouble *);
-extern void APIENTRY glActiveTextureARB (GLenum);
-extern void APIENTRY glSharpenTexFuncSGIS(GLenum, GLsizei, const GLfloat *);
-extern void APIENTRY glDetailTexFuncSGIS(GLenum, GLsizei, const GLfloat *);
-extern void APIENTRY glTexFilterFuncSGIS(GLenum, GLenum, GLsizei, const GLfloat *);
-extern void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
-extern void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
-extern void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum);
-extern void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *);
-extern void APIENTRY glCombinerParameterivNV (GLenum, const GLint *);
-extern void APIENTRY glCombinerParameterfNV (GLenum, GLfloat);
-extern void APIENTRY glCombinerParameteriNV (GLenum, GLint);
-
-extern void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-extern void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-
-
-
-#ifndef GLX_SUN_video_resize
-#define GLX_SUN_video_resize 1
-extern int glXVideoResizeSUN( Display *, GLXDrawable, float);
-#endif
-
-#endif /* UNIX_ */
#ifndef APIENTRY
#define APIENTRY
@@ -420,18 +363,18 @@ typedef void (APIENTRY * MYPFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green
typedef void (APIENTRY * MYPFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (APIENTRY * MYPFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRY * MYPFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
-typedef void (APIENTRY * MYPFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRY * MYPFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRY * MYPFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
typedef void (APIENTRY * MYPFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum, GLsizei *, GLenum, const GLvoid**, GLsizei);
typedef void (APIENTRY * MYPFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
typedef void (APIENTRY * MYPFNGLUNLOCKARRAYSEXTPROC) (void);
-typedef void (APIENTRY * MYPFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRY * MYPFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRY * MYPFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRY * MYPFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
-typedef void (APIENTRY * MYPFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
-typedef void (APIENTRY * MYPFNGLACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRY * MYPFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * MYPFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * MYPFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRY * MYPFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
+typedef void (APIENTRY * MYPFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
+typedef void (APIENTRY * MYPFNGLACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRY * MYPFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (APIENTRY * MYPFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
@@ -450,7 +393,6 @@ typedef void (APIENTRY * MYPFNGLTEXFILTERFUNCSGI) (GLenum target, GLenum filter,
#if defined(UNIX)
typedef GLXFBConfig * (APIENTRY * MYPFNGLXCHOOSEFBCONFIG) (Display *dpy, int screen, const int *attrib_list, int *nelements);
-typedef int (APIENTRY * MYPFNGLXVIDEORESIZESUN) (Display * dpy, GLXDrawable draw, float factor);
#endif /* UNIX_ */
@@ -491,41 +433,15 @@ struct GraphicsContextPropertiesInfoRec {
char *rendererStr;
char *extensionStr;
int versionNumbers[2];
-
- /* both in 1.2 core part and 1.1 extensions */
- /* GL_EXT_rescale_normal or GL_RESCALE_NORMAL */
- jboolean rescale_normal_ext;
- GLenum rescale_normal_ext_enum;
-
- /* GL_BGR_EXT or GL_BGR */
- jboolean bgr_ext;
- GLenum bgr_ext_enum;
-
- /* GL_EXT_texture3D or GL_TEXTURE3D */
- jboolean texture3DAvailable;
- GLenum texture_3D_ext_enum;
- GLenum texture_wrap_r_ext_enum;
+ jboolean gl13; /* OpenGL 1.3 or greater */
+ jboolean gl20; /* OpenGL 2.0 or greater */
/* GL_ARB_imaging subset */
/* GL_EXT_blend_color or GL_BLEND_COLOR */
jboolean blend_color_ext;
GLenum blendFunctionTable[MAX_BLEND_FUNC_TABLE_SIZE];
-
- /* GL_SGI_color_table or GL_COLOR_TABLE */
- jboolean color_table_ext;
-
- /* GL_EXT_separate_specular_color */
- jboolean seperate_specular_color;
- GLenum light_model_color_control_enum;
- GLenum single_color_enum;
- GLenum seperate_specular_color_enum;
-
- /* GL_CLAMP_TO_EDGE or GL_EXT_texture_edge_clamp or
- GL_SGIS_texture_edge_clamp */
- GLenum texture_clamp_to_edge_enum;
-
- /* GL_SGIS_texture_lod */
+ /* texture_lod */
jboolean textureLodAvailable;
GLenum texture_min_lod_enum;
GLenum texture_max_lod_enum;
@@ -533,22 +449,17 @@ struct GraphicsContextPropertiesInfoRec {
GLenum texture_max_level_enum;
- /* ***********1.1 extension or 1.2 extensions ********************/
+ /* ***** GL extensions ***** */
- /* GL_ARB_texture_border_clamp or GL_SGIS_texture_border_clamp */
+ /* GL_CLAMP_TO_BORDER or GL_CLAMP */
GLenum texture_clamp_to_border_enum;
/* GL_SUN_multi_draw_arrays */
jboolean multi_draw_arrays_sun;
- /* GLX_SUN_video_resize */
- jboolean videoResizeAvailable;
-
/* GL_SUN_global_alpha */
jboolean global_alpha_sun;
- /* GL_SUNX_constant_data */
- jboolean constant_data_sun;
-
+
/* GL_EXT_abgr */
jboolean abgr_ext;
/* GL_EXT_multi_draw_arrays */
@@ -557,11 +468,7 @@ struct GraphicsContextPropertiesInfoRec {
/* GL_EXT_compiled_vertex_array */
jboolean compiled_vertex_array_ext;
- /* GL_ARB_transpose_matrix */
- jboolean arb_transpose_matrix;
-
- /* GL_ARB_multitexture */
- jboolean arb_multitexture;
+ /* Multitexture parameters */
int maxTexCoordSets; /* maximum number of texture coordinate sets */
int maxTextureUnits; /* number of fixed-function texture units */
int maxTextureImageUnits; /* number of fragment shader texture units */
@@ -593,13 +500,8 @@ struct GraphicsContextPropertiesInfoRec {
GLenum combine_dot3_rgb_enum;
GLenum combine_dot3_rgba_enum;
- /* GL_ARB_texture_cube_map */
- /* GL_EXT_texture_cube_map */
- jboolean textureCubeMapAvailable;
- GLenum texture_cube_map_ext_enum;
-
- /* GL_ARB_mulitsample */
- jboolean arb_multisample;
+ /* GL mulitsample functionality */
+ jboolean multisample;
/*
By default, full scene antialiasing is disable if
@@ -647,6 +549,9 @@ struct GraphicsContextPropertiesInfoRec {
/* GL_SGIX_texture_lod_bias */
jboolean textureLodBiasAvailable;
+ /* GL_ARB_texture_non_power_of_two */
+ jboolean textureNonPowerOfTwoAvailable;
+
/* extension mask */
jint extMask;
jint textureExtMask;
@@ -658,17 +563,17 @@ struct GraphicsContextPropertiesInfoRec {
MYPFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv;
MYPFNGLTEXIMAGE3DPROC glTexImage3DEXT;
MYPFNGLTEXSUBIMAGE3DPROC glTexSubImage3DEXT;
- MYPFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
- MYPFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
+ MYPFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
+ MYPFNGLACTIVETEXTUREPROC glActiveTexture;
MYPFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArraysEXT;
MYPFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElementsEXT;
MYPFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
MYPFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
- MYPFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB;
- MYPFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB;
- MYPFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
- MYPFNGLLOADTRANSPOSEMATRIXDARBPROC glLoadTransposeMatrixdARB;
- MYPFNGLMULTTRANSPOSEMATRIXDARBPROC glMultTransposeMatrixdARB;
+ MYPFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv;
+ MYPFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv;
+ MYPFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv;
+ MYPFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd;
+ MYPFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd;
MYPFNGLGLOBALALPHAFACTORFSUNPROC glGlobalAlphaFactorfSUN;
MYPFNGLCOMBINERINPUTNV glCombinerInputNV;
@@ -683,10 +588,6 @@ struct GraphicsContextPropertiesInfoRec {
MYPFNGLDETAILTEXFUNCSGI glDetailTexFuncSGIS;
MYPFNGLTEXFILTERFUNCSGI glTexFilterFuncSGIS;
-#if defined(UNIX)
- MYPFNGLXVIDEORESIZESUN glXVideoResizeSUN;
-#endif /* UNIX_ */
-
/* Shading language support */
jboolean shadingLanguageGLSL;
jboolean shadingLanguageCg;