From: Caspian Rychlik-P. <ci...@us...> - 2002-10-15 20:30:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv1691/src/native/win32 Modified Files: org_lwjgl_opengl_CoreGL.cpp MatrixOpCommon.cpp Log Message: Fixed native matrix code so it compiles. Added EXT_paletted_texture functions to CoreGL - whoops Index: org_lwjgl_opengl_CoreGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_CoreGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_CoreGL.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_opengl_CoreGL.cpp 15 Aug 2002 16:08:16 -0000 1.5 +++ org_lwjgl_opengl_CoreGL.cpp 15 Oct 2002 20:30:44 -0000 1.6 @@ -3149,3 +3149,79 @@ CHECK_GL_ERROR } + void GetColorTableEXT( + enum target, + enum format, + enum type, + void *data); + + void GetColorTableParameterivEXT( + enum target, + enum pname, + int *params); + + void GetColorTableParameterfvEXT( + enum target, + enum pname, + float *params); + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: colorTable + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_colorTable + (JNIEnv * env, jobject obj, jint target, jint internalFormat, jint width, jint format, jint type, jint data) +{ + glColorTable(target, internalFormat, width, format, type, (const void *) data); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: colorSubTable + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_colorSubTable + (JNIEnv * env, jobject obj, jint target, jint start, jint count, jint format, jint type, jint data) +{ + glColorSubTable(target, start, count, format, type, (const void *) data); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: getColorTable + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_getColorTable + (JNIEnv * env, jobject obj, jint target, jint format, jint type, jint data) +{ + glGetColorTable(target, format, type, (void *) data); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: getColorTableParameteriv + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_getColorTableParameteriv + (JNIEnv * env, jobject obj, jint target, jint pname, jint params) +{ + glGetColorTableParameteriv(target, pname, (int *)params); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: getColorTableParameterfv + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_getColorTableParameterfv + (JNIEnv * env, jobject obj, jint target, jint pname, jint params) +{ + glGetColorTableParameterfv(target, pname, (float *)params); + CHECK_GL_ERROR +} + Index: MatrixOpCommon.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- MatrixOpCommon.cpp 28 Sep 2002 16:53:13 -0000 1.4 +++ MatrixOpCommon.cpp 15 Oct 2002 20:30:45 -0000 1.5 @@ -1,6 +1,7 @@ //#include <iostream> #include <jni.h> +#include <memory.h> #include "MatrixOpCommon.h" bool Matrix::identicalDataSpaces(Matrix & other) @@ -308,6 +309,11 @@ float determinant (const float * matrix , int side) { + + // We'll keep a scratch bit of memory around for doing temporary calculations: + static int current_side_size = 0; + static float * temp_matrix = NULL; + // we are assuming for this case that the data is in column major format float det = 0; @@ -318,7 +324,13 @@ else { int temp_side = side - 1; // the dimensions of the sub matrix - float temp_matrix [temp_side * temp_side]; // hold a sub matrix of this matrix + if (temp_side > current_side_size) { + if (temp_matrix) + delete[] temp_matrix; + current_side_size = temp_side; + temp_matrix = new float[current_side_size * current_side_size]; + } + bool sign_pos = 1; // the sign is positive for (int row = 0; row < side; row++) |