diff --git a/src/native/common/org_lwjgl_opengl_CoreGL.h b/src/native/common/org_lwjgl_opengl_CoreGL.h index 4986f101..bdd82d11 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL.h +++ b/src/native/common/org_lwjgl_opengl_CoreGL.h @@ -26,6 +26,46 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_accum JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_alphaFunc (JNIEnv *, jobject, jint, jfloat); +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: colorTable + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_colorTable + (JNIEnv *, jobject, jint, jint, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: colorSubTable + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_colorSubTable + (JNIEnv *, jobject, jint, jint, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: getColorTable + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_getColorTable + (JNIEnv *, jobject, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: getColorTableParameteriv + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_getColorTableParameteriv + (JNIEnv *, jobject, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL + * Method: getColorTableParameterfv + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_getColorTableParameterfv + (JNIEnv *, jobject, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL * Method: clearColor diff --git a/src/native/win32/MatrixOpCommon.cpp b/src/native/win32/MatrixOpCommon.cpp index 36347099..94643062 100644 --- a/src/native/win32/MatrixOpCommon.cpp +++ b/src/native/win32/MatrixOpCommon.cpp @@ -1,6 +1,7 @@ //#include #include +#include #include "MatrixOpCommon.h" bool Matrix::identicalDataSpaces(Matrix & other) @@ -308,6 +309,11 @@ void subMatrix (const float * src, int side, float * dst , int col_omit, int row 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 @@ float determinant (const float * matrix , int side) 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++) diff --git a/src/native/win32/org_lwjgl_opengl_CoreGL.cpp b/src/native/win32/org_lwjgl_opengl_CoreGL.cpp index bfa6ee8e..eb687a56 100644 --- a/src/native/win32/org_lwjgl_opengl_CoreGL.cpp +++ b/src/native/win32/org_lwjgl_opengl_CoreGL.cpp @@ -3149,3 +3149,79 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL_viewport(JNIEnv * env, jobje 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 +} +