diff options
author | Kevin Rushforth <[email protected]> | 2005-11-23 01:04:18 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2005-11-23 01:04:18 +0000 |
commit | f4432b5902d59f3a0a1a1ec9fc36fe651b44588b (patch) | |
tree | d5d08d481bfbe5c8aafbe80403c0ad4ea701dda4 /src | |
parent | d322171cfb349247faf089e068ab2e9168c31c2d (diff) |
Issue 196 : Finish CgShader shader attributes native methods
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@466 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/share/javax/media/j3d/CgShaderProgramRetained.java | 2 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java | 13 | ||||
-rw-r--r-- | src/native/ogl/CgShaderProgram.c | 901 | ||||
-rw-r--r-- | src/native/ogl/CgWrapper.c | 11 | ||||
-rw-r--r-- | src/native/ogl/CgWrapper.h | 23 | ||||
-rw-r--r-- | src/native/ogl/GLSLShaderProgram.c | 16 | ||||
-rw-r--r-- | src/native/ogl/build-linux-i586.xml | 2 |
7 files changed, 843 insertions, 125 deletions
diff --git a/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java b/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java index 63b0914..ffba228 100644 --- a/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java +++ b/src/classes/share/javax/media/j3d/CgShaderProgramRetained.java @@ -250,11 +250,13 @@ class CgShaderProgramRetained extends ShaderProgramRetained { attrNameInfoArr[i].setLocation(locArr[i]); attrNameInfoArr[i].setArray(isArrayArr[i]); attrNameInfoArr[i].setType(typeArr[i]); + /* System.err.println(attrNames[i] + " : loc = " + locArr[i] + ", type = " + typeArr[i] + ", isArray = " + isArrayArr[i] + ", size = " + sizeArr[i]); + */ } } diff --git a/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java b/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java index 85ca866..e2d9176 100644 --- a/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java +++ b/src/classes/share/javax/media/j3d/ShaderAttributeArrayRetained.java @@ -333,6 +333,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple2i[] arr = new Tuple2i[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 2; + arr[i] = new Point2i(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; } @@ -371,6 +372,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple2f[] arr = new Tuple2f[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 2; + arr[i] = new Point2f(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; } @@ -410,6 +412,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple2d[] arr = new Tuple2d[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 2; + arr[i] = new Point2d(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; } @@ -451,6 +454,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple3i[] arr = new Tuple3i[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 3; + arr[i] = new Point3i(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; @@ -492,6 +496,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple3f[] arr = new Tuple3f[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 3; + arr[i] = new Point3f(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; @@ -534,6 +539,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple3d[] arr = new Tuple3d[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 3; + arr[i] = new Point3d(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; @@ -578,6 +584,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple4i[] arr = new Tuple4i[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 4; + arr[i] = new Point4i(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; @@ -622,6 +629,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple4f[] arr = new Tuple4f[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 4; + arr[i] = new Point4f(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; @@ -667,6 +675,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Tuple4d[] arr = new Tuple4d[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 4; + arr[i] = new Point4d(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; @@ -724,6 +733,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Matrix3f[] arr = new Matrix3f[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 9; + arr[i] = new Matrix3f(); arr[i].m00 = this.value[j+0]; arr[i].m01 = this.value[j+1]; arr[i].m02 = this.value[j+2]; @@ -786,6 +796,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Matrix3d[] arr = new Matrix3d[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 9; + arr[i] = new Matrix3d(); arr[i].m00 = this.value[j+0]; arr[i].m01 = this.value[j+1]; arr[i].m02 = this.value[j+2]; @@ -862,6 +873,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Matrix4f[] arr = new Matrix4f[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 16; + arr[i] = new Matrix4f(); arr[i].m00 = this.value[j+0]; arr[i].m01 = this.value[j+1]; arr[i].m02 = this.value[j+2]; @@ -945,6 +957,7 @@ class ShaderAttributeArrayRetained extends ShaderAttributeObjectRetained { Matrix4d[] arr = new Matrix4d[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 16; + arr[i] = new Matrix4d(); arr[i].m00 = this.value[j+0]; arr[i].m01 = this.value[j+1]; arr[i].m02 = this.value[j+2]; diff --git a/src/native/ogl/CgShaderProgram.c b/src/native/ogl/CgShaderProgram.c index f85cf65..1b9e676 100644 --- a/src/native/ogl/CgShaderProgram.c +++ b/src/native/ogl/CgShaderProgram.c @@ -889,46 +889,38 @@ cgToJ3dType(CGtype type) case CG_FIXED2: case CG_HALF2: case CG_INT2: - /* TODO: return TYPE_TUPLE2I; */ - return -1; + return TYPE_TUPLE2I; case CG_BOOL3: case CG_FIXED3: case CG_HALF3: case CG_INT3: - /*TODO: return TYPE_TUPLE3I; */ - return -1; + return TYPE_TUPLE3I; case CG_BOOL4: case CG_FIXED4: case CG_HALF4: case CG_INT4: - /*TODO: return TYPE_TUPLE4I; */ - return -1; + return TYPE_TUPLE4I; case CG_FLOAT: case CG_FLOAT1: return TYPE_FLOAT; case CG_FLOAT2: - /*TODO: return TYPE_TUPLE2F; */ - return -1; + return TYPE_TUPLE2F; case CG_FLOAT3: - /*TODO: return TYPE_TUPLE3F; */ - return -1; + return TYPE_TUPLE3F; case CG_FLOAT4: - /*TODO: return TYPE_TUPLE4F; */ - return -1; + return TYPE_TUPLE4F; case CG_FLOAT3x3: - /*TODO: return TYPE_MATRIX3F; */ - return -1; + return TYPE_MATRIX3F; case CG_FLOAT4x4: - /*TODO: return TYPE_MATRIX4F; */ - return -1; + return TYPE_MATRIX4F; /* * Java 3D does not support the following sampler types: @@ -1226,7 +1218,18 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform1i( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter1f(cgParamInfo->vParam, (float)value); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter1f(cgParamInfo->fParam, (float)value); + } #else /* COMPILE_CG_SHADERS */ @@ -1262,15 +1265,14 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform1f( GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; - CgShaderProgramInfo *shaderProgramInfo = (CgShaderProgramInfo*)shaderProgramId; CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; if (cgParamInfo->vParam != NULL) { - cgWrapperInfo->cgSetParameter1f(cgParamInfo->vParam, value); + cgWrapperInfo->cgGLSetParameter1f(cgParamInfo->vParam, value); } if (cgParamInfo->fParam != NULL) { - cgWrapperInfo->cgSetParameter1f(cgParamInfo->fParam, value); + cgWrapperInfo->cgGLSetParameter1f(cgParamInfo->fParam, value); } #else /* COMPILE_CG_SHADERS */ @@ -1304,7 +1306,30 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform2i( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jint *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetIntArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter2f(cgParamInfo->vParam, + (float)values[0], + (float)values[1]); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter2f(cgParamInfo->fParam, + (float)values[0], + (float)values[1]); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1337,7 +1362,30 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform2f( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter2f(cgParamInfo->vParam, + values[0], + values[1]); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter2f(cgParamInfo->fParam, + values[0], + values[1]); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1370,7 +1418,32 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform3i( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jint *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetIntArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter3f(cgParamInfo->vParam, + (float)values[0], + (float)values[1], + (float)values[2]); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter3f(cgParamInfo->fParam, + (float)values[0], + (float)values[1], + (float)values[2]); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1403,7 +1476,32 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform3f( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter3f(cgParamInfo->vParam, + values[0], + values[1], + values[2]); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter3f(cgParamInfo->fParam, + values[0], + values[1], + values[2]); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1436,7 +1534,34 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform4i( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jint *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetIntArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter4f(cgParamInfo->vParam, + (float)values[0], + (float)values[1], + (float)values[2], + (float)values[3]); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter4f(cgParamInfo->fParam, + (float)values[0], + (float)values[1], + (float)values[2], + (float)values[3]); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1469,7 +1594,34 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniform4f( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameter4f(cgParamInfo->vParam, + values[0], + values[1], + values[2], + values[3]); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameter4f(cgParamInfo->fParam, + values[0], + values[1], + values[2], + values[3]); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1502,7 +1654,26 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3f( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterfr(cgParamInfo->vParam, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterfr(cgParamInfo->fParam, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1535,7 +1706,595 @@ Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix4f( #ifdef COMPILE_CG_SHADERS - /* TODO: implement this */ + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterfr(cgParamInfo->vParam, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterfr(cgParamInfo->fParam, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform1iArray + * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform1iArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jintArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + int i; + jint *ivalues; + float *fvalues; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + ivalues = (*env)->GetIntArrayElements(env, varray, NULL); + fvalues = malloc(length * sizeof(float)); + for (i = 0; i < length; i++) { + fvalues[i] = (float)ivalues[i]; + } + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray1f(cgParamInfo->vParam, + 0, length, fvalues); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray1f(cgParamInfo->fParam, + 0, length, fvalues); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, ivalues, JNI_ABORT); + free(fvalues); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform1fArray + * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform1fArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jfloatArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray1f(cgParamInfo->vParam, + 0, length, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray1f(cgParamInfo->fParam, + 0, length, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform2iArray + * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform2iArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jintArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + int i; + jint *ivalues; + float *fvalues; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + ivalues = (*env)->GetIntArrayElements(env, varray, NULL); + fvalues = malloc(length * sizeof(float)); + for (i = 0; i < 2 * length; i++) { + fvalues[i] = (float)ivalues[i]; + } + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray2f(cgParamInfo->vParam, + 0, length, fvalues); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray2f(cgParamInfo->fParam, + 0, length, fvalues); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, ivalues, JNI_ABORT); + free(fvalues); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform2fArray + * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform2fArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jfloatArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray2f(cgParamInfo->vParam, + 0, length, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray2f(cgParamInfo->fParam, + 0, length, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform3iArray + * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform3iArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jintArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + int i; + jint *ivalues; + float *fvalues; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + ivalues = (*env)->GetIntArrayElements(env, varray, NULL); + fvalues = malloc(length * sizeof(float)); + for (i = 0; i < 3 * length; i++) { + fvalues[i] = (float)ivalues[i]; + } + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray3f(cgParamInfo->vParam, + 0, length, fvalues); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray3f(cgParamInfo->fParam, + 0, length, fvalues); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, ivalues, JNI_ABORT); + free(fvalues); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform3fArray + * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform3fArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jfloatArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray3f(cgParamInfo->vParam, + 0, length, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray3f(cgParamInfo->fParam, + 0, length, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform4iArray + * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform4iArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jintArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + int i; + jint *ivalues; + float *fvalues; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + ivalues = (*env)->GetIntArrayElements(env, varray, NULL); + fvalues = malloc(length * sizeof(float)); + for (i = 0; i < 4 * length; i++) { + fvalues[i] = (float)ivalues[i]; + } + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray4f(cgParamInfo->vParam, + 0, length, fvalues); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray4f(cgParamInfo->fParam, + 0, length, fvalues); + } + + /* Release array values */ + (*env)->ReleaseIntArrayElements(env, varray, ivalues, JNI_ABORT); + free(fvalues); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniform4fArray + * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniform4fArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jfloatArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray4f(cgParamInfo->vParam, + 0, length, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetParameterArray4f(cgParamInfo->fParam, + 0, length, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniformMatrix3fArray + * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3fArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jfloatArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterArrayfr(cgParamInfo->vParam, + 0, length, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterArrayfr(cgParamInfo->fParam, + 0, length, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); + +#else /* COMPILE_CG_SHADERS */ + + shaderError = createShaderError(env, + javax_media_j3d_ShaderError_UNSUPPORTED_LANGUAGE_ERROR, + "CgShaderProgram support not compiled", + NULL); + +#endif /* !COMPILE_CG_SHADERS */ + + return shaderError; +} + +/* + * Class: javax_media_j3d_CgShaderProgramRetained + * Method: setUniformMatrix4fArray + * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; + */ +JNIEXPORT jobject JNICALL +Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix4fArray( + JNIEnv *env, + jobject obj, + jlong ctxInfo, + jlong shaderProgramId, + jlong location, + jint length, + jfloatArray varray) +{ + jobject shaderError = NULL; + +#ifdef COMPILE_CG_SHADERS + + jfloat *values; + + GraphicsContextPropertiesInfo* ctxProperties = (GraphicsContextPropertiesInfo* )ctxInfo; + CgCtxInfo *cgCtxInfo = ctxProperties->cgCtxInfo; + CgWrapperInfo *cgWrapperInfo = cgCtxInfo->cgWrapperInfo; + CgParameterInfo *cgParamInfo = (CgParameterInfo *)location; + + /* Get array values */ + values = (*env)->GetFloatArrayElements(env, varray, NULL); + + if (cgParamInfo->vParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterArrayfr(cgParamInfo->vParam, + 0, length, values); + } + + if (cgParamInfo->fParam != NULL) { + cgWrapperInfo->cgGLSetMatrixParameterArrayfr(cgParamInfo->fParam, + 0, length, values); + } + + /* Release array values */ + (*env)->ReleaseFloatArrayElements(env, varray, values, JNI_ABORT); #else /* COMPILE_CG_SHADERS */ @@ -1677,89 +2436,3 @@ cgVertexAttr( fprintf(stderr, "Java 3D ERROR : Assertion failed: invalid call to cgVertexAttr*f\n"); } - - -#if 0 - - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform1iArray - * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform1iArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jintArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform1fArray - * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform1fArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jfloatArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform2iArray - * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform2iArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jintArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform2fArray - * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform2fArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jfloatArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform3iArray - * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform3iArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jintArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform3fArray - * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform3fArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jfloatArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform4iArray - * Signature: (JJJI[I)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform4iArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jintArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniform4fArray - * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniform4fArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jfloatArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniformMatrix3fArray - * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix3fArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jfloatArray); - -/* - * Class: javax_media_j3d_CgShaderProgramRetained - * Method: setUniformMatrix4fArray - * Signature: (JJJI[F)Ljavax/media/j3d/ShaderError; - */ -JNIEXPORT jobject JNICALL Java_javax_media_j3d_CgShaderProgramRetained_setUniformMatrix4fArray - (JNIEnv *, jobject, jlong, jlong, jlong, jint, jfloatArray); - -#endif diff --git a/src/native/ogl/CgWrapper.c b/src/native/ogl/CgWrapper.c index ba64f2b..ccfff5f 100644 --- a/src/native/ogl/CgWrapper.c +++ b/src/native/ogl/CgWrapper.c @@ -50,7 +50,16 @@ j3dLoadCgFunctionPointers(CgWrapperInfo *cgWrapperInfo) cgWrapperInfo->cgGetArrayType = &cgGetArrayType; cgWrapperInfo->cgGetArraySize = &cgGetArraySize; cgWrapperInfo->cgGetArrayParameter = &cgGetArrayParameter; - cgWrapperInfo->cgSetParameter1f = &cgSetParameter1f; + cgWrapperInfo->cgGLSetParameter1f = &cgGLSetParameter1f; + cgWrapperInfo->cgGLSetParameter2f = &cgGLSetParameter2f; + cgWrapperInfo->cgGLSetParameter3f = &cgGLSetParameter3f; + cgWrapperInfo->cgGLSetParameter4f = &cgGLSetParameter4f; + cgWrapperInfo->cgGLSetParameterArray1f = &cgGLSetParameterArray1f; + cgWrapperInfo->cgGLSetParameterArray2f = &cgGLSetParameterArray2f; + cgWrapperInfo->cgGLSetParameterArray3f = &cgGLSetParameterArray3f; + cgWrapperInfo->cgGLSetParameterArray4f = &cgGLSetParameterArray4f; + cgWrapperInfo->cgGLSetMatrixParameterfr = &cgGLSetMatrixParameterfr; + cgWrapperInfo->cgGLSetMatrixParameterArrayfr = &cgGLSetMatrixParameterArrayfr; cgWrapperInfo->cgGLSetParameterPointer = &cgGLSetParameterPointer; cgWrapperInfo->cgGLEnableClientState = &cgGLEnableClientState; cgWrapperInfo->cgGLDisableClientState = &cgGLDisableClientState; diff --git a/src/native/ogl/CgWrapper.h b/src/native/ogl/CgWrapper.h index ae48265..93b1fc7 100644 --- a/src/native/ogl/CgWrapper.h +++ b/src/native/ogl/CgWrapper.h @@ -51,7 +51,16 @@ typedef int (*PFNCGGETARRAYDIMENSION)(CGparameter); typedef CGtype (*PFNCGGETARRAYTYPE)(CGparameter); typedef int (*PFNCGGETARRAYSIZE)(CGparameter, int); typedef CGparameter (*PFNCGGETARRAYPARAMETER)(CGparameter, int); -typedef void (*PFNCGSETPARAMETER1F)(CGparameter, float); +typedef void (*PFNCGGLSETPARAMETER1F)(CGparameter, float); +typedef void (*PFNCGGLSETPARAMETER2F)(CGparameter, float, float); +typedef void (*PFNCGGLSETPARAMETER3F)(CGparameter, float, float, float); +typedef void (*PFNCGGLSETPARAMETER4F)(CGparameter, float, float, float, float); +typedef void (*PFNCGGLSETPARAMETERARRAY1F)(CGparameter, long, long, const float *); +typedef void (*PFNCGGLSETPARAMETERARRAY2F)(CGparameter, long, long, const float *); +typedef void (*PFNCGGLSETPARAMETERARRAY3F)(CGparameter, long, long, const float *); +typedef void (*PFNCGGLSETPARAMETERARRAY4F)(CGparameter, long, long, const float *); +typedef void (*PFNCGGLSETMATRIXPARAMETERFR)(CGparameter, const float *); +typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYFR)(CGparameter, long, long, const float *); typedef void (*PFNCGGLSETPARAMETERPOINTER)(CGparameter, GLint, GLenum, GLsizei, const GLvoid *); typedef void (*PFNCGGLENABLECLIENTSTATE)(CGparameter); @@ -104,8 +113,16 @@ struct CgWrapperInfoRec { PFNCGGETARRAYTYPE cgGetArrayType; PFNCGGETARRAYSIZE cgGetArraySize; PFNCGGETARRAYPARAMETER cgGetArrayParameter; - PFNCGSETPARAMETER1F cgSetParameter1f; - + PFNCGGLSETPARAMETER1F cgGLSetParameter1f; + PFNCGGLSETPARAMETER2F cgGLSetParameter2f; + PFNCGGLSETPARAMETER3F cgGLSetParameter3f; + PFNCGGLSETPARAMETER4F cgGLSetParameter4f; + PFNCGGLSETPARAMETERARRAY1F cgGLSetParameterArray1f; + PFNCGGLSETPARAMETERARRAY2F cgGLSetParameterArray2f; + PFNCGGLSETPARAMETERARRAY3F cgGLSetParameterArray3f; + PFNCGGLSETPARAMETERARRAY4F cgGLSetParameterArray4f; + PFNCGGLSETMATRIXPARAMETERFR cgGLSetMatrixParameterfr; + PFNCGGLSETMATRIXPARAMETERARRAYFR cgGLSetMatrixParameterArrayfr; PFNCGGLSETPARAMETERPOINTER cgGLSetParameterPointer; PFNCGGLENABLECLIENTSTATE cgGLEnableClientState; PFNCGGLDISABLECLIENTSTATE cgGLDisableClientState; diff --git a/src/native/ogl/GLSLShaderProgram.c b/src/native/ogl/GLSLShaderProgram.c index 3c29cb6..c88a4d2 100644 --- a/src/native/ogl/GLSLShaderProgram.c +++ b/src/native/ogl/GLSLShaderProgram.c @@ -685,6 +685,10 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames( JNIEnv table = *env; +#ifdef VERBOSE + fprintf(stderr, "GLSLShaderProgramRetained.lookupNativeShaderAttrNames\n"); +#endif + locPtr = (*env)->GetLongArrayElements(env, locArr, NULL); typePtr = (*env)->GetIntArrayElements(env, typeArr, NULL); sizePtr = (*env)->GetIntArrayElements(env, sizeArr, NULL); @@ -725,11 +729,11 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames( &maxStrLen); name = malloc(maxStrLen + 1); - /* +#ifdef VERBOSE fprintf(stderr, "numActiveUniforms = %d, maxStrLen = %d\n", numActiveUniforms, maxStrLen); - */ +#endif for (i = 0; i < numActiveUniforms; i++) { glslCtxInfo->pfnglGetActiveUniformARB((GLhandleARB) shaderProgramId, @@ -739,11 +743,11 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames( &size, &type, name); - /* +#ifdef VERBOSE fprintf(stderr, "Uniform[%d] : name = %s, type = %d, size = %d\n", i, name, type, size); - */ +#endif /* Now try to find the name */ for (j = 0; j < numAttrNames; j++) { @@ -766,11 +770,11 @@ Java_javax_media_j3d_GLSLShaderProgramRetained_lookupNativeShaderAttrNames( loc = glslCtxInfo->pfnglGetUniformLocationARB((GLhandleARB)shaderProgramId, attrNamesString[i]); - /* +#ifdef VERBOSE fprintf(stderr, "str = %s, loc = %d\n", attrNamesString[i], loc); - */ +#endif locPtr[i] = (jlong)loc; } diff --git a/src/native/ogl/build-linux-i586.xml b/src/native/ogl/build-linux-i586.xml index f70e067..b1dc897 100644 --- a/src/native/ogl/build-linux-i586.xml +++ b/src/native/ogl/build-linux-i586.xml @@ -51,7 +51,7 @@ <target name="compile-ogl-cg" if="build.cg"> <!-- Compile the wrapper --> <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc"> - <arg line="-w -m32 -mcpu=i386 -I${java.home}/../include -I${java.home}/../include/linux -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/CgWrapper.c"/> + <arg line="-m32 -mcpu=i386 -I${java.home}/../include -I${java.home}/../include/linux -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/CgWrapper.c"/> </exec> <!-- Create the wrapper library --> |