diff options
author | Sven Gothel <[email protected]> | 2001-02-13 05:32:07 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2001-02-13 05:32:07 +0000 |
commit | 3e2b16a820bfe03f8f3837c3aaa615c8c4b7f18c (patch) | |
tree | d834a05eb37751b4c95045c3021589f2e22fcd9f /CNativeCode | |
parent | 91bc9d109b2d16e6d42f1fbcc9d3dbca51c40b69 (diff) |
JAWT Support JDK >=1.3
Diffstat (limited to 'CNativeCode')
-rw-r--r-- | CNativeCode/OpenGLU_JauJNI12_funcs.c | 381 | ||||
-rw-r--r-- | CNativeCode/OpenGLU_JauJNI12tst_funcs.c | 381 | ||||
-rw-r--r-- | CNativeCode/OpenGLU_JauJNI_funcs.c | 381 | ||||
-rw-r--r-- | CNativeCode/OpenGLU_JauJNInf_funcs.c | 381 | ||||
-rw-r--r-- | CNativeCode/OpenGLU_JauJNItst_funcs.c | 381 | ||||
-rw-r--r-- | CNativeCode/OpenGLU_funcs.c.skel | 32 | ||||
-rw-r--r-- | CNativeCode/OpenGL_JauJNI12_dynfuncs.c | 4 | ||||
-rw-r--r-- | CNativeCode/OpenGL_JauJNI12tst_dynfuncs.c | 4 | ||||
-rw-r--r-- | CNativeCode/OpenGL_JauJNI_dynfuncs.c | 4 | ||||
-rw-r--r-- | CNativeCode/OpenGL_JauJNInf_dynfuncs.c | 4 | ||||
-rw-r--r-- | CNativeCode/OpenGL_JauJNItst_dynfuncs.c | 4 | ||||
-rwxr-xr-x | CNativeCode/OpenGL_Win32.c | 817 | ||||
-rwxr-xr-x | CNativeCode/OpenGL_Win32_JDirect.c | 32 | ||||
-rw-r--r-- | CNativeCode/OpenGL_X11.c | 837 | ||||
-rw-r--r-- | CNativeCode/OpenGL_misc.c | 38 | ||||
-rw-r--r-- | CNativeCode/OpenGL_misc.h | 13 | ||||
-rw-r--r-- | CNativeCode/jni12tools.c | 12 | ||||
-rw-r--r-- | CNativeCode/jnitools.c | 13 | ||||
-rw-r--r-- | CNativeCode/jnitools.h | 8 |
19 files changed, 1149 insertions, 2578 deletions
diff --git a/CNativeCode/OpenGLU_JauJNI12_funcs.c b/CNativeCode/OpenGLU_JauJNI12_funcs.c index 32fb88d..5ad9e76 100644 --- a/CNativeCode/OpenGLU_JauJNI12_funcs.c +++ b/CNativeCode/OpenGLU_JauJNI12_funcs.c @@ -16,40 +16,14 @@ * September 1997
*/
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <jni.h>
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLUFuncJauJNI.h"
/*--------------------------------------------------------------------------
* here on in is just regular apple pie C
*/
-/*
- * next put any specific header files that are necessary to implement
- * this native code
- */
-#include<GL/gl.h>
-#include <GL/glu.h>
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNI.h"
#include "GLCallbackHelperJNI.h"
#include "GLUCallbackJNI.h"
@@ -103,7 +77,7 @@ Java_gl4java_GLUFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } static void _AddCallbackNode(JNIEnv *env, - jint qnt_obj, jint which, + jlong qnt_obj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -122,7 +96,7 @@ static void _AddCallbackNode(JNIEnv *env, AddCallbackNode(env, methodClassInstance, strMethodName, strSignature, arrayLen1, arrayLen2, arrayLen3, arrayLen4, arrayLen5, - (void *)qnt_obj, which, glx); + (void *)((PointerHolder)qnt_obj), which, glx); free(strMethodName); free(strSignature); } @@ -130,7 +104,7 @@ static void _AddCallbackNode(JNIEnv *env, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, - jint qobj, jint which, + jlong qobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -138,8 +112,8 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluQuadricCallback((void *)qobj, which, - cbf_GLU_ERROR ); + gluQuadricCallback((void *)((PointerHolder)qobj), + which, cbf_GLU_ERROR ); break; default: jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !"); @@ -154,7 +128,7 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, - jint nobj, jint which, + jlong nobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -162,7 +136,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluNurbsCallback((void *)nobj, which, + gluNurbsCallback((void *)((PointerHolder)nobj), which, cbf_GLU_ERROR ); break; default: @@ -177,7 +151,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, - jint tobj, jint which, + jlong tobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -190,51 +164,63 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_TESS_BEGIN: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN ); break; case GLU_TESS_BEGIN_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN_DATA ); break; case GLU_TESS_EDGE_FLAG: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG ); break; case GLU_TESS_EDGE_FLAG_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG_DATA ); break; case GLU_TESS_VERTEX: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX ); break; case GLU_TESS_VERTEX_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX_DATA ); break; case GLU_TESS_END: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END ); break; case GLU_TESS_END_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END_DATA ); break; case GLU_TESS_ERROR: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR ); break; case GLU_TESS_ERROR_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR_DATA ); break; case GLU_TESS_COMBINE: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE ); break; case GLU_TESS_COMBINE_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE_DATA ); break; default: @@ -250,30 +236,48 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteQuadric( JNIEnv *env, jobject obj, - jint qobj ) + jlong qobj ) { - gluDeleteQuadric((void *)qobj); - RemoveCallbackNodes((void *)qobj); + gluDeleteQuadric((void *)((PointerHolder)qobj)); + RemoveCallbackNodes((void *)((PointerHolder)qobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj, - jint nobj ) + jlong nobj ) { - gluDeleteNurbsRenderer((void *)nobj); - RemoveCallbackNodes((void *)nobj); + gluDeleteNurbsRenderer((void *)((PointerHolder)nobj)); + RemoveCallbackNodes((void *)((PointerHolder)nobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, - jint tobj ) + jlong tobj ) +{ + gluDeleteTess((GLUtesselator *)((PointerHolder)tobj)); + RemoveCallbackNodes((void *)((PointerHolder)tobj)); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewQuadric( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewQuadric()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewNurbsRenderer()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewTess( JNIEnv *env, jobject obj) { - gluDeleteTess((GLUtesselator *)tobj); - RemoveCallbackNodes((void *)tobj); + return (jlong)((PointerHolder)gluNewTess()); } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . * Destination-Class: gl4java_GLUFuncJauJNI ! @@ -1134,37 +1138,18 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUquadricObj * gluNewQuadric ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewQuadric ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewQuadric ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricDrawStyle ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint drawStyle) { gluQuadricDrawStyle ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) drawStyle ); @@ -1179,12 +1164,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricOrientation ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint orientation) { gluQuadricOrientation ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) orientation ); @@ -1199,12 +1184,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricNormals ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint normals) { gluQuadricNormals ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) normals ); @@ -1219,12 +1204,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricTexture ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jboolean textureCoords) { gluQuadricTexture ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLboolean) textureCoords ); @@ -1239,7 +1224,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluCylinder ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble baseRadius, jdouble topRadius, jdouble height, @@ -1248,7 +1233,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluCylinder ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) baseRadius, (GLdouble) topRadius, (GLdouble) height, @@ -1267,14 +1252,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluSphere ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble radius, jint slices, jint stacks) { gluSphere ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) radius, (GLint) slices, (GLint) stacks @@ -1291,7 +1276,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1299,7 +1284,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1317,7 +1302,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPartialDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1327,7 +1312,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluPartialDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1341,32 +1326,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUnurbsObj * gluNewNurbsRenderer ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewNurbsRenderer ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluLoadSamplingMatrices ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jfloatArray modelMatrix, jfloatArray projMatrix, jintArray viewport) @@ -1388,7 +1354,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr3 = (jint *) (*env)->GetPrimitiveArrayCritical(env, viewport, 0); } gluLoadSamplingMatrices ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (const GLfloat *) ptr1, (const GLfloat *) ptr2, (const GLint *) ptr3 @@ -1417,13 +1383,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloat value) { gluNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat) value ); @@ -1439,7 +1405,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloatArray value) { @@ -1451,7 +1417,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jfloat *) (*env)->GetPrimitiveArrayCritical(env, value, &isCopiedArray2); } gluGetNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat *) ptr2 ); @@ -1471,11 +1437,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1489,11 +1455,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1507,7 +1473,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint nknots, jfloatArray knot, jint stride, @@ -1529,7 +1495,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr4 = (jfloat *) (*env)->GetPrimitiveArrayCritical(env, ctlarray, &isCopiedArray4); } gluNurbsCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) nknots, (GLfloat *) ptr2, (GLint) stride, @@ -1557,11 +1523,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1575,11 +1541,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1593,7 +1559,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsSurface ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint sknot_count, jfloatArray sknot, jint tknot_count, @@ -1625,7 +1591,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr7 = (jfloat *) (*env)->GetPrimitiveArrayCritical(env, ctlarray, &isCopiedArray7); } gluNurbsSurface ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) sknot_count, (GLfloat *) ptr2, (GLint) tknot_count, @@ -1661,11 +1627,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1679,11 +1645,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1697,7 +1663,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPwlCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint count, jfloatArray array, jint stride, @@ -1711,7 +1677,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jfloat *) (*env)->GetPrimitiveArrayCritical(env, array, &isCopiedArray2); } gluPwlCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) count, (GLfloat *) ptr2, (GLint) stride, @@ -1727,32 +1693,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUtesselator * gluNewTess ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewTess ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewTess ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ; * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbyteArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1763,7 +1710,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jbyte *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1773,9 +1720,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jshortArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1786,7 +1733,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jshort *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1796,9 +1743,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jintArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1809,7 +1756,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jint *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1819,9 +1766,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jfloatArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1832,7 +1779,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jfloat *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1842,9 +1789,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1855,7 +1802,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jdouble *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1865,9 +1812,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbooleanArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1878,7 +1825,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jboolean *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1888,9 +1835,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jlongArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1901,7 +1848,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (jlong *) (*env)->GetPrimitiveArrayCritical(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1920,11 +1867,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessBeginContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessBeginContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -1936,9 +1883,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbyteArray vertex_data) { @@ -1956,7 +1903,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jbyte *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -1971,9 +1918,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jshortArray vertex_data) { @@ -1991,7 +1938,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jshort *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2006,9 +1953,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jintArray vertex_data) { @@ -2026,7 +1973,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jint *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2041,9 +1988,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jfloatArray vertex_data) { @@ -2061,7 +2008,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jfloat *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2076,9 +2023,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jdoubleArray vertex_data) { @@ -2096,7 +2043,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jdouble *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2111,9 +2058,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbooleanArray vertex_data) { @@ -2131,7 +2078,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jboolean *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2146,9 +2093,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jlongArray vertex_data) { @@ -2166,7 +2113,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jlong *) (*env)->GetPrimitiveArrayCritical(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2190,11 +2137,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2208,11 +2155,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2226,13 +2173,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdouble value) { gluTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble) value ); @@ -2248,14 +2195,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessNormal ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdouble x, jdouble y, jdouble z) { gluTessNormal ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble) x, (GLdouble) y, (GLdouble) z @@ -2272,7 +2219,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdoubleArray value) { @@ -2284,7 +2231,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (jdouble *) (*env)->GetPrimitiveArrayCritical(env, value, &isCopiedArray2); } gluGetTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble *) ptr2 ); @@ -2304,11 +2251,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluBeginPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2322,12 +2269,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNextContour ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint type) { gluNextContour ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) type ); @@ -2342,13 +2289,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGLU_JauJNI12tst_funcs.c b/CNativeCode/OpenGLU_JauJNI12tst_funcs.c index 9b78767..1fc3b2c 100644 --- a/CNativeCode/OpenGLU_JauJNI12tst_funcs.c +++ b/CNativeCode/OpenGLU_JauJNI12tst_funcs.c @@ -16,40 +16,14 @@ * September 1997
*/
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <jni.h>
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLUFuncJauJNI.h"
/*--------------------------------------------------------------------------
* here on in is just regular apple pie C
*/
-/*
- * next put any specific header files that are necessary to implement
- * this native code
- */
-#include<GL/gl.h>
-#include <GL/glu.h>
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNI.h"
#include "GLCallbackHelperJNI.h"
#include "GLUCallbackJNI.h"
@@ -103,7 +77,7 @@ Java_gl4java_GLUFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } static void _AddCallbackNode(JNIEnv *env, - jint qnt_obj, jint which, + jlong qnt_obj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -122,7 +96,7 @@ static void _AddCallbackNode(JNIEnv *env, AddCallbackNode(env, methodClassInstance, strMethodName, strSignature, arrayLen1, arrayLen2, arrayLen3, arrayLen4, arrayLen5, - (void *)qnt_obj, which, glx); + (void *)((PointerHolder)qnt_obj), which, glx); free(strMethodName); free(strSignature); } @@ -130,7 +104,7 @@ static void _AddCallbackNode(JNIEnv *env, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, - jint qobj, jint which, + jlong qobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -138,8 +112,8 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluQuadricCallback((void *)qobj, which, - cbf_GLU_ERROR ); + gluQuadricCallback((void *)((PointerHolder)qobj), + which, cbf_GLU_ERROR ); break; default: jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !"); @@ -154,7 +128,7 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, - jint nobj, jint which, + jlong nobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -162,7 +136,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluNurbsCallback((void *)nobj, which, + gluNurbsCallback((void *)((PointerHolder)nobj), which, cbf_GLU_ERROR ); break; default: @@ -177,7 +151,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, - jint tobj, jint which, + jlong tobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -190,51 +164,63 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_TESS_BEGIN: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN ); break; case GLU_TESS_BEGIN_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN_DATA ); break; case GLU_TESS_EDGE_FLAG: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG ); break; case GLU_TESS_EDGE_FLAG_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG_DATA ); break; case GLU_TESS_VERTEX: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX ); break; case GLU_TESS_VERTEX_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX_DATA ); break; case GLU_TESS_END: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END ); break; case GLU_TESS_END_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END_DATA ); break; case GLU_TESS_ERROR: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR ); break; case GLU_TESS_ERROR_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR_DATA ); break; case GLU_TESS_COMBINE: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE ); break; case GLU_TESS_COMBINE_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE_DATA ); break; default: @@ -250,30 +236,48 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteQuadric( JNIEnv *env, jobject obj, - jint qobj ) + jlong qobj ) { - gluDeleteQuadric((void *)qobj); - RemoveCallbackNodes((void *)qobj); + gluDeleteQuadric((void *)((PointerHolder)qobj)); + RemoveCallbackNodes((void *)((PointerHolder)qobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj, - jint nobj ) + jlong nobj ) { - gluDeleteNurbsRenderer((void *)nobj); - RemoveCallbackNodes((void *)nobj); + gluDeleteNurbsRenderer((void *)((PointerHolder)nobj)); + RemoveCallbackNodes((void *)((PointerHolder)nobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, - jint tobj ) + jlong tobj ) +{ + gluDeleteTess((GLUtesselator *)((PointerHolder)tobj)); + RemoveCallbackNodes((void *)((PointerHolder)tobj)); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewQuadric( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewQuadric()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewNurbsRenderer()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewTess( JNIEnv *env, jobject obj) { - gluDeleteTess((GLUtesselator *)tobj); - RemoveCallbackNodes((void *)tobj); + return (jlong)((PointerHolder)gluNewTess()); } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . * Destination-Class: gl4java_GLUFuncJauJNI ! @@ -1300,37 +1304,18 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUquadricObj * gluNewQuadric ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewQuadric ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewQuadric ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricDrawStyle ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint drawStyle) { gluQuadricDrawStyle ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) drawStyle ); @@ -1345,12 +1330,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricOrientation ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint orientation) { gluQuadricOrientation ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) orientation ); @@ -1365,12 +1350,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricNormals ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint normals) { gluQuadricNormals ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) normals ); @@ -1385,12 +1370,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricTexture ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jboolean textureCoords) { gluQuadricTexture ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLboolean) textureCoords ); @@ -1405,7 +1390,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluCylinder ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble baseRadius, jdouble topRadius, jdouble height, @@ -1414,7 +1399,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluCylinder ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) baseRadius, (GLdouble) topRadius, (GLdouble) height, @@ -1433,14 +1418,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluSphere ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble radius, jint slices, jint stacks) { gluSphere ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) radius, (GLint) slices, (GLint) stacks @@ -1457,7 +1442,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1465,7 +1450,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1483,7 +1468,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPartialDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1493,7 +1478,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluPartialDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1507,32 +1492,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUnurbsObj * gluNewNurbsRenderer ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewNurbsRenderer ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluLoadSamplingMatrices ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jfloatArray modelMatrix, jfloatArray projMatrix, jintArray viewport) @@ -1572,7 +1538,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluLoadSamplingMatrices ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (const GLfloat *) ptr1, (const GLfloat *) ptr2, (const GLint *) ptr3 @@ -1601,13 +1567,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloat value) { gluNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat) value ); @@ -1623,7 +1589,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloatArray value) { @@ -1640,7 +1606,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluGetNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat *) ptr2 ); @@ -1660,11 +1626,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1678,11 +1644,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1696,7 +1662,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint nknots, jfloatArray knot, jint stride, @@ -1728,7 +1694,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluNurbsCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) nknots, (GLfloat *) ptr2, (GLint) stride, @@ -1756,11 +1722,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1774,11 +1740,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1792,7 +1758,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsSurface ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint sknot_count, jfloatArray sknot, jint tknot_count, @@ -1839,7 +1805,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluNurbsSurface ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) sknot_count, (GLfloat *) ptr2, (GLint) tknot_count, @@ -1875,11 +1841,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1893,11 +1859,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1911,7 +1877,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPwlCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint count, jfloatArray array, jint stride, @@ -1930,7 +1896,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluPwlCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) count, (GLfloat *) ptr2, (GLint) stride, @@ -1946,32 +1912,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUtesselator * gluNewTess ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewTess ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewTess ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ; * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbyteArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1987,7 +1934,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1997,9 +1944,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jshortArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2015,7 +1962,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2025,9 +1972,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jintArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2043,7 +1990,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2053,9 +2000,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jfloatArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2071,7 +2018,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2081,9 +2028,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2099,7 +2046,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2109,9 +2056,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbooleanArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2127,7 +2074,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2137,9 +2084,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jlongArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2155,7 +2102,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2174,11 +2121,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessBeginContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessBeginContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2190,9 +2137,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbyteArray vertex_data) { @@ -2220,7 +2167,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2235,9 +2182,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jshortArray vertex_data) { @@ -2265,7 +2212,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2280,9 +2227,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jintArray vertex_data) { @@ -2310,7 +2257,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2325,9 +2272,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jfloatArray vertex_data) { @@ -2355,7 +2302,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2370,9 +2317,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jdoubleArray vertex_data) { @@ -2400,7 +2347,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2415,9 +2362,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbooleanArray vertex_data) { @@ -2445,7 +2392,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2460,9 +2407,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jlongArray vertex_data) { @@ -2490,7 +2437,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2514,11 +2461,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2532,11 +2479,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2550,13 +2497,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdouble value) { gluTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble) value ); @@ -2572,14 +2519,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessNormal ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdouble x, jdouble y, jdouble z) { gluTessNormal ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble) x, (GLdouble) y, (GLdouble) z @@ -2596,7 +2543,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdoubleArray value) { @@ -2613,7 +2560,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluGetTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble *) ptr2 ); @@ -2633,11 +2580,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluBeginPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2651,12 +2598,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNextContour ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint type) { gluNextContour ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) type ); @@ -2671,13 +2618,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGLU_JauJNI_funcs.c b/CNativeCode/OpenGLU_JauJNI_funcs.c index 55b3351..1fda2a3 100644 --- a/CNativeCode/OpenGLU_JauJNI_funcs.c +++ b/CNativeCode/OpenGLU_JauJNI_funcs.c @@ -16,40 +16,14 @@ * September 1997
*/
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <jni.h>
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLUFuncJauJNI.h"
/*--------------------------------------------------------------------------
* here on in is just regular apple pie C
*/
-/*
- * next put any specific header files that are necessary to implement
- * this native code
- */
-#include<GL/gl.h>
-#include <GL/glu.h>
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNI.h"
#include "GLCallbackHelperJNI.h"
#include "GLUCallbackJNI.h"
@@ -103,7 +77,7 @@ Java_gl4java_GLUFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } static void _AddCallbackNode(JNIEnv *env, - jint qnt_obj, jint which, + jlong qnt_obj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -122,7 +96,7 @@ static void _AddCallbackNode(JNIEnv *env, AddCallbackNode(env, methodClassInstance, strMethodName, strSignature, arrayLen1, arrayLen2, arrayLen3, arrayLen4, arrayLen5, - (void *)qnt_obj, which, glx); + (void *)((PointerHolder)qnt_obj), which, glx); free(strMethodName); free(strSignature); } @@ -130,7 +104,7 @@ static void _AddCallbackNode(JNIEnv *env, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, - jint qobj, jint which, + jlong qobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -138,8 +112,8 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluQuadricCallback((void *)qobj, which, - cbf_GLU_ERROR ); + gluQuadricCallback((void *)((PointerHolder)qobj), + which, cbf_GLU_ERROR ); break; default: jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !"); @@ -154,7 +128,7 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, - jint nobj, jint which, + jlong nobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -162,7 +136,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluNurbsCallback((void *)nobj, which, + gluNurbsCallback((void *)((PointerHolder)nobj), which, cbf_GLU_ERROR ); break; default: @@ -177,7 +151,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, - jint tobj, jint which, + jlong tobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -190,51 +164,63 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_TESS_BEGIN: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN ); break; case GLU_TESS_BEGIN_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN_DATA ); break; case GLU_TESS_EDGE_FLAG: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG ); break; case GLU_TESS_EDGE_FLAG_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG_DATA ); break; case GLU_TESS_VERTEX: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX ); break; case GLU_TESS_VERTEX_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX_DATA ); break; case GLU_TESS_END: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END ); break; case GLU_TESS_END_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END_DATA ); break; case GLU_TESS_ERROR: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR ); break; case GLU_TESS_ERROR_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR_DATA ); break; case GLU_TESS_COMBINE: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE ); break; case GLU_TESS_COMBINE_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE_DATA ); break; default: @@ -250,30 +236,48 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteQuadric( JNIEnv *env, jobject obj, - jint qobj ) + jlong qobj ) { - gluDeleteQuadric((void *)qobj); - RemoveCallbackNodes((void *)qobj); + gluDeleteQuadric((void *)((PointerHolder)qobj)); + RemoveCallbackNodes((void *)((PointerHolder)qobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj, - jint nobj ) + jlong nobj ) { - gluDeleteNurbsRenderer((void *)nobj); - RemoveCallbackNodes((void *)nobj); + gluDeleteNurbsRenderer((void *)((PointerHolder)nobj)); + RemoveCallbackNodes((void *)((PointerHolder)nobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, - jint tobj ) + jlong tobj ) +{ + gluDeleteTess((GLUtesselator *)((PointerHolder)tobj)); + RemoveCallbackNodes((void *)((PointerHolder)tobj)); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewQuadric( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewQuadric()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewNurbsRenderer()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewTess( JNIEnv *env, jobject obj) { - gluDeleteTess((GLUtesselator *)tobj); - RemoveCallbackNodes((void *)tobj); + return (jlong)((PointerHolder)gluNewTess()); } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . * Destination-Class: gl4java_GLUFuncJauJNI ! @@ -1134,37 +1138,18 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUquadricObj * gluNewQuadric ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewQuadric ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewQuadric ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricDrawStyle ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint drawStyle) { gluQuadricDrawStyle ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) drawStyle ); @@ -1179,12 +1164,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricOrientation ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint orientation) { gluQuadricOrientation ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) orientation ); @@ -1199,12 +1184,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricNormals ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint normals) { gluQuadricNormals ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) normals ); @@ -1219,12 +1204,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricTexture ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jboolean textureCoords) { gluQuadricTexture ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLboolean) textureCoords ); @@ -1239,7 +1224,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluCylinder ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble baseRadius, jdouble topRadius, jdouble height, @@ -1248,7 +1233,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluCylinder ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) baseRadius, (GLdouble) topRadius, (GLdouble) height, @@ -1267,14 +1252,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluSphere ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble radius, jint slices, jint stacks) { gluSphere ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) radius, (GLint) slices, (GLint) stacks @@ -1291,7 +1276,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1299,7 +1284,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1317,7 +1302,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPartialDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1327,7 +1312,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluPartialDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1341,32 +1326,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUnurbsObj * gluNewNurbsRenderer ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewNurbsRenderer ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluLoadSamplingMatrices ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jfloatArray modelMatrix, jfloatArray projMatrix, jintArray viewport) @@ -1388,7 +1354,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr3 = (*env)->GetIntArrayElements(env, viewport, 0); } gluLoadSamplingMatrices ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (const GLfloat *) ptr1, (const GLfloat *) ptr2, (const GLint *) ptr3 @@ -1417,13 +1383,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloat value) { gluNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat) value ); @@ -1439,7 +1405,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloatArray value) { @@ -1451,7 +1417,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetFloatArrayElements(env, value, &isCopiedArray2); } gluGetNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat *) ptr2 ); @@ -1471,11 +1437,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1489,11 +1455,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1507,7 +1473,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint nknots, jfloatArray knot, jint stride, @@ -1529,7 +1495,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr4 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray4); } gluNurbsCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) nknots, (GLfloat *) ptr2, (GLint) stride, @@ -1557,11 +1523,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1575,11 +1541,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1593,7 +1559,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsSurface ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint sknot_count, jfloatArray sknot, jint tknot_count, @@ -1625,7 +1591,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr7 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray7); } gluNurbsSurface ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) sknot_count, (GLfloat *) ptr2, (GLint) tknot_count, @@ -1661,11 +1627,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1679,11 +1645,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1697,7 +1663,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPwlCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint count, jfloatArray array, jint stride, @@ -1711,7 +1677,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetFloatArrayElements(env, array, &isCopiedArray2); } gluPwlCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) count, (GLfloat *) ptr2, (GLint) stride, @@ -1727,32 +1693,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUtesselator * gluNewTess ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewTess ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewTess ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ; * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbyteArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1763,7 +1710,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetByteArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1773,9 +1720,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jshortArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1786,7 +1733,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetShortArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1796,9 +1743,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jintArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1809,7 +1756,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetIntArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1819,9 +1766,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jfloatArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1832,7 +1779,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetFloatArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1842,9 +1789,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1855,7 +1802,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetDoubleArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1865,9 +1812,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbooleanArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1878,7 +1825,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetBooleanArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1888,9 +1835,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jlongArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1901,7 +1848,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetLongArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1920,11 +1867,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessBeginContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessBeginContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -1936,9 +1883,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbyteArray vertex_data) { @@ -1956,7 +1903,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetByteArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -1971,9 +1918,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jshortArray vertex_data) { @@ -1991,7 +1938,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetShortArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2006,9 +1953,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jintArray vertex_data) { @@ -2026,7 +1973,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetIntArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2041,9 +1988,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jfloatArray vertex_data) { @@ -2061,7 +2008,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetFloatArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2076,9 +2023,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jdoubleArray vertex_data) { @@ -2096,7 +2043,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetDoubleArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2111,9 +2058,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbooleanArray vertex_data) { @@ -2131,7 +2078,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetBooleanArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2146,9 +2093,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jlongArray vertex_data) { @@ -2166,7 +2113,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetLongArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2190,11 +2137,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2208,11 +2155,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2226,13 +2173,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdouble value) { gluTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble) value ); @@ -2248,14 +2195,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessNormal ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdouble x, jdouble y, jdouble z) { gluTessNormal ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble) x, (GLdouble) y, (GLdouble) z @@ -2272,7 +2219,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdoubleArray value) { @@ -2284,7 +2231,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetDoubleArrayElements(env, value, &isCopiedArray2); } gluGetTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble *) ptr2 ); @@ -2304,11 +2251,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluBeginPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2322,12 +2269,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNextContour ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint type) { gluNextContour ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) type ); @@ -2342,13 +2289,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGLU_JauJNInf_funcs.c b/CNativeCode/OpenGLU_JauJNInf_funcs.c index 25ac6eb..9860fad 100644 --- a/CNativeCode/OpenGLU_JauJNInf_funcs.c +++ b/CNativeCode/OpenGLU_JauJNInf_funcs.c @@ -16,40 +16,14 @@ * September 1997
*/
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <jni.h>
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLUFuncJauJNInf.h"
/*--------------------------------------------------------------------------
* here on in is just regular apple pie C
*/
-/*
- * next put any specific header files that are necessary to implement
- * this native code
- */
-#include<GL/gl.h>
-#include <GL/glu.h>
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNInf.h"
#include "GLCallbackHelperJNI.h"
#include "GLUCallbackJNI.h"
@@ -103,7 +77,7 @@ Java_gl4java_GLUFuncJauJNInf_getNativeVersion ( JNIEnv *env, jobject obj ) } static void _AddCallbackNode(JNIEnv *env, - jint qnt_obj, jint which, + jlong qnt_obj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -122,7 +96,7 @@ static void _AddCallbackNode(JNIEnv *env, AddCallbackNode(env, methodClassInstance, strMethodName, strSignature, arrayLen1, arrayLen2, arrayLen3, arrayLen4, arrayLen5, - (void *)qnt_obj, which, glx); + (void *)((PointerHolder)qnt_obj), which, glx); free(strMethodName); free(strSignature); } @@ -130,7 +104,7 @@ static void _AddCallbackNode(JNIEnv *env, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluQuadricCallback( JNIEnv *env, jobject obj, - jint qobj, jint which, + jlong qobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -138,8 +112,8 @@ Java_gl4java_GLUFuncJauJNInf_gluQuadricCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluQuadricCallback((void *)qobj, which, - cbf_GLU_ERROR ); + gluQuadricCallback((void *)((PointerHolder)qobj), + which, cbf_GLU_ERROR ); break; default: jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !"); @@ -154,7 +128,7 @@ Java_gl4java_GLUFuncJauJNInf_gluQuadricCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluNurbsCallback( JNIEnv *env, jobject obj, - jint nobj, jint which, + jlong nobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -162,7 +136,7 @@ Java_gl4java_GLUFuncJauJNInf_gluNurbsCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluNurbsCallback((void *)nobj, which, + gluNurbsCallback((void *)((PointerHolder)nobj), which, cbf_GLU_ERROR ); break; default: @@ -177,7 +151,7 @@ Java_gl4java_GLUFuncJauJNInf_gluNurbsCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluTessCallback( JNIEnv *env, jobject obj, - jint tobj, jint which, + jlong tobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -190,51 +164,63 @@ Java_gl4java_GLUFuncJauJNInf_gluTessCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_TESS_BEGIN: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN ); break; case GLU_TESS_BEGIN_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN_DATA ); break; case GLU_TESS_EDGE_FLAG: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG ); break; case GLU_TESS_EDGE_FLAG_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG_DATA ); break; case GLU_TESS_VERTEX: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX ); break; case GLU_TESS_VERTEX_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX_DATA ); break; case GLU_TESS_END: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END ); break; case GLU_TESS_END_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END_DATA ); break; case GLU_TESS_ERROR: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR ); break; case GLU_TESS_ERROR_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR_DATA ); break; case GLU_TESS_COMBINE: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE ); break; case GLU_TESS_COMBINE_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE_DATA ); break; default: @@ -250,30 +236,48 @@ Java_gl4java_GLUFuncJauJNInf_gluTessCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluDeleteQuadric( JNIEnv *env, jobject obj, - jint qobj ) + jlong qobj ) { - gluDeleteQuadric((void *)qobj); - RemoveCallbackNodes((void *)qobj); + gluDeleteQuadric((void *)((PointerHolder)qobj)); + RemoveCallbackNodes((void *)((PointerHolder)qobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj, - jint nobj ) + jlong nobj ) { - gluDeleteNurbsRenderer((void *)nobj); - RemoveCallbackNodes((void *)nobj); + gluDeleteNurbsRenderer((void *)((PointerHolder)nobj)); + RemoveCallbackNodes((void *)((PointerHolder)nobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, - jint tobj ) + jlong tobj ) +{ + gluDeleteTess((GLUtesselator *)((PointerHolder)tobj)); + RemoveCallbackNodes((void *)((PointerHolder)tobj)); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNInf_gluNewQuadric( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewQuadric()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNInf_gluNewNurbsRenderer( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewNurbsRenderer()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNInf_gluNewTess( JNIEnv *env, jobject obj) { - gluDeleteTess((GLUtesselator *)tobj); - RemoveCallbackNodes((void *)tobj); + return (jlong)((PointerHolder)gluNewTess()); } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . * Destination-Class: gl4java_GLUFuncJauJNInf ! @@ -1134,37 +1138,18 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUquadricObj * gluNewQuadric ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNInf_gluNewQuadric ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewQuadric ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluQuadricDrawStyle ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint drawStyle) { gluQuadricDrawStyle ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) drawStyle ); @@ -1179,12 +1164,12 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluQuadricOrientation ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint orientation) { gluQuadricOrientation ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) orientation ); @@ -1199,12 +1184,12 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluQuadricNormals ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint normals) { gluQuadricNormals ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) normals ); @@ -1219,12 +1204,12 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluQuadricTexture ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jboolean textureCoords) { gluQuadricTexture ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLboolean) textureCoords ); @@ -1239,7 +1224,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluCylinder ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble baseRadius, jdouble topRadius, jdouble height, @@ -1248,7 +1233,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, { gluCylinder ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) baseRadius, (GLdouble) topRadius, (GLdouble) height, @@ -1267,14 +1252,14 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluSphere ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble radius, jint slices, jint stacks) { gluSphere ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) radius, (GLint) slices, (GLint) stacks @@ -1291,7 +1276,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1299,7 +1284,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, { gluDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1317,7 +1302,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluPartialDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1327,7 +1312,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, { gluPartialDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1341,32 +1326,13 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUnurbsObj * gluNewNurbsRenderer ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNInf_gluNewNurbsRenderer ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewNurbsRenderer ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluLoadSamplingMatrices ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jfloatArray modelMatrix, jfloatArray projMatrix, jintArray viewport) @@ -1388,7 +1354,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr3 = (*env)->GetIntArrayElements(env, viewport, 0); } gluLoadSamplingMatrices ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (const GLfloat *) ptr1, (const GLfloat *) ptr2, (const GLint *) ptr3 @@ -1417,13 +1383,13 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloat value) { gluNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat) value ); @@ -1439,7 +1405,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluGetNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloatArray value) { @@ -1451,7 +1417,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetFloatArrayElements(env, value, &isCopiedArray2); } gluGetNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat *) ptr2 ); @@ -1471,11 +1437,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluBeginCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1489,11 +1455,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluEndCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1507,7 +1473,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluNurbsCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint nknots, jfloatArray knot, jint stride, @@ -1529,7 +1495,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr4 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray4); } gluNurbsCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) nknots, (GLfloat *) ptr2, (GLint) stride, @@ -1557,11 +1523,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluBeginSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1575,11 +1541,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluEndSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1593,7 +1559,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluNurbsSurface ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint sknot_count, jfloatArray sknot, jint tknot_count, @@ -1625,7 +1591,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr7 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray7); } gluNurbsSurface ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) sknot_count, (GLfloat *) ptr2, (GLint) tknot_count, @@ -1661,11 +1627,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluBeginTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1679,11 +1645,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluEndTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1697,7 +1663,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluPwlCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint count, jfloatArray array, jint stride, @@ -1711,7 +1677,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetFloatArrayElements(env, array, &isCopiedArray2); } gluPwlCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) count, (GLfloat *) ptr2, (GLint) stride, @@ -1727,32 +1693,13 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUtesselator * gluNewTess ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNInf_gluNewTess ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewTess ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ; * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3B ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbyteArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1763,7 +1710,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetByteArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1773,9 +1720,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3S ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jshortArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1786,7 +1733,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetShortArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1796,9 +1743,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3I ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jintArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1809,7 +1756,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetIntArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1819,9 +1766,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3F ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jfloatArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1832,7 +1779,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetFloatArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1842,9 +1789,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3D ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1855,7 +1802,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetDoubleArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1865,9 +1812,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3Z ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbooleanArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1878,7 +1825,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetBooleanArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1888,9 +1835,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__I_3J ( + Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jlongArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1901,7 +1848,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr1 = (*env)->GetLongArrayElements(env, polygon_data, &isCopiedArray1); } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1920,11 +1867,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluTessBeginContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessBeginContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -1936,9 +1883,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3B ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbyteArray vertex_data) { @@ -1956,7 +1903,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetByteArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -1971,9 +1918,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3S ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jshortArray vertex_data) { @@ -1991,7 +1938,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetShortArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2006,9 +1953,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3I ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jintArray vertex_data) { @@ -2026,7 +1973,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetIntArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2041,9 +1988,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3F ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jfloatArray vertex_data) { @@ -2061,7 +2008,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetFloatArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2076,9 +2023,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3D ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jdoubleArray vertex_data) { @@ -2096,7 +2043,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetDoubleArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2111,9 +2058,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3Z ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbooleanArray vertex_data) { @@ -2131,7 +2078,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetBooleanArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2146,9 +2093,9 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNInf_gluTessVertex__I_3D_3J ( + Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jlongArray vertex_data) { @@ -2166,7 +2113,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetLongArrayElements(env, vertex_data, &isCopiedArray2); } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2190,11 +2137,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluTessEndContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2208,11 +2155,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluTessEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2226,13 +2173,13 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdouble value) { gluTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble) value ); @@ -2248,14 +2195,14 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluTessNormal ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdouble x, jdouble y, jdouble z) { gluTessNormal ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble) x, (GLdouble) y, (GLdouble) z @@ -2272,7 +2219,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluGetTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdoubleArray value) { @@ -2284,7 +2231,7 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, ptr2 = (*env)->GetDoubleArrayElements(env, value, &isCopiedArray2); } gluGetTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble *) ptr2 ); @@ -2304,11 +2251,11 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluBeginPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluBeginPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2322,12 +2269,12 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluNextContour ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint type) { gluNextContour ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) type ); @@ -2342,13 +2289,13 @@ Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNInf_gluEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGLU_JauJNItst_funcs.c b/CNativeCode/OpenGLU_JauJNItst_funcs.c index 9b78767..1fc3b2c 100644 --- a/CNativeCode/OpenGLU_JauJNItst_funcs.c +++ b/CNativeCode/OpenGLU_JauJNItst_funcs.c @@ -16,40 +16,14 @@ * September 1997
*/
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <jni.h>
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLUFuncJauJNI.h"
/*--------------------------------------------------------------------------
* here on in is just regular apple pie C
*/
-/*
- * next put any specific header files that are necessary to implement
- * this native code
- */
-#include<GL/gl.h>
-#include <GL/glu.h>
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNI.h"
#include "GLCallbackHelperJNI.h"
#include "GLUCallbackJNI.h"
@@ -103,7 +77,7 @@ Java_gl4java_GLUFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } static void _AddCallbackNode(JNIEnv *env, - jint qnt_obj, jint which, + jlong qnt_obj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -122,7 +96,7 @@ static void _AddCallbackNode(JNIEnv *env, AddCallbackNode(env, methodClassInstance, strMethodName, strSignature, arrayLen1, arrayLen2, arrayLen3, arrayLen4, arrayLen5, - (void *)qnt_obj, which, glx); + (void *)((PointerHolder)qnt_obj), which, glx); free(strMethodName); free(strSignature); } @@ -130,7 +104,7 @@ static void _AddCallbackNode(JNIEnv *env, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, - jint qobj, jint which, + jlong qobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -138,8 +112,8 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluQuadricCallback((void *)qobj, which, - cbf_GLU_ERROR ); + gluQuadricCallback((void *)((PointerHolder)qobj), + which, cbf_GLU_ERROR ); break; default: jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !"); @@ -154,7 +128,7 @@ Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, - jint nobj, jint which, + jlong nobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature) @@ -162,7 +136,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_ERROR: - gluNurbsCallback((void *)nobj, which, + gluNurbsCallback((void *)((PointerHolder)nobj), which, cbf_GLU_ERROR ); break; default: @@ -177,7 +151,7 @@ Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, - jint tobj, jint which, + jlong tobj, jint which, jobject methodClassInstance, jstring methodName, jstring signature, @@ -190,51 +164,63 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, switch(which) { case GLU_TESS_BEGIN: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN ); break; case GLU_TESS_BEGIN_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_BEGIN_DATA ); break; case GLU_TESS_EDGE_FLAG: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG ); break; case GLU_TESS_EDGE_FLAG_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_EDGE_FLAG_DATA ); break; case GLU_TESS_VERTEX: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX ); break; case GLU_TESS_VERTEX_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_VERTEX_DATA ); break; case GLU_TESS_END: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END ); break; case GLU_TESS_END_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_END_DATA ); break; case GLU_TESS_ERROR: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR ); break; case GLU_TESS_ERROR_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_ERROR_DATA ); break; case GLU_TESS_COMBINE: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE ); break; case GLU_TESS_COMBINE_DATA: - gluTessCallback((GLUtesselator *)tobj, which, + gluTessCallback((GLUtesselator *)((PointerHolder)tobj), + which, cbf_GLU_TESS_COMBINE_DATA ); break; default: @@ -250,30 +236,48 @@ Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteQuadric( JNIEnv *env, jobject obj, - jint qobj ) + jlong qobj ) { - gluDeleteQuadric((void *)qobj); - RemoveCallbackNodes((void *)qobj); + gluDeleteQuadric((void *)((PointerHolder)qobj)); + RemoveCallbackNodes((void *)((PointerHolder)qobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj, - jint nobj ) + jlong nobj ) { - gluDeleteNurbsRenderer((void *)nobj); - RemoveCallbackNodes((void *)nobj); + gluDeleteNurbsRenderer((void *)((PointerHolder)nobj)); + RemoveCallbackNodes((void *)((PointerHolder)nobj)); } JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, - jint tobj ) + jlong tobj ) +{ + gluDeleteTess((GLUtesselator *)((PointerHolder)tobj)); + RemoveCallbackNodes((void *)((PointerHolder)tobj)); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewQuadric( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewQuadric()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer( JNIEnv *env, jobject obj) +{ + return (jlong)((PointerHolder)gluNewNurbsRenderer()); +} + +JNIEXPORT jlong JNICALL +Java_gl4java_GLUFuncJauJNI_gluNewTess( JNIEnv *env, jobject obj) { - gluDeleteTess((GLUtesselator *)tobj); - RemoveCallbackNodes((void *)tobj); + return (jlong)((PointerHolder)gluNewTess()); } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . * Destination-Class: gl4java_GLUFuncJauJNI ! @@ -1300,37 +1304,18 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUquadricObj * gluNewQuadric ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewQuadric ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewQuadric ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricDrawStyle ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint drawStyle) { gluQuadricDrawStyle ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) drawStyle ); @@ -1345,12 +1330,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricOrientation ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint orientation) { gluQuadricOrientation ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) orientation ); @@ -1365,12 +1350,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricNormals ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jint normals) { gluQuadricNormals ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLenum) normals ); @@ -1385,12 +1370,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluQuadricTexture ( JNIEnv *env, jobject obj, - jint quadObject, + jlong quadObject, jboolean textureCoords) { gluQuadricTexture ( - (GLUquadricObj *) quadObject, + (GLUquadricObj *) (PointerHolder) quadObject, (GLboolean) textureCoords ); @@ -1405,7 +1390,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluCylinder ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble baseRadius, jdouble topRadius, jdouble height, @@ -1414,7 +1399,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluCylinder ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) baseRadius, (GLdouble) topRadius, (GLdouble) height, @@ -1433,14 +1418,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluSphere ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble radius, jint slices, jint stacks) { gluSphere ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) radius, (GLint) slices, (GLint) stacks @@ -1457,7 +1442,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1465,7 +1450,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1483,7 +1468,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPartialDisk ( JNIEnv *env, jobject obj, - jint qobj, + jlong qobj, jdouble innerRadius, jdouble outerRadius, jint slices, @@ -1493,7 +1478,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, { gluPartialDisk ( - (GLUquadricObj *) qobj, + (GLUquadricObj *) (PointerHolder) qobj, (GLdouble) innerRadius, (GLdouble) outerRadius, (GLint) slices, @@ -1507,32 +1492,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUnurbsObj * gluNewNurbsRenderer ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewNurbsRenderer ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ; * </pre> */ JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluLoadSamplingMatrices ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jfloatArray modelMatrix, jfloatArray projMatrix, jintArray viewport) @@ -1572,7 +1538,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluLoadSamplingMatrices ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (const GLfloat *) ptr1, (const GLfloat *) ptr2, (const GLint *) ptr3 @@ -1601,13 +1567,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloat value) { gluNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat) value ); @@ -1623,7 +1589,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetNurbsProperty ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint property, jfloatArray value) { @@ -1640,7 +1606,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluGetNurbsProperty ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLenum) property, (GLfloat *) ptr2 ); @@ -1660,11 +1626,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1678,11 +1644,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndCurve ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndCurve ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1696,7 +1662,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint nknots, jfloatArray knot, jint stride, @@ -1728,7 +1694,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluNurbsCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) nknots, (GLfloat *) ptr2, (GLint) stride, @@ -1756,11 +1722,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1774,11 +1740,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndSurface ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndSurface ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1792,7 +1758,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNurbsSurface ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint sknot_count, jfloatArray sknot, jint tknot_count, @@ -1839,7 +1805,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluNurbsSurface ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) sknot_count, (GLfloat *) ptr2, (GLint) tknot_count, @@ -1875,11 +1841,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluBeginTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1893,11 +1859,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndTrim ( JNIEnv *env, jobject obj, - jint nobj) + jlong nobj) { gluEndTrim ( - (GLUnurbsObj *) nobj + (GLUnurbsObj *) (PointerHolder) nobj ); } @@ -1911,7 +1877,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluPwlCurve ( JNIEnv *env, jobject obj, - jint nobj, + jlong nobj, jint count, jfloatArray array, jint stride, @@ -1930,7 +1896,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluPwlCurve ( - (GLUnurbsObj *) nobj, + (GLUnurbsObj *) (PointerHolder) nobj, (GLint) count, (GLfloat *) ptr2, (GLint) stride, @@ -1946,32 +1912,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, /** * Original Function-Prototype : * <pre> - extern GLUtesselator * gluNewTess ( void ) ; - * </pre> - */ - JNIEXPORT jint JNICALL - Java_gl4java_GLUFuncJauJNI_gluNewTess ( - JNIEnv *env, jobject obj) - { - jint ret; - - - ret = (jint) gluNewTess ( - ); - - return ret; - } - -/** - * Original Function-Prototype : - * <pre> extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ; * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbyteArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -1987,7 +1934,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -1997,9 +1944,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jshortArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2015,7 +1962,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2025,9 +1972,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jintArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2043,7 +1990,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2053,9 +2000,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jfloatArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2071,7 +2018,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2081,9 +2028,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2099,7 +2046,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2109,9 +2056,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jbooleanArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2127,7 +2074,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2137,9 +2084,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__I_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessBeginPolygon__J_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jlongArray polygon_data) { jboolean isCopiedArray1 = JNI_FALSE; @@ -2155,7 +2102,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessBeginPolygon ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (void *) ptr1 ); @@ -2174,11 +2121,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessBeginContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessBeginContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2190,9 +2137,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, * </pre> */ JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3B ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3B ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbyteArray vertex_data) { @@ -2220,7 +2167,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2235,9 +2182,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3S ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3S ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jshortArray vertex_data) { @@ -2265,7 +2212,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2280,9 +2227,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3I ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3I ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jintArray vertex_data) { @@ -2310,7 +2257,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2325,9 +2272,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3F ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3F ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jfloatArray vertex_data) { @@ -2355,7 +2302,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2370,9 +2317,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3D ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3D ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jdoubleArray vertex_data) { @@ -2400,7 +2347,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2415,9 +2362,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3Z ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3Z ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jbooleanArray vertex_data) { @@ -2445,7 +2392,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2460,9 +2407,9 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } JNIEXPORT void JNICALL - Java_gl4java_GLUFuncJauJNI_gluTessVertex__I_3D_3J ( + Java_gl4java_GLUFuncJauJNI_gluTessVertex__J_3D_3J ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdoubleArray coords, jlongArray vertex_data) { @@ -2490,7 +2437,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluTessVertex ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble *) ptr1, (void *) ptr2 ); @@ -2514,11 +2461,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndContour ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndContour ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2532,11 +2479,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluTessEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2550,13 +2497,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdouble value) { gluTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble) value ); @@ -2572,14 +2519,14 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluTessNormal ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jdouble x, jdouble y, jdouble z) { gluTessNormal ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLdouble) x, (GLdouble) y, (GLdouble) z @@ -2596,7 +2543,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluGetTessProperty ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint which, jdoubleArray value) { @@ -2613,7 +2560,7 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, } } gluGetTessProperty ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) which, (GLdouble *) ptr2 ); @@ -2633,11 +2580,11 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluBeginPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluBeginPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } @@ -2651,12 +2598,12 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluNextContour ( JNIEnv *env, jobject obj, - jint tobj, + jlong tobj, jint type) { gluNextContour ( - (GLUtesselator *) tobj, + (GLUtesselator *) (PointerHolder) tobj, (GLenum) type ); @@ -2671,13 +2618,13 @@ Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj, JNIEXPORT void JNICALL Java_gl4java_GLUFuncJauJNI_gluEndPolygon ( JNIEnv *env, jobject obj, - jint tobj) + jlong tobj) { gluEndPolygon ( - (GLUtesselator *) tobj + (GLUtesselator *) (PointerHolder) tobj ); } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGLU_funcs.c.skel b/CNativeCode/OpenGLU_funcs.c.skel index 81cfda7..bac8027 100644 --- a/CNativeCode/OpenGLU_funcs.c.skel +++ b/CNativeCode/OpenGLU_funcs.c.skel @@ -10,40 +10,14 @@ * September 1997
*/
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <jni.h>
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLUFuncJauJNI.h"
/*--------------------------------------------------------------------------
* here on in is just regular apple pie C
*/
-/*
- * next put any specific header files that are necessary to implement
- * this native code
- */
-#include<GL/gl.h>
-#include <GL/glu.h>
+#include "OpenGL_misc.h"
+
+#include "gl4java_GLUFuncJauJNI.h"
#include "GLCallbackHelperJNI.h"
#include "GLUCallbackJNI.h"
diff --git a/CNativeCode/OpenGL_JauJNI12_dynfuncs.c b/CNativeCode/OpenGL_JauJNI12_dynfuncs.c index 41fd742..27dae89 100644 --- a/CNativeCode/OpenGL_JauJNI12_dynfuncs.c +++ b/CNativeCode/OpenGL_JauJNI12_dynfuncs.c @@ -83,7 +83,7 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: gl-proto-auto.orig.h . . . * Destination-Class: gl4java_GLFuncJauJNI ! @@ -23655,4 +23655,4 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGL_JauJNI12tst_dynfuncs.c b/CNativeCode/OpenGL_JauJNI12tst_dynfuncs.c index 129181f..3c57d01 100644 --- a/CNativeCode/OpenGL_JauJNI12tst_dynfuncs.c +++ b/CNativeCode/OpenGL_JauJNI12tst_dynfuncs.c @@ -83,7 +83,7 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: gl-proto-auto.orig.h . . . * Destination-Class: gl4java_GLFuncJauJNI ! @@ -26452,4 +26452,4 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGL_JauJNI_dynfuncs.c b/CNativeCode/OpenGL_JauJNI_dynfuncs.c index c3d42db..89fd50a 100644 --- a/CNativeCode/OpenGL_JauJNI_dynfuncs.c +++ b/CNativeCode/OpenGL_JauJNI_dynfuncs.c @@ -83,7 +83,7 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: gl-proto-auto.orig.h . . . * Destination-Class: gl4java_GLFuncJauJNI ! @@ -23655,4 +23655,4 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGL_JauJNInf_dynfuncs.c b/CNativeCode/OpenGL_JauJNInf_dynfuncs.c index 455d7df..b29145a 100644 --- a/CNativeCode/OpenGL_JauJNInf_dynfuncs.c +++ b/CNativeCode/OpenGL_JauJNInf_dynfuncs.c @@ -83,7 +83,7 @@ Java_gl4java_GLFuncJauJNInf_getNativeVersion ( JNIEnv *env, jobject obj ) } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: gl-proto-auto.orig.h . . . * Destination-Class: gl4java_GLFuncJauJNInf ! @@ -23655,4 +23655,4 @@ Java_gl4java_GLFuncJauJNInf_getNativeVersion ( JNIEnv *env, jobject obj ) } } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGL_JauJNItst_dynfuncs.c b/CNativeCode/OpenGL_JauJNItst_dynfuncs.c index dfd5950..e81039a 100644 --- a/CNativeCode/OpenGL_JauJNItst_dynfuncs.c +++ b/CNativeCode/OpenGL_JauJNItst_dynfuncs.c @@ -83,7 +83,7 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } /** - * C2J Parser Version 1.4 Beta + * C2J Parser Version 1.5 Beta * Jausoft - Sven Goethel Software Development * Reading from file: gl-proto-auto.orig.h . . . * Destination-Class: gl4java_GLFuncJauJNI ! @@ -26452,4 +26452,4 @@ Java_gl4java_GLFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj ) } } -/* C2J Parser Version 1.4 Beta: Java program parsed successfully. */ +/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */ diff --git a/CNativeCode/OpenGL_Win32.c b/CNativeCode/OpenGL_Win32.c index a667ce0..a25b01b 100755 --- a/CNativeCode/OpenGL_Win32.c +++ b/CNativeCode/OpenGL_Win32.c @@ -13,62 +13,51 @@ * September 12, 1997 - Adam King
* - Added support for rendering directly into a Canvas ( BIG rewrite )
*/
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-#include <stdio.h>
-#include <jni.h>
+/**
+ * Pointer Semantics of GLContext:
+ * ==============================
+
+ "displayHandle" := not used
+
+ "pData" := (HDC)
+ This is original Java-Native Window Handle !
+ It is transfered -> "windowHandle" in the beginning,
+ so if no own created window will be used, "pData" == "windowHandle" !
+
+ "windowHandle" := (HDC)
+ note: createOwnWindow is not recognized while creation process ..
+
+ "pixmapHandle" := (HBITMAP)
+ if("offScreenRenderer" == TRUE)
+ "pixmapHandle" contains the new BITMAP (by CreateDIBSection)!
+ "windowHandle" contains the new created OffScreenWindow
+ (by CreateCompatibleDC)!
+ else
+ "pixmapHandle" is unused !
-/*
-void gl4java_bind_ext(int verbose);
-*/
+ "sharedGLContextNative" := (HGLRC)
+ This is the optional shared GLContext !
-/*--------------------------------------------------------------------------
- * here on in is just regular apple pie C
+ "glContext" := (HGLRC)
+ This is THE used GLContext !
*/
-#include <GL\gl.h>
-#include <gl\glu.h>
-#include <wingdi.h>
+#include "OpenGL_Win32_common.h"
static jboolean verbose = JNI_FALSE;
-// Color Palette handle
-static HPALETTE hPalette = NULL;
-static HGLRC tempRC;
-
-// Set Pixel Format function - forward declaration
-static void SetDCPixelFormat(HDC hDC, jboolean doubleBuffer, jboolean stereo, jint stencilBits, jboolean offScreenRenderer);
-static HPALETTE GetOpenGLPalette(HDC hDC);
-static HGLRC get_GC( HDC *hDC, jboolean doubleBuffer, jboolean stereo, jint stencilBits, HGLRC shareWith, jboolean offScreenRenderer,
- int width, int height, HBITMAP *pix);
-
-static int PixelFormatDescriptorFromDc( HDC Dc, PIXELFORMATDESCRIPTOR *Pfd );
-static const char * GetTextualPixelFormatByHDC(HDC hdc);
-static const char * GetTextualPixelFormatByPFD(PIXELFORMATDESCRIPTOR *ppfd, int format);
-
-/* testJavaGLTypes does important implementation plattformspecific checks:
- *
- * o do fit X11-Vars in jint (because GLContext stores 'em like that)
- * o do fit the JNI <-> GL Variables-Type Mapping
- * o IF ERROR OR VERBOSE -> DUMP JNI,GL Type-Length
- */
-jboolean testJavaGLTypes(jboolean verbose);
-
-/* testX11Java does important implementation plattformspecific checks:
- *
- * o do fit X11-Vars in jint (because GLContext stores 'em like that)
- */
-jboolean testWin32Java(void);
-
-static void setupDIB(HDC hDCOrig, HDC hDC, HBITMAP * hBitmap, int width, int height);
-static void resizeDIB(HDC hDC, HBITMAP *hOldBitmap, HBITMAP *hBitmap);
-static void setupPalette(HDC hDC);
-
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_useJAWT( JNIEnv *env, jobject obj )
+{
+ (void)env;
+ (void)obj;
+ return JNI_FALSE;
+}
JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj )
+Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
+ jobject canvas)
{
jboolean ret = JNI_TRUE;
@@ -90,13 +79,15 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) jint jaccumSize=0;
HDC thisWin;
HGLRC gc;
- jint pData=0;
+ HDC pData=0;
HGLRC shareWith=NULL;
jint jcreatewinw = 0, jcreatewinh = 0;
HBITMAP pix;
PIXELFORMATDESCRIPTOR pfd;
+ (void) canvas;
+
cls = (*env)->GetObjectClass(env, obj);
if(cls==0)
{
@@ -120,20 +111,21 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) if(JNI_TRUE==verbose)
{
- fprintf(stderr, "sizes:\n jint=%d\n HGLRC=%d\n HDC=%d\n",
- sizeof(jint), sizeof(HGLRC), sizeof(HDC) );
+ fprintf(stderr, "sizes:\n jlong=%d\n HGLRC=%d\n HDC=%d\n",
+ sizeof(jlong), sizeof(HGLRC), sizeof(HDC) );
fflush(stderr);
}
- /* FIRST OF ALL CHECK IF A NATIVE POINTER OR WIN-TYPE FITS IN �jint� */
+ /* FIRST OF ALL CHECK IF A NATIVE POINTER OR WIN-TYPE FITS IN �jlong� */
ret = testWin32Java();
ret = testJavaGLTypes(verbose);
if(ret==JNI_TRUE) {
- fpData = (*env)->GetFieldID(env, cls, "pData", "I");
+ fpData = (*env)->GetFieldID(env, cls, "pData", "J");
if (fpData == 0) ret= JNI_FALSE;
- else pData =(*env)->GetIntField(env, obj, fpData);
+ else pData = (HDC)
+ ( (PointerHolder)(*env)->GetLongField(env, obj, fpData));
}
if(JNI_TRUE==verbose)
{
@@ -141,12 +133,12 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) }
if(ret==JNI_TRUE) {
- fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "I");
+ fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
if (fwindowHandle == 0) ret= JNI_FALSE;
}
if(ret==JNI_TRUE) {
- fglContext=(*env)->GetFieldID(env, cls, "glContext", "I");
+ fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
if (fglContext == 0) ret= JNI_FALSE;
}
@@ -194,13 +186,14 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) }
if(ret==JNI_TRUE) {
- fshareWith = (*env)->GetFieldID(env, cls, "sharedGLContextNative", "I");
+ fshareWith = (*env)->GetFieldID(env, cls, "sharedGLContextNative", "J");
if (fshareWith == 0) ret= JNI_FALSE;
- else shareWith = (HGLRC) (*env)->GetIntField(env, obj, fshareWith);
+ else shareWith = (HGLRC)
+ ( (PointerHolder)(*env)->GetLongField(env, obj, fshareWith));
}
if(ret==JNI_TRUE) {
- fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "I");
+ fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J");
if (fpixmapHandle == 0) ret= JNI_FALSE;
}
@@ -234,7 +227,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) /* get the graphics context for this widget */
if( (gc = get_GC( &thisWin, jdoubleBuffer, jstereoView, jstencilBits, shareWith,
- joffScreenRenderer, jcreatewinw, jcreatewinh, &pix)) == 0 )
+ joffScreenRenderer, jcreatewinw, jcreatewinh, &pix, verbose)) == 0 )
{
printf( "getGC error" );
return JNI_FALSE;
@@ -262,21 +255,22 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) }
if(ret==JNI_TRUE && fwindowHandle!=0) {
- (*env)->SetIntField(env, obj, fwindowHandle, (jint)thisWin);
+ (*env)->SetLongField(env, obj, fwindowHandle,
+ (jlong)((PointerHolder)thisWin));
if(JNI_TRUE==verbose)
fprintf(stderr, "go and set windowHandle thisWin : %d; 0x%X\n",
(int)thisWin, (int)thisWin);
}
if(ret==JNI_TRUE && fpixmapHandle!=0) {
- (*env)->SetIntField(env, obj, fpixmapHandle, (jint)pix);
+ (*env)->SetLongField(env, obj, fpixmapHandle, (jlong)((PointerHolder)pix));
if(JNI_TRUE==verbose)
fprintf(stderr, "go and set pixmapHandle pix: %d; 0x%X\n",
(int)pix, (int)pix);
}
if(ret==JNI_TRUE && fglContext !=0 ) {
- (*env)->SetIntField(env, obj, fglContext, (jint)gc);
+ (*env)->SetLongField(env, obj, fglContext, (jlong)((PointerHolder)gc));
if(JNI_TRUE==verbose)
fprintf(stderr, "go and set gc : %d, 0x%X\n",
(int)gc, (int)gc);
@@ -291,12 +285,15 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) JNIEXPORT jboolean JNICALL
Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj,
- jint disp,
- jint thisWin,
- jint glContext)
+ jobject canvas,
+ jlong disp,
+ jlong thisWin,
+ jlong glContext)
{
jboolean ret = JNI_TRUE;
+ (void)canvas;
+
if( !thisWin )
{
return JNI_FALSE;
@@ -307,7 +304,8 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, return JNI_FALSE;
}
- if ( ret==JNI_TRUE && !wglMakeCurrent((HDC)thisWin, (HGLRC)glContext) )
+ if ( ret==JNI_TRUE && !wglMakeCurrent((HDC)((PointerHolder)thisWin),
+ (HGLRC)((PointerHolder)glContext)) )
{
return JNI_FALSE;
}
@@ -316,14 +314,16 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, JNIEXPORT jboolean JNICALL
Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj,
- jint disp,
- jint thisWin,
- jint glContext
+ jobject canvas,
+ jlong disp,
+ jlong thisWin,
+ jlong glContext
)
{
(void)thisWin;
(void)glContext;
(void)disp;
+ (void)canvas;
if ( ! wglMakeCurrent( NULL, NULL ) )
{
@@ -335,7 +335,8 @@ Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj, }
JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj )
+Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj,
+ jobject canvas)
{
jboolean ret = JNI_TRUE;
@@ -343,12 +344,16 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) jfieldID fwindowHandle=0, fpixmapHandle;
jfieldID fglContext=0;
jfieldID foffScreenRenderer;
+ jfieldID fownwind=0;
+ jboolean jownwind = JNI_FALSE ;
jboolean joffScreenRenderer=JNI_FALSE;
HBITMAP pix;
HDC thisWin;
HGLRC gc;
+ (void)canvas;
+
cls = (*env)->GetObjectClass(env, obj);
if(cls==0)
{
@@ -356,22 +361,25 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) }
if(ret==JNI_TRUE) {
- fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "I");
+ fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
if (fwindowHandle == 0) ret= JNI_FALSE;
- else thisWin =(HDC) (*env)->GetIntField(env, obj, fwindowHandle);
+ else thisWin =(HDC)
+ ((PointerHolder)(*env)->GetLongField(env, obj, fwindowHandle));
}
if(ret==JNI_TRUE) {
- fglContext=(*env)->GetFieldID(env, cls, "glContext", "I");
+ fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
if (fglContext == 0) ret= JNI_FALSE;
- else gc =(HGLRC)(*env)->GetIntField(env, obj, fglContext);
+ else gc =(HGLRC)
+ ((PointerHolder)(*env)->GetLongField(env, obj, fglContext));
}
if(ret==JNI_TRUE) {
- fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "I");
+ fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J");
if (fpixmapHandle == 0) ret= JNI_FALSE;
- else pix =(HBITMAP)(*env)->GetIntField(env, obj, fpixmapHandle);
+ else pix =(HBITMAP)
+ ((PointerHolder)(*env)->GetLongField(env, obj, fpixmapHandle));
}
if(ret==JNI_TRUE) {
@@ -381,6 +389,12 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) else joffScreenRenderer =(*env)->GetBooleanField(env, obj, foffScreenRenderer);
}
+ if(ret==JNI_TRUE) {
+ fownwind = (*env)->GetFieldID(env, cls, "createOwnWindow", "Z");
+ if (fownwind == 0) ret= JNI_FALSE;
+ else jownwind =(*env)->GetBooleanField(env, obj, fownwind);
+ }
+
if(ret==JNI_TRUE)
{
@@ -405,12 +419,13 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) if(joffScreenRenderer==JNI_TRUE)
{
- if(pix!=0)
+ if(pix!=0 && joffScreenRenderer==JNI_TRUE)
{
DeleteObject(pix);
pix=0;
}
- if(thisWin!=0)
+ if(thisWin!=0 &&
+ (joffScreenRenderer || jownwind) )
{
DeleteDC(thisWin);
thisWin=0;
@@ -425,16 +440,20 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) }
if(ret==JNI_TRUE && fwindowHandle!=0) {
- (*env)->SetIntField(env, obj, fwindowHandle, (jint)thisWin);
+ (*env)->SetLongField(env, obj, fwindowHandle, (jlong)((PointerHolder)thisWin));
}
if(ret==JNI_TRUE && fglContext) {
- (*env)->SetIntField(env, obj, fglContext, (jint)gc);
+ (*env)->SetLongField(env, obj, fglContext, (jlong)((PointerHolder)gc));
}
if(ret==JNI_TRUE && fpixmapHandle!=0) {
- (*env)->SetIntField(env, obj, fpixmapHandle, (jint)pix);
+ (*env)->SetLongField(env, obj, fpixmapHandle, (jlong)((PointerHolder)pix));
+ }
+
+ if(ret==JNI_TRUE && fownwind) {
+ (*env)->SetBooleanField(env, obj, fownwind, jownwind);
}
return ret;
@@ -442,9 +461,9 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) JNIEXPORT jboolean JNICALL
Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj,
- jint disp,
- jint thisWin,
- jint glContext,
+ jlong disp,
+ jlong thisWin,
+ jlong glContext,
jboolean doubleBuffer
)
{
@@ -461,7 +480,7 @@ Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj, if( doubleBuffer==JNI_TRUE )
{
- if( SwapBuffers( (HDC)thisWin ) == FALSE )
+ if( SwapBuffers( (HDC)((PointerHolder)thisWin) ) == FALSE )
{
/* Error in Win2000 implementation :o)
* printf( "Error in swap buffer!\n" );
@@ -474,637 +493,11 @@ Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj, return ret;
}
-static HGLRC get_GC( HDC * hDC, jboolean doubleBuffer, jboolean stereo, jint stencilBits, HGLRC shareWith, jboolean offScreenRenderer,
- int width, int height, HBITMAP *pix)
-
-{
- const char * text=0;
- HDC hDCOrig = 0;
-
-
- if( *hDC == 0 )
- printf( "get_GC: Error, HDC is zero\n");
-
- // Select the pixel format
- if(offScreenRenderer)
- {
- hDCOrig = *hDC;
- *hDC = CreateCompatibleDC(hDCOrig);
- // setupDIB(*hDC, pix, width, height);
- setupDIB(hDCOrig, *hDC, pix, width, height);
- /* SetDCPixelFormat(hDCOffScr, doubleBuffer, stereo, stencilBits, offScreenRenderer); */
- /* setupPalette(hDC); USE MY PROC */
- }
-
- SetDCPixelFormat(*hDC, doubleBuffer, stereo, stencilBits, offScreenRenderer);
-
- // Create palette if needed
- hPalette = GetOpenGLPalette(*hDC);
-
- tempRC = wglCreateContext( *hDC );
-
- if(verbose==JNI_TRUE)
- {
- fprintf(stderr,"\n\nPIXELFORMAT OF GL-Context SETTINGS:\n");
- text=GetTextualPixelFormatByHDC(*hDC);
- fprintf(stderr,text);
- }
-
- /* check if the context could be created */
- if( tempRC == NULL ) {
- fprintf(stderr, "getGC context could NOT be created \n");
- return( 0 );
- }
-
- /* associated the context with the X window */
- if( wglMakeCurrent( *hDC, tempRC ) == FALSE) {
- fprintf(stderr,"wglMakeCurrent(%d,%d) failed on new context!!!\n",(int)*hDC,(int)tempRC);
- fprintf(stderr,"Error code = %d\n",(int)GetLastError());
- wglMakeCurrent(NULL, NULL);
- wglDeleteContext( tempRC );
- return( 0 );
- }
-
- if(shareWith!=NULL && wglShareLists(shareWith, tempRC)==FALSE)
- {
- fprintf(stderr,"\nERROR: Could not share lists between the new and the given GLContext (Win32Native)!\n");
- fprintf(stderr,"Error code = %d\n",(int)GetLastError());
- wglMakeCurrent(NULL, NULL);
- wglDeleteContext( tempRC );
- return( 0 );
- }
-
- if(JNI_TRUE==verbose)
- printf( "HGLRC (glContext) created: %d\n", tempRC );
-
- return tempRC;
-}
-
-// Select the pixel format for a given device context
-static void SetDCPixelFormat(HDC hDC, jboolean doubleBuffer, jboolean stereo, jint stencilBits, jboolean offScreenRenderer)
-{
- int nPixelFormat=0;
- const char * text=0;
-
- static PIXELFORMATDESCRIPTOR pfd = {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure
- 1, // Version of this structure
- 0, // will be defined later !!!!
- PFD_TYPE_RGBA, // RGBA Color mode
- 24, // Want 24bit color
- 0,0,0,0,0,0, // Not used to select mode
- 0,0, // Not used to select mode
- 0,0,0,0,0, // Not used to select mode
- 32, // Size of depth buffer
- 0, // Not used to select mode
- 0, // Not used to select mode
- PFD_MAIN_PLANE, // Draw in main plane
- 0, // Not used to select mode
- 0,0,0 }; // Not used to select mode
-
-
- // customize dw_flags
- DWORD dw_flags = PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED; // Support accelerated OpenGL calls in window
-
- if(offScreenRenderer)
- dw_flags |= PFD_DRAW_TO_BITMAP; // Draw to Bitmap
- else
- dw_flags |= PFD_DRAW_TO_WINDOW; // Draw to Window (not to bitmap)
-
-
- if(doubleBuffer==JNI_TRUE)
- dw_flags |= PFD_DOUBLEBUFFER ; // Double buffered is optional
-
- if(stereo==JNI_TRUE)
- dw_flags |= PFD_STEREO ; // Stereo is optional
-
- pfd.dwFlags = dw_flags;
-
- pfd.cColorBits = GetDeviceCaps(hDC, BITSPIXEL);
-
- if(stencilBits>0)
- pfd.cStencilBits = (BYTE) stencilBits;
-
- if(verbose==JNI_TRUE)
- {
- fprintf(stderr,"\n\nUSER CHOOSED PIXELFORMAT (TRYING):\n");
- text=GetTextualPixelFormatByPFD(&pfd, 0);
- fprintf(stderr,text);
- }
-
- // Choose a pixel format that best matches that described in pfd
- if( hDC == 0 )
- printf( "SetDCPixelFormat: Error, no HDC-Contex is given\n");
- else
- nPixelFormat = ChoosePixelFormat(hDC, &pfd);
-
- if( nPixelFormat == 0 )
- printf( "SetDCPixelFormat: Error with PixelFormat\n" );
-
- // Set the pixel format for the device context
- if( SetPixelFormat(hDC, nPixelFormat, &pfd) == FALSE)
- printf( "setpixel failed\n" );
-}
-
-
-// If necessary, creates a 3-3-2 palette for the device context listed.
-static HPALETTE GetOpenGLPalette(HDC hDC)
-{
- HPALETTE hRetPal = NULL; // Handle to palette to be created
- PIXELFORMATDESCRIPTOR pfd; // Pixel Format Descriptor
- LOGPALETTE *pPal; // Pointer to memory for logical palette
- int nPixelFormat; // Pixel format index
- int nColors; // Number of entries in palette
- int i; // Counting variable
- BYTE RedRange,GreenRange,BlueRange;
- // Range for each color entry (7,7,and 3)
-
-
- // Get the pixel format index and retrieve the pixel format description
- nPixelFormat = GetPixelFormat(hDC);
- DescribePixelFormat(hDC, nPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
-
- // Does this pixel format require a palette? If not, do not create a
- // palette and just return NULL
- if(!(pfd.dwFlags & PFD_NEED_PALETTE))
- return NULL;
-
- // Number of entries in palette. 8 bits yeilds 256 entries
- nColors = 1 << pfd.cColorBits;
-
- // Allocate space for a logical palette structure plus all the palette entries
- pPal = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + nColors*sizeof(PALETTEENTRY));
-
- // Fill in palette header
- pPal->palVersion = 0x300; // Windows 3.0
- pPal->palNumEntries = nColors; // table size
-
- // Build mask of all 1's. This creates a number represented by having
- // the low order x bits set, where x = pfd.cRedBits, pfd.cGreenBits, and
- // pfd.cBlueBits.
- RedRange = (1 << pfd.cRedBits) -1;
- GreenRange = (1 << pfd.cGreenBits) - 1;
- BlueRange = (1 << pfd.cBlueBits) -1;
-
- // Loop through all the palette entries
- for(i = 0; i < nColors; i++)
- {
- // Fill in the 8-bit equivalents for each component
- pPal->palPalEntry[i].peRed = (i >> pfd.cRedShift) & RedRange;
- pPal->palPalEntry[i].peRed = (unsigned char)(
- (double) pPal->palPalEntry[i].peRed * 255.0 / RedRange);
-
- pPal->palPalEntry[i].peGreen = (i >> pfd.cGreenShift) & GreenRange;
- pPal->palPalEntry[i].peGreen = (unsigned char)(
- (double)pPal->palPalEntry[i].peGreen * 255.0 / GreenRange);
-
- pPal->palPalEntry[i].peBlue = (i >> pfd.cBlueShift) & BlueRange;
- pPal->palPalEntry[i].peBlue = (unsigned char)(
- (double)pPal->palPalEntry[i].peBlue * 255.0 / BlueRange);
-
- pPal->palPalEntry[i].peFlags = (unsigned char) NULL;
- }
-
-
- // Create the palette
- hRetPal = CreatePalette(pPal);
-
- // Go ahead and select and realize the palette for this device context
- SelectPalette(hDC,hRetPal,FALSE);
- RealizePalette(hDC);
-
- // Free the memory used for the logical palette structure
- free(pPal);
-
- // Return the handle to the new palette
- return hRetPal;
-}
-
-
JNIEXPORT void JNICALL
Java_gl4java_GLContext_gljResizeNative( JNIEnv *env, jobject obj,
jboolean isOwnWindow,
- jint disp, jint thisWin,
- jint width, jint height)
+ jlong disp, jlong thisWin,
+ jlong width, jlong height)
{
}
-static jboolean testWin32Java()
-{
- jboolean ret=JNI_TRUE;
-
- /* NON DEPENDENCE CHECKS */
-
- /* FIRST OF ALL CHECK IF A NATIVE POINTER OR WIN32-TYPE FITS IN �jint� */
-
- if( sizeof(jint) < sizeof(int *) )
- {
- fprintf(stderr,"(int *) fits not in jint\n");
- ret = JNI_FALSE;
- }
-
- if( sizeof(jint) < sizeof(HDC) )
- {
- fprintf(stderr,"HDC fits not in jint\n");
- ret = JNI_FALSE;
- }
-
- if( sizeof(jint) < sizeof(HGLRC) )
- {
- fprintf(stderr,"HGLRC fits not in jint\n");
- ret = JNI_FALSE;
- }
-
- if(ret==JNI_FALSE)
- {
- fflush(stderr);
- }
-
- return ret;
-}
-
-
-static void
-PrintMessage( const char *Format, ... )
-{
- va_list ArgList;
- char Buffer[256];
-
- va_start(ArgList, Format);
- vsprintf(Buffer, Format, ArgList);
- va_end(ArgList);
-
- fprintf(stderr, Buffer);
-}
-
-
-static int
-PixelFormatDescriptorFromDc( HDC Dc, PIXELFORMATDESCRIPTOR *Pfd )
-{
- int PfdIndex;
-
- if ( 0 < (PfdIndex = GetPixelFormat( Dc )) )
- {
- if ( 0 < DescribePixelFormat( Dc, PfdIndex, sizeof(*Pfd), Pfd ) )
- {
- return(PfdIndex);
- }
- else
- {
- PrintMessage("Could not get a description of pixel format %d\n",
- PfdIndex );
- }
- }
- else
- {
- PrintMessage("Could not get pixel format for Dc 0x%08lX\n", Dc );
- }
- return( 0 );
-}
-
-
-static const char * GetTextualPixelFormatByPFD(PIXELFORMATDESCRIPTOR *ppfd, int format)
-{
- static char buffer[2000];
- char line[200];
-
- sprintf(buffer,"Pixel format %d\n", format);
- sprintf(line," dwFlags - 0x%x\n", ppfd->dwFlags);
- if (ppfd->dwFlags & PFD_DOUBLEBUFFER) { strcat(buffer, line); sprintf(line,"\tPFD_DOUBLEBUFFER\n "); }
- if (ppfd->dwFlags & PFD_STEREO) { strcat(buffer, line); sprintf(line,"\tPFD_STEREO\n "); }
- if (ppfd->dwFlags & PFD_DRAW_TO_WINDOW) { strcat(buffer, line); sprintf(line,"\tPFD_DRAW_TO_WINDOW\n "); }
- if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) { strcat(buffer, line); sprintf(line,"\tPFD_DRAW_TO_BITMAP\n "); }
- if (ppfd->dwFlags & PFD_SUPPORT_GDI) { strcat(buffer, line); sprintf(line,"\tPFD_SUPPORT_GDI\n "); }
- if (ppfd->dwFlags & PFD_SUPPORT_OPENGL) { strcat(buffer, line); sprintf(line,"\tPFD_SUPPORT_OPENGL\n "); }
- if (ppfd->dwFlags & PFD_GENERIC_ACCELERATED) { strcat(buffer, line); sprintf(line,"\tPFD_GENERIC_ACCELERATED\n "); }
- if (ppfd->dwFlags & PFD_GENERIC_FORMAT) { strcat(buffer, line); sprintf(line,"\tPFD_GENERIC_FORMAT\n "); }
- if (ppfd->dwFlags & PFD_NEED_PALETTE) { strcat(buffer, line); sprintf(line,"\tPFD_NEED_PALETTE\n "); }
- if (ppfd->dwFlags & PFD_NEED_SYSTEM_PALETTE) { strcat(buffer, line); sprintf(line,"\tPFD_NEED_SYSTEM_PALETTE\n "); }
- strcat(buffer, line); sprintf(line,"\n");
- strcat(buffer, line); sprintf(line," iPixelType - %d\n", ppfd->iPixelType);
- if (ppfd->iPixelType == PFD_TYPE_RGBA) { strcat(buffer, line); sprintf(line,"\tPGD_TYPE_RGBA\n"); }
- if (ppfd->iPixelType == PFD_TYPE_COLORINDEX) { strcat(buffer, line); sprintf(line,"\tPGD_TYPE_COLORINDEX\n"); }
- strcat(buffer, line); sprintf(line," cColorBits - %d\n", ppfd->cColorBits);
- strcat(buffer, line); sprintf(line," cRedBits - %d\n", ppfd->cRedBits);
- strcat(buffer, line); sprintf(line," cRedShift - %d\n", ppfd->cRedShift);
- strcat(buffer, line); sprintf(line," cGreenBits - %d\n", ppfd->cGreenBits);
- strcat(buffer, line); sprintf(line," cGreenShift - %d\n", ppfd->cGreenShift);
- strcat(buffer, line); sprintf(line," cBlueBits - %d\n", ppfd->cBlueBits);
- strcat(buffer, line); sprintf(line," cBlueShift - %d\n", ppfd->cBlueShift);
- strcat(buffer, line); sprintf(line," cAlphaBits - %d\n", ppfd->cAlphaBits);
- strcat(buffer, line); sprintf(line," cAlphaShift - 0x%x\n", ppfd->cAlphaShift);
- strcat(buffer, line); sprintf(line," cAccumBits - %d\n", ppfd->cAccumBits);
- strcat(buffer, line); sprintf(line," cAccumRedBits - %d\n", ppfd->cAccumRedBits);
- strcat(buffer, line); sprintf(line," cAccumGreenBits - %d\n", ppfd->cAccumGreenBits);
- strcat(buffer, line); sprintf(line," cAccumBlueBits - %d\n", ppfd->cAccumBlueBits);
- strcat(buffer, line); sprintf(line," cAccumAlphaBits - %d\n", ppfd->cAccumAlphaBits);
- strcat(buffer, line); sprintf(line," cDepthBits - %d\n", ppfd->cDepthBits);
- strcat(buffer, line); sprintf(line," cStencilBits - %d\n", ppfd->cStencilBits);
- strcat(buffer, line); sprintf(line," cAuxBuffers - %d\n", ppfd->cAuxBuffers);
- strcat(buffer, line); sprintf(line," iLayerType - %d\n", ppfd->iLayerType);
- strcat(buffer, line); sprintf(line," bReserved - %d\n", ppfd->bReserved);
- strcat(buffer, line); sprintf(line," dwLayerMask - 0x%x\n", ppfd->dwLayerMask);
- strcat(buffer, line); sprintf(line," dwVisibleMask - 0x%x\n", ppfd->dwVisibleMask);
- strcat(buffer, line); sprintf(line," dwDamageMask - 0x%x\n", ppfd->dwDamageMask);
- strcat(buffer, line);
- return buffer;
-}
-
-static const char * GetTextualPixelFormatByHDC(HDC hdc)
-{
- PIXELFORMATDESCRIPTOR pfd, *ppfd;
- int format;
-
- ppfd = &pfd;
- format = PixelFormatDescriptorFromDc( hdc, ppfd );
-
- return GetTextualPixelFormatByPFD(ppfd, format);
-}
-
-/*****************************************************************/
-
-/* Struct used to manage color ramps */
-struct colorIndexState {
- GLfloat amb[3]; /* ambient color / bottom of ramp */
- GLfloat diff[3]; /* diffuse color / middle of ramp */
- GLfloat spec[3]; /* specular color / top of ramp */
- GLfloat ratio; /* ratio of diffuse to specular in ramp */
- GLint indexes[3]; /* where ramp was placed in palette */
-};
-#define NUM_COLORS (sizeof(colors) / sizeof(colors[0]))
-struct colorIndexState colors[] = {
- {
- { 0.0F, 0.0F, 0.0F },
- { 0.1F, 0.6F, 0.3F },
- { 1.0F, 1.0F, 1.0F },
- 0.75F, { 0, 0, 0 },
- },
- {
- { 0.0F, 0.0F, 0.0F },
- { 0.0F, 0.2F, 0.5F },
- { 1.0F, 1.0F, 1.0F },
- 0.75F, { 0, 0, 0 },
- },
- {
- { 0.0F, 0.05F, 0.05F },
- { 0.6F, 0.0F, 0.8F },
- { 1.0F, 1.0F, 1.0F },
- 0.75F, { 0, 0, 0 },
- },
-};
-
-
-static void
-setupDIB(HDC hDCOrig, HDC hDC, HBITMAP * hBitmap, int width, int height)
-{
- BITMAPINFO *bmInfo;
- BITMAPINFOHEADER *bmHeader;
- UINT usage;
- VOID *base;
- int bmiSize;
- int bitsPerPixel;
- HBITMAP hOldBitmap=0;
-
- bmiSize = sizeof(*bmInfo);
- bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL);
-
- switch (bitsPerPixel) {
- case 8:
- // bmiColors is 256 WORD palette indices
- bmiSize += (256 * sizeof(WORD)) - sizeof(RGBQUAD);
- break;
- case 16:
- // bmiColors is 3 WORD component masks
- bmiSize += (3 * sizeof(DWORD)) - sizeof(RGBQUAD);
- break;
- case 24:
- case 32:
- default:
- // bmiColors not used
- break;
- }
-
- bmInfo = (BITMAPINFO *) calloc(1, bmiSize);
- bmHeader = &bmInfo->bmiHeader;
-
- bmHeader->biSize = sizeof(*bmHeader);
- bmHeader->biWidth = width;
- bmHeader->biHeight = height;
- bmHeader->biPlanes = 1; // must be 1
- bmHeader->biBitCount = bitsPerPixel;
- bmHeader->biXPelsPerMeter = 0;
- bmHeader->biYPelsPerMeter = 0;
- bmHeader->biClrUsed = 0; // all are used
- bmHeader->biClrImportant = 0; // all are important
-
- switch (bitsPerPixel) {
- case 8:
- bmHeader->biCompression = BI_RGB;
- bmHeader->biSizeImage = 0;
- usage = DIB_PAL_COLORS;
- // bmiColors is 256 WORD palette indices
- {
- WORD *palIndex = (WORD *) &bmInfo->bmiColors[0];
- int i;
-
- for (i=0; i<256; i++) {
- palIndex[i] = i;
- }
- }
- break;
- case 16:
- bmHeader->biCompression = BI_RGB;
- bmHeader->biSizeImage = 0;
- usage = DIB_RGB_COLORS;
- // bmiColors is 3 WORD component masks
- {
- DWORD *compMask = (DWORD *) &bmInfo->bmiColors[0];
-
- compMask[0] = 0xF800;
- compMask[1] = 0x07E0;
- compMask[2] = 0x001F;
- }
- break;
- case 24:
- case 32:
- default:
- bmHeader->biCompression = BI_RGB;
- bmHeader->biSizeImage = 0;
- usage = DIB_RGB_COLORS;
- // bmiColors not used
- break;
- }
-
- *hBitmap = CreateDIBSection(hDC, bmInfo, usage, &base, NULL, 0);
- if (*hBitmap == NULL) {
- (void) MessageBox(WindowFromDC(hDC),
- "Failed to create DIBSection.",
- "OpenGL application error",
- MB_ICONERROR | MB_OK);
- exit(1);
- }
-
- hOldBitmap = SelectObject(hDC, *hBitmap);
- if(hOldBitmap!=0)
- DeleteObject(hOldBitmap);
-
- free(bmInfo);
-}
-
-
-/*
-static void
-setupDIB(HDC hDCOrig, HDC hDC, HBITMAP * hBitmap, int width, int height)
-{
- HBITMAP hOldBitmap=0;
-
- *hBitmap = CreateCompatibleBitmap( hDCOrig, width, height );
- if (*hBitmap == NULL) {
- fprintf(stderr,"Failed to create CreateCompatibleBitmap! \n");
- fflush(stderr);
- return;
- }
-
- hOldBitmap = SelectObject(hDC, *hBitmap);
- if(hOldBitmap!=0)
- DeleteObject(hOldBitmap);
-}
-*/
-
-
-static void resizeDIB(HDC hDC, HBITMAP *hOldBitmap, HBITMAP *hBitmap)
-{
- /*
- SelectObject(hDC, *hOldBitmap);
- DeleteObject(*hBitmap);
- setupDIB(hDC, hBitmap);
- */
-}
-
-static void setupPalette(HDC hDC)
-{
- PIXELFORMATDESCRIPTOR pfd;
- LOGPALETTE* pPal;
- int pixelFormat = GetPixelFormat(hDC);
- int paletteSize;
-
- DescribePixelFormat(hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
-
- /*
- ** Determine if a palette is needed and if so what size.
- */
- if (pfd.dwFlags & PFD_NEED_PALETTE) {
- paletteSize = 1 << pfd.cColorBits;
- } else if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
- paletteSize = 4096;
- } else {
- return;
- }
-
- pPal = (LOGPALETTE*)
- malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY));
- pPal->palVersion = 0x300;
- pPal->palNumEntries = paletteSize;
-
- if (pfd.iPixelType == PFD_TYPE_RGBA) {
- /*
- ** Fill the logical paletee with RGB color ramps
- */
- int redMask = (1 << pfd.cRedBits) - 1;
- int greenMask = (1 << pfd.cGreenBits) - 1;
- int blueMask = (1 << pfd.cBlueBits) - 1;
- int i;
-
- for (i=0; i<paletteSize; ++i) {
- pPal->palPalEntry[i].peRed =
- (((i >> pfd.cRedShift) & redMask) * 255) / redMask;
- pPal->palPalEntry[i].peGreen =
- (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
- pPal->palPalEntry[i].peBlue =
- (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
- pPal->palPalEntry[i].peFlags = 0;
- }
- } else {
- /*
- ** Fill the logical palette with color ramps.
- **
- ** Set up the logical palette so that it can be realized
- ** into the system palette as an identity palette.
- **
- ** 1) The default static entries should be present and at the right
- ** location. The easiest way to do this is to grab them from
- ** the current system palette.
- **
- ** 2) All non-static entries should be initialized to unique values.
- ** The easiest way to do this is to ensure that all of the non-static
- ** entries have the PC_NOCOLLAPSE flag bit set.
- */
- int numRamps = NUM_COLORS;
- int rampSize = (paletteSize - 20) / numRamps;
- int extra = (paletteSize - 20) - (numRamps * rampSize);
- int i, r;
-
- /*
- ** Initialize static entries by copying them from the
- ** current system palette.
- */
- GetSystemPaletteEntries(hDC, 0, paletteSize, &pPal->palPalEntry[0]);
-
- /*
- ** Fill in non-static entries with desired colors.
- */
- for (r=0; r<numRamps; ++r) {
- int rampBase = r * rampSize + 10;
- PALETTEENTRY *pe = &pPal->palPalEntry[rampBase];
- int diffSize = (int) (rampSize * colors[r].ratio);
- int specSize = rampSize - diffSize;
-
- for (i=0; i<rampSize; ++i) {
- GLfloat *c0, *c1;
- GLint a;
-
- if (i < diffSize) {
- c0 = colors[r].amb;
- c1 = colors[r].diff;
- a = (i * 255) / (diffSize - 1);
- } else {
- c0 = colors[r].diff;
- c1 = colors[r].spec;
- a = ((i - diffSize) * 255) / (specSize - 1);
- }
-
- pe[i].peRed = (BYTE) (a * (c1[0] - c0[0]) + 255 * c0[0]);
- pe[i].peGreen = (BYTE) (a * (c1[1] - c0[1]) + 255 * c0[1]);
- pe[i].peBlue = (BYTE) (a * (c1[2] - c0[2]) + 255 * c0[2]);
- pe[i].peFlags = PC_NOCOLLAPSE;
- }
-
- colors[r].indexes[0] = rampBase;
- colors[r].indexes[1] = rampBase + (diffSize-1);
- colors[r].indexes[2] = rampBase + (rampSize-1);
- }
-
- /*
- ** Initialize any remaining non-static entries.
- */
- for (i=0; i<extra; ++i) {
- int index = numRamps*rampSize+10+i;
- PALETTEENTRY *pe = &pPal->palPalEntry[index];
-
- pe->peRed = (BYTE) 0;
- pe->peGreen = (BYTE) 0;
- pe->peBlue = (BYTE) 0;
- pe->peFlags = PC_NOCOLLAPSE;
- }
- }
-
- hPalette = CreatePalette(pPal);
- free(pPal);
-
- if (hPalette) {
- SelectPalette(hDC, hPalette, FALSE);
- RealizePalette(hDC);
- }
-}
-
-
diff --git a/CNativeCode/OpenGL_Win32_JDirect.c b/CNativeCode/OpenGL_Win32_JDirect.c index 6b46874..a97b7c5 100755 --- a/CNativeCode/OpenGL_Win32_JDirect.c +++ b/CNativeCode/OpenGL_Win32_JDirect.c @@ -22,21 +22,7 @@ * The other procs are implemented with JNI !
*/
-#ifdef _WIN32_
- #include "winstuff.h"
-#endif
-
-#include "GL/gl.h"
-
-#include <stdio.h>
-
-/*--------------------------------------------------------------------------
- * here on in is just regular apple pie C
- */
-
-#include <GL\gl.h>
-#include <gl\glu.h>
-#include <wingdi.h>
+#include "OpenGL_misc.h"
#define CLASS_NAME "GL4JavaOglRenderingWindowClass"
#define WINDOW_NAME "GL4JavaOglRenderingWindow"
@@ -107,10 +93,10 @@ __declspec(dllexport) void OGLWindowMsgPumpJDirect(void) }
} /* OGLWindowMsgPumpJDirect() */
-__declspec(dllexport) void moveOGLWindowNativeJDirect(int _hdc, int x, int y, int width, int height)
+__declspec(dllexport) void moveOGLWindowNativeJDirect(long _hdc, int x, int y, int width, int height)
{
HWND hwnd, hwndParent;
- HDC hdc = (HDC)_hdc;
+ HDC hdc = (HDC)((PointerHolder)_hdc);
RECT rect;
int parentx = 0, parenty = 0;
int insetsleft = 0, insetstop = 0;
@@ -137,7 +123,7 @@ __declspec(dllexport) void moveOGLWindowNativeJDirect(int _hdc, int x, int y, in }
} /* moveOGLWindowNativeJDirect() */
-__declspec(dllexport) int createOGLWindowNativeJDirect(int hwndParent, int x, int y, int width, int height)
+__declspec(dllexport) long createOGLWindowNativeJDirect(long hwndParent, int x, int y, int width, int height)
{
HWND hwnd;
HDC hdc;
@@ -150,7 +136,7 @@ __declspec(dllexport) int createOGLWindowNativeJDirect(int hwndParent, int x, in y,
width,
height,
- (HWND)hwndParent,
+ (HWND)((PointerHolder)hwndParent),
NULL,
NULL,
NULL)) == NULL)
@@ -160,14 +146,14 @@ __declspec(dllexport) int createOGLWindowNativeJDirect(int hwndParent, int x, in return(0);
}
hdc = GetDC(hwnd);
- moveOGLWindowNativeJDirect((int)hdc, x, y, width, height);
- return (int)hdc;
+ moveOGLWindowNativeJDirect((long)((PointerHolder)hdc), x, y, width, height);
+ return (long)((PointerHolder)hdc);
} /* createOGLWindowNativeJDirect() */
-__declspec(dllexport) void destroyOGLWindowNativeJDirect(int _hdc)
+__declspec(dllexport) void destroyOGLWindowNativeJDirect(long _hdc)
{
HWND hwnd;
- HDC hdc = (HDC)_hdc;
+ HDC hdc = (HDC)((PointerHolder)_hdc);
if (hdc != NULL)
{
diff --git a/CNativeCode/OpenGL_X11.c b/CNativeCode/OpenGL_X11.c index a1f3a33..b764bd3 100644 --- a/CNativeCode/OpenGL_X11.c +++ b/CNativeCode/OpenGL_X11.c @@ -22,13 +22,36 @@ * some X stuff is also modified/debugged to run on aix ... */ -/* - * need to include the JAVA internal header files for macros and function - * prototypes required to maipulated JAVA data structures and functions - * - * StubPreamble.h includes the structure and macro definitions neede to - * convert JAVA data structures into C data structures. - * +/** + * Pointer Semantics of GLContext: + * ============================== + + "displayHandle" := (Display *) + + "windowHandle" := (Window) + if("offScreenRenderer" == FALSE && "createOwnWindow" == TRUE ) + "windowHandle" contains the new created Window + (by XCreateWindow)! + else + "windowHandle" contains the new Java-Native Window + + "pixmapHandle" := (Pixmap) + if("offScreenRenderer" == TRUE) + "pixmapHandle" contains the new Pixmap (by XCreatePixmap)! + "windowHandle" contains the new created OffScreenWindow + (by glXCreateGLXPixmap)! + else + "pixmapHandle" is unused ! + + "sharedGLContextNative" := (GLXContext) + This is the optional shared GLContext ! + + "glContext" := (GLXContext) + This is THE used GLContext ! + + "pData " := (jlong) + This is used as the "not initialized" flag ! + It is reset to zero while Destroy Method */ #include <stdio.h> @@ -53,555 +76,29 @@ #include <stdlib.h> +#include "OpenGL_X11_common.h" /* * STATIC FLAGS FOR gl4java behavior ... */ static jboolean verbose = JNI_FALSE; -/* - * prototypes for functions local to this file scope - */ -static int get_GC( Display *display, Window win, XVisualInfo *visual, - GLXContext *gc, GLXContext gc_share); - -typedef struct { - XVisualInfo * visual; - GLXContext gc; - int success; /* 1: OK, 0: ERROR */ -} VisualGC; - -static VisualGC findVisualGlX( Display *display, - Window rootWin, - Window * pWin, - int width, int height, - jboolean doubleBuffer, - jboolean stereoView, - jboolean rgba, - jint stencilBits, - jint accumSize, - jboolean * pOwnWin, - GLXContext shareWith, - jboolean offscreen, - Pixmap *pix - ); - -static void printVisualInfo ( Display *display, XVisualInfo * vi); -static void printAllVisualInfo ( Display *disp, Window win); - -static int testVisualInfo ( Display *display, XVisualInfo * vi, - int dblBuffer, int stereoView, int rgbaMode, - int stencilSize, int accumSize); - -static XVisualInfo * findVisualIdByFeature( XVisualInfo ** visualList, - Display *disp, Window win, - int dblBuffer, int stereoView, int rgbaMode, - int stencilSize, int accumSize); - -/* testJavaGLTypes does important implementation plattformspecific checks: - * - * o do fit the JNI <-> GL Variables-Type Mapping - * o IF ERROR OR VERBOSE -> DUMP JNI,GL Type-Length - */ -jboolean testJavaGLTypes(jboolean verbose); - -/* testX11Java does important implementation plattformspecific checks: - * - * o do fit X11-Vars in jint (because GLFrame stores 'em like that) - */ -static jboolean testX11Java(); - -static int x11gl_myErrorHandler(Display *pDisp, XErrorEvent *p_error) -{ - char err_msg[80]; - - XGetErrorText(pDisp, p_error->error_code, err_msg, 80); - fprintf(stderr, "X11 Error detected.\n %s\n", err_msg); - fprintf(stderr, " Protocol request: %d\n", p_error->request_code); - fprintf(stderr, " Resource ID : 0x%x\n", (int)p_error->resourceid); - fprintf(stderr, " \ntrying to continue ... \n"); - fflush(stderr); - return 0; -} - -static int x11gl_myIOErrorHandler(Display *pDisp) -{ - fprintf(stderr, "X11 I/O Error detected.\n"); - fprintf(stderr, " \ndo not know what to do ... \n"); - fflush(stderr); - return 0; -} - -static Window createOwnOverlayWin(Display *display, Window rootwini, Window parentWin, - XVisualInfo *visual, int width, int height) -{ - /* - //------------------------------------------------------------------------// - // Some Systems (SGI) wont give up the window and so we have to create a // - // window that fits on top of the Java Canvas. // - //------------------------------------------------------------------------// - */ - Window window=0; - XSetWindowAttributes attribs ; - - /* - //----------------------------------------------------------------------// - // now we have the visual with the best depth so lets make a color map // - // for it. we use allocnone because this is a true colour visual and // - // the color map is read only anyway. This must be done because we // - // cannot call XCreateSimpleWindow. // - //----------------------------------------------------------------------// - */ - int cmap = XCreateColormap ( display - , rootwini - , visual->visual - , AllocNone - ); - - /* - //----------------------------------------------------------------------// - // Set up the window attributes. // - //----------------------------------------------------------------------// - */ - attribs.event_mask = ExposureMask ; - attribs.border_pixel = BlackPixel(display, DefaultScreen(display)) ; - attribs.colormap = cmap ; - attribs.bit_gravity = SouthWestGravity ; ; - attribs.background_pixel = 0xFF00FFFF ; - - /* - //----------------------------------------------------------------------// - // Create a window. // - //----------------------------------------------------------------------// - */ - window = XCreateWindow( display - , parentWin - , 0 - , 0 - , width - , height - , 0 - , visual->depth - , InputOutput - , visual->visual - , CWBitGravity | CWColormap - | CWBorderPixel | CWBackPixel - , &attribs); - - return window; -} - - -static void printVisualInfo ( Display *display, XVisualInfo * vi) -{ - int dblBuffer, stereoView, rgbaMode, stencilSize; - int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize; - - fprintf(stderr, "\nvi(ID:%d(0x%X)): \n screen %d, depth %d, class %d,\n clrmapsz %d, bitsPerRGB %d\n", - (int) vi->visualid, - (int) vi->visualid, - (int) vi->screen, - (int) vi->depth, - (int) vi->class, - (int) vi->colormap_size, - (int) vi->bits_per_rgb ); - - glXGetConfig( display, vi, GLX_DOUBLEBUFFER, &dblBuffer); - glXGetConfig( display, vi, GLX_STEREO, &stereoView); - glXGetConfig( display, vi, GLX_RGBA, &rgbaMode); - glXGetConfig( display, vi, GLX_STENCIL_SIZE, &stencilSize); - glXGetConfig( display, vi, GLX_ACCUM_RED_SIZE, &accumRedSize); - glXGetConfig( display, vi, GLX_ACCUM_GREEN_SIZE, &accumGreenSize); - glXGetConfig( display, vi, GLX_ACCUM_BLUE_SIZE, &accumBlueSize); - glXGetConfig( display, vi, GLX_ACCUM_ALPHA_SIZE, &accumAlphaSize); - - fprintf(stderr, "\t doubleBuff: %d, ", dblBuffer); - fprintf(stderr, " stereo: %d, ", stereoView); - fprintf(stderr, " rgba: %d, ", rgbaMode); - fprintf(stderr, " stencilSize: %d !\n", stencilSize); - fprintf(stderr, "\t red accum: %d, ", accumRedSize); - fprintf(stderr, " green accum: %d, ", accumGreenSize); - fprintf(stderr, " blue accum: %d, ", accumBlueSize); - fprintf(stderr, " alpha accum: %d !\n", accumAlphaSize); - - fflush(stderr); -} - -static void printAllVisualInfo ( Display *disp, Window win) -{ - XVisualInfo * visualInfo=0; - XVisualInfo * vi=0; - XVisualInfo viTemplate; - int i, numReturns; - XWindowAttributes xwa; - - if(XGetWindowAttributes(disp, win, &xwa) == 0) - { - fprintf(stderr, "\nERROR while fetching XWindowAttributes\n"); - fflush(stderr); - return; - } - - viTemplate.screen = DefaultScreen( disp ); - viTemplate.class = (xwa.visual)->class ; - viTemplate.depth = xwa.depth; - - visualInfo = XGetVisualInfo( disp, VisualScreenMask, - &viTemplate, &numReturns ); - - if(JNI_TRUE==verbose) - { - fprintf(stderr, "\nNum of Visuals : %d\n", numReturns ); - - for(i=0; i<numReturns; i++) - { - vi = &(visualInfo[i]); - printVisualInfo ( disp, vi); - } - } - - XFree(visualInfo); -} - -static int testVisualInfo ( Display *display, XVisualInfo * vi, - int dblBuffer, int stereoView, int rgbaMode, - int stencilSize, int accumSize) -{ - int glxCfg; - - glXGetConfig( display, vi, GLX_DOUBLEBUFFER, &glxCfg); - if(glxCfg<dblBuffer) return 0; - - glXGetConfig( display, vi, GLX_STEREO, &glxCfg); - if(glxCfg<stereoView) return 0; - - glXGetConfig( display, vi, GLX_RGBA, &glxCfg); - if(glxCfg<rgbaMode) return 0; - - glXGetConfig( display, vi, GLX_STENCIL_SIZE, &glxCfg); - if(glxCfg<stencilSize) return 0; - - glXGetConfig(display, vi, GLX_ACCUM_RED_SIZE, &glxCfg); - if(glxCfg<accumSize) return 0; - - glXGetConfig(display, vi, GLX_ACCUM_GREEN_SIZE, &glxCfg); - if(glxCfg<accumSize) return 0; - - glXGetConfig(display, vi, GLX_ACCUM_BLUE_SIZE, &glxCfg); - if(glxCfg<accumSize) return 0; - - if(rgbaMode>0) { - glXGetConfig(display, vi, GLX_ACCUM_ALPHA_SIZE, &glxCfg); - if(glxCfg<accumSize) return 0; - } - - return 1; -} - - -static XVisualInfo * findVisualIdByFeature( XVisualInfo ** visualList, - Display *disp, Window win, - int dblBuffer, int stereoView, int rgbaMode, - int stencilSize, int accumSize) +JNIEXPORT jboolean JNICALL +Java_gl4java_GLContext_useJAWT( JNIEnv *env, jobject obj ) { - XVisualInfo * vi=0; - XVisualInfo viTemplate; - int i, numReturns; - XWindowAttributes xwa; - int done=0; - - if(XGetWindowAttributes(disp, win, &xwa) == 0) - { - fprintf(stderr, "\nERROR while fetching XWindowAttributes\n"); - fflush(stderr); - return 0; - } - - viTemplate.screen = DefaultScreen( disp ); - viTemplate.class = (xwa.visual)->class ; - viTemplate.depth = xwa.depth; - - *visualList = XGetVisualInfo( disp, VisualScreenMask, - &viTemplate, &numReturns ); - - for(i=0; done==0 && i<numReturns; i++) - { - vi = &((*visualList)[i]); - if ( testVisualInfo ( disp, vi, dblBuffer, stereoView, rgbaMode, - stencilSize, accumSize) ) - { - if(JNI_TRUE==verbose) - { - fprintf(stderr, "findVisualIdByFeature: Found matching Visual:\n"); - printVisualInfo ( disp, vi); - } - return vi; - } - } - - if(JNI_TRUE==verbose) - { - if( numReturns==0 ) - fprintf(stderr, "findVisualIdByFeature: No available visuals. Exiting...\n" ); - else if( i>=numReturns ) - fprintf(stderr, "findVisualIdByFeature: No matching visual found ...\n" ); - fflush(stderr); - } - - XFree(*visualList); - *visualList=NULL; - return NULL; + (void)env; + (void)obj; + return JNI_FALSE; } -/** - * Description for pWin: - * if ownwin: - * input: the parent window - * output: the newly created window - * else if ! ownwin: - * i/o: the window itself - */ -static VisualGC findVisualGlX( Display *display, - Window rootWin, - Window * pWin, - int width, int height, - jboolean doubleBuffer, - jboolean stereoView, - jboolean rgba, - jint stencilBits, - jint accumSize, - jboolean * pOwnWin, - GLXContext shareWith, - jboolean offscreen, - Pixmap *pix - ) +JNIEXPORT jboolean JNICALL +Java_gl4java_GLContext_hasJAWTSurfaceChanged( JNIEnv *env, jobject obj, + jlong thisWin ) { - Window newWin = 0; - int visualAttribList[32]; - int i=0; - int j=0; - int done=0; - VisualGC vgc = { NULL, 0, 0 }; - jboolean tryChooseVisual = JNI_TRUE; - int gc_ret = 0; - - /** - * The Visual seeked by Function: findVisualIdByFeature ! - */ - XVisualInfo * visualList=NULL; /* the visual list, to be XFree-ed */ - - /* backup variables ... */ - jboolean _rgba=rgba; - jint _stencilBits=stencilBits; - jint _accumSize=accumSize; - jboolean _stereoView=stereoView; - jboolean _doubleBuffer=doubleBuffer; - - do { - if(JNI_TRUE==verbose) - { - fprintf(stderr, "GL4Java: seeking visual loop# %d\n", j); - } - - i=0; - visualAttribList[i++] = GLX_RED_SIZE; - visualAttribList[i++] = 1; - visualAttribList[i++] = GLX_GREEN_SIZE; - visualAttribList[i++] = 1; - visualAttribList[i++] = GLX_BLUE_SIZE; - visualAttribList[i++] = 1; - visualAttribList[i++] = GLX_DEPTH_SIZE; - visualAttribList[i++] = 1; - visualAttribList[i++] = GLX_ACCUM_RED_SIZE; - visualAttribList[i++] = accumSize; - visualAttribList[i++] = GLX_ACCUM_GREEN_SIZE; - visualAttribList[i++] = accumSize; - visualAttribList[i++] = GLX_ACCUM_BLUE_SIZE; - visualAttribList[i++] = accumSize; - - if(JNI_TRUE==rgba) - { - visualAttribList[i++] = GLX_RGBA; - visualAttribList[i++] = GLX_ACCUM_ALPHA_SIZE; - visualAttribList[i++] = accumSize; - } - if(JNI_TRUE==doubleBuffer) - visualAttribList[i++] = GLX_DOUBLEBUFFER; - if(JNI_TRUE==stereoView) - visualAttribList[i++] = GLX_STEREO; - visualAttribList[i++] = GLX_STENCIL_SIZE; - visualAttribList[i++] = (int)stencilBits; - visualAttribList[i] = None; - - if(tryChooseVisual==JNI_TRUE && vgc.visual==NULL) - { - vgc.visual = glXChooseVisual( display, - DefaultScreen( display ), - visualAttribList ); - if(JNI_TRUE==verbose) - { - if(vgc.visual!=NULL) - { - fprintf(stderr, "glXChooseVisual: test visual(ID:%d(0x%X)):\n", - (int) vgc.visual->visualid, - (int) vgc.visual->visualid); - printVisualInfo ( display, vgc.visual); - } else - fprintf(stderr, "glXChooseVisual: no visual\n"); - fflush(stderr); - } - } - - if(vgc.visual==NULL) - { - vgc.visual = findVisualIdByFeature( &visualList, - display, *pWin, - doubleBuffer, stereoView, - rgba, - stencilBits, - accumSize); - } - - if(vgc.visual==NULL) - { - vgc.visual = findVisualIdByFeature( &visualList, - display, *pWin, - doubleBuffer, stereoView, - rgba, - stencilBits>0, - accumSize>0); - } - - if( *pOwnWin == JNI_TRUE && vgc.visual!=NULL) - { - newWin = createOwnOverlayWin(display, - rootWin, - *pWin /* the parent */, - vgc.visual, width, height); - } - - if( offscreen==JNI_TRUE && vgc.visual!=NULL) - { - if(*pix!=0) - { - XFreePixmap(display, *pix); - } - if(vgc.visual !=NULL) - *pix = XCreatePixmap( display, rootWin, width, height, - vgc.visual->depth); - if(*pix!=0) - { - *pWin = glXCreateGLXPixmap( display, vgc.visual, *pix ); - if(*pWin==0) - { - XFreePixmap(display, *pix); - *pix=0; - fprintf(stderr, "GL4Java(%d): glXCreateGLXPixmap failed\n", j); - fflush(stderr); - } - } else { - fprintf(stderr, "GL4Java(%d): XCreatePixmap failed\n", j); - fflush(stderr); - *pWin = 0; - } - if(JNI_TRUE==verbose) - { - if(*pWin!=0) - { - fprintf(stderr, "GL4Java(%d): pixmap ok\n", j); - fflush(stderr); - } - } - } - - gc_ret = -100; - - if( *pOwnWin == JNI_TRUE && newWin!=0 && - (gc_ret=get_GC( display, newWin, - vgc.visual, &(vgc.gc), shareWith)) == 0 - ) - { - vgc.success=1; - *pWin = newWin ; - } - else if( vgc.visual!=NULL && *pOwnWin == JNI_FALSE && *pWin!=0 && - (gc_ret=get_GC( display, *pWin, - vgc.visual, &(vgc.gc), shareWith)) == 0 - ) - { - vgc.success=1; - } else - { - j++; /* trial counter */ - if(JNI_TRUE==verbose) - { - fprintf(stderr, "GL4Java(%d): Visual fetching failed (gc_get=%d)\n", j, gc_ret); - fflush(stderr); - } - - if(*pix!=0) - { - XFreePixmap(display, *pix); - *pix=0; - } - - if(visualList!=NULL) - { - XFree(visualList); - visualList=NULL; - vgc.visual=NULL; - } else if(vgc.visual!=NULL) - { - XFree(vgc.visual); - vgc.visual=NULL; - } - - /* Fall-Back ... */ - if(*pOwnWin==JNI_FALSE && offscreen==JNI_FALSE) { - rgba=_rgba; - stencilBits=_stencilBits; - accumSize=_accumSize; - stereoView=_stereoView; - doubleBuffer=_doubleBuffer; - *pOwnWin=JNI_TRUE; - } else if(accumSize>0 && offscreen==JNI_TRUE) { - accumSize=0; - } else if(doubleBuffer==JNI_FALSE && offscreen==JNI_TRUE) { - doubleBuffer=JNI_TRUE; - } else if(stencilBits>0) { - stencilBits=0; - } else if(stereoView==JNI_TRUE) { - stereoView=JNI_FALSE; - } else if(rgba==JNI_TRUE) { - rgba=JNI_FALSE; - } else if(doubleBuffer==JNI_TRUE) { - doubleBuffer=JNI_FALSE; - } else if(tryChooseVisual==JNI_TRUE) { - rgba=_rgba; - stencilBits=_stencilBits; - accumSize=_accumSize; - stereoView=_stereoView; - doubleBuffer=_doubleBuffer; - *pOwnWin=JNI_FALSE; - tryChooseVisual=JNI_FALSE; - } else done=1; - } - } while (vgc.success==0 && done==0) ; - - if(vgc.success==1 && JNI_TRUE==verbose) - { - fprintf(stderr, "\nfindVisualGlX vi(ID:%d): \n screen %d, depth %d, class %d,\n clrmapsz %d, bitsPerRGB %d, shared with %d\n", - (int)vgc.visual->visualid, - (int)vgc.visual->screen, - (int)vgc.visual->depth, - (int)vgc.visual->class, - (int)vgc.visual->colormap_size, - (int)vgc.visual->bits_per_rgb, - (int)shareWith); - printVisualInfo ( display, vgc.visual); - } - - return vgc; + (void)env; + (void)obj; + (void)thisWin; + return JNI_FALSE; } /* @@ -615,7 +112,8 @@ static VisualGC findVisualGlX( Display *display, * followed by the method table for the class. */ JNIEXPORT jboolean JNICALL -Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) +Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj, + jobject canvas) { int screen = 0; @@ -642,7 +140,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) jint jaccumSize=0; jboolean jownwind = JNI_FALSE ; jint jcreatewinw = 0, jcreatewinh = 0; - jint jshareWith = 0; + GLXContext jshareWith = 0; /* these variables will be mapped in the java-object ! */ Window thisWin=0; @@ -652,6 +150,8 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) int iValue, iValue1, iValue2, iValue3; + (void)canvas; + cls = (*env)->GetObjectClass(env, obj); if(cls==0) { @@ -679,7 +179,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) fflush(stderr); } - /* FIRST OF ALL CHECK IF A NATIVE POINTER OR X11-TYPE FITS IN �jint� */ + /* FIRST OF ALL CHECK IF A NATIVE POINTER OR X11-TYPE FITS IN �jlong� */ ret = testX11Java(); ret = testJavaGLTypes(verbose); @@ -739,20 +239,23 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) } if(ret==JNI_TRUE) { - fshareWith = (*env)->GetFieldID(env, cls, "sharedGLContextNative", "I"); + fshareWith = (*env)->GetFieldID(env, cls, "sharedGLContextNative", "J"); if (fshareWith == 0) ret= JNI_FALSE; - else jshareWith =(*env)->GetIntField(env, obj, fshareWith); + else jshareWith = (GLXContext) + ( (PointerHolder) (*env)->GetLongField(env, obj, fshareWith) ); } if(ret==JNI_TRUE) { - fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "I"); + fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J"); if (fwindowHandle == 0) ret= JNI_FALSE; - else thisWin =(Window) (*env)->GetIntField(env, obj, fwindowHandle); + else + thisWin =(Window) + ( (PointerHolder) (*env)->GetLongField(env, obj, fwindowHandle) ); } if(ret==JNI_TRUE) { - fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "I"); + fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J"); if (fpixmapHandle == 0) ret= JNI_FALSE; } @@ -771,8 +274,8 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) if(JNI_TRUE==verbose) { - fprintf(stderr,"\nGL4Java: (JAVA FOUND WINDOW HANDLE %d == 0x%x)\n", - (int)thisWin, (int)thisWin); + fprintf(stderr,"\nGL4Java: (JAVA FOUND WINDOW HANDLE 0x%p)\n", + (void *)((PointerHolder)thisWin)); if(joffScreenRenderer==JNI_TRUE) { fprintf(stderr,"\nGL4Java: (USING OFFSCREEN GLPIXMAP BUFFER,\n\t forced: !ownWindow, window=NULL)\n"); @@ -789,12 +292,12 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) } if(ret==JNI_TRUE) { - fdisplayHandle = (*env)->GetFieldID(env, cls, "displayHandle", "I"); + fdisplayHandle = (*env)->GetFieldID(env, cls, "displayHandle", "J"); if (fdisplayHandle == 0) ret= JNI_FALSE; } if(ret==JNI_TRUE) { - fglContext=(*env)->GetFieldID(env, cls, "glContext", "I"); + fglContext=(*env)->GetFieldID(env, cls, "glContext", "J"); if (fglContext == 0) ret= JNI_FALSE; } @@ -845,8 +348,8 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) (int)jcreatewinw, (int)jcreatewinh, jdoubleBuffer, jstereoView, jrgba, jstencilBits, jaccumSize, - &jownwind, (GLXContext) jshareWith, - joffScreenRenderer, &pix); + &jownwind, jshareWith, + joffScreenRenderer, &pix, verbose); if(vgc.success == 0 && jrgba==JNI_TRUE) { @@ -855,8 +358,8 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) (int)jcreatewinw, (int)jcreatewinh, jdoubleBuffer, jstereoView, jrgba, jstencilBits, jaccumSize, - &jownwind, (GLXContext) jshareWith, - joffScreenRenderer, &pix); + &jownwind, jshareWith, + joffScreenRenderer, &pix, verbose); } if(vgc.success == 0) @@ -982,19 +485,19 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) } if(ret==JNI_TRUE && fwindowHandle!=0) { - (*env)->SetIntField(env, obj, fwindowHandle, (jint)thisWin); + (*env)->SetLongField(env, obj, fwindowHandle, (jlong)((PointerHolder)thisWin)); } if(ret==JNI_TRUE && fpixmapHandle!=0) { - (*env)->SetIntField(env, obj, fpixmapHandle, (jint)pix); + (*env)->SetLongField(env, obj, fpixmapHandle, (jlong)((PointerHolder)pix)); } if(ret==JNI_TRUE && fdisplayHandle) { - (*env)->SetIntField(env, obj, fdisplayHandle, (jint)display); + (*env)->SetLongField(env, obj, fdisplayHandle, (jlong)((PointerHolder)display)); } if(ret==JNI_TRUE && fglContext) { - (*env)->SetIntField(env, obj, fglContext, (jint)vgc.gc); + (*env)->SetLongField(env, obj, fglContext, (jlong)((PointerHolder)vgc.gc)); } if(ret==JNI_TRUE && fownwind) { @@ -1007,7 +510,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj ) JNIEXPORT void JNICALL Java_gl4java_GLContext_gljResizeNative( JNIEnv *env, jobject obj, jboolean isOwnWindow, - jint disp, jint thisWin, + jlong disp, jlong thisWin, jint width, jint height) { /* perform a X11 synchronise, because rendering could be done @@ -1018,7 +521,8 @@ Java_gl4java_GLContext_gljResizeNative( JNIEnv *env, jobject obj, if(isOwnWindow) { - XResizeWindow((Display *)disp, (Window)thisWin, width, height); + XResizeWindow((Display *)((PointerHolder)disp), + (Window)((PointerHolder)thisWin), width, height); /* if(JNI_TRUE==verbose) { fprintf(stderr, "XResizeWindow -> %d x %d\n", @@ -1032,14 +536,17 @@ Java_gl4java_GLContext_gljResizeNative( JNIEnv *env, jobject obj, JNIEXPORT jboolean JNICALL Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, - jint disp, - jint thisWin, - jint glContext + jobject canvas, + jlong disp, + jlong thisWin, + jlong glContext ) { jboolean ret = JNI_TRUE; GLXContext ctx = NULL; + (void)canvas; + if(glContext==0) { fprintf(stderr, "GL4Java ERROR: gljUse NO actual GC was created ...\n"); @@ -1049,14 +556,16 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, ctx = glXGetCurrentContext(); - if(ctx==(GLXContext)glContext) + if(ctx==(GLXContext)((PointerHolder)glContext)) return JNI_TRUE; if(ret==JNI_TRUE) { - if( !glXMakeCurrent( (Display *)disp, (Window)thisWin, - (GLXContext)glContext ) ) + if( !glXMakeCurrent( (Display *)((PointerHolder)disp), + (Window)((PointerHolder)thisWin), + (GLXContext)((PointerHolder)glContext) ) ) { + extern GLenum glGetError ( void ) ; fprintf(stderr, "GL4Java: gljMakeCurrent failed with GC\n Another thread may be use it now ...\n"); fflush(stderr); ret = JNI_FALSE; @@ -1068,19 +577,21 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, JNIEXPORT jboolean JNICALL Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj, - jint disp, - jint thisWin, - jint glContext + jobject canvas, + jlong disp, + jlong thisWin, + jlong glContext ) { jboolean ret = JNI_TRUE; (void)thisWin; (void)glContext; + (void)canvas; if(ret==JNI_TRUE) { - if( !glXMakeCurrent( (Display *)disp, None, NULL ) ) + if( !glXMakeCurrent( (Display *)((PointerHolder)disp), None, NULL)) { fprintf(stderr, "GL4Java: gljFree failed\n"); fflush(stderr); @@ -1092,12 +603,12 @@ Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj, JNIEXPORT jboolean JNICALL Java_gl4java_GLContext_gljIsContextCurrentNative( JNIEnv *env, jobject obj, - jint glContext + jlong glContext ) { GLXContext ctx = glXGetCurrentContext(); - if(ctx==(GLXContext)glContext) + if(ctx==(GLXContext)((PointerHolder)glContext)) return JNI_TRUE; return JNI_FALSE; @@ -1105,52 +616,67 @@ Java_gl4java_GLContext_gljIsContextCurrentNative( JNIEnv *env, jobject obj, JNIEXPORT jboolean JNICALL -Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) +Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj, + jobject canvas ) { jclass cls = 0; jfieldID fdisplayHandle=0, fwindowHandle=0, fglContext=0; jfieldID fpixmapHandle=0; jfieldID fpData=0; + jfieldID fownwind=0; + jboolean jownwind = JNI_FALSE ; Display *disp=0; GLXContext gc=0; Window win=0; - jint pData=0; + jlong pData=0; Pixmap pix=0; jboolean ret = JNI_TRUE; + (void) canvas; + cls = (*env)->GetObjectClass(env, obj); if(cls==0) ret=JNI_FALSE; if(ret==JNI_TRUE) { - fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "I"); + fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J"); if (fwindowHandle == 0) ret= JNI_FALSE; - else win = (Window) (*env)->GetIntField(env, obj, fwindowHandle); + else win = (Window) + ( (PointerHolder) (*env)->GetLongField(env, obj, fwindowHandle) ); } if(ret==JNI_TRUE) { - fdisplayHandle = (*env)->GetFieldID(env, cls, "displayHandle", "I"); + fdisplayHandle = (*env)->GetFieldID(env, cls, "displayHandle", "J"); if (fdisplayHandle == 0) ret= JNI_FALSE; - else disp=(Display *)(*env)->GetIntField(env, obj, fdisplayHandle); + else disp=(Display *) + ( (PointerHolder) (*env)->GetLongField(env, obj, fdisplayHandle)); } if(ret==JNI_TRUE) { - fglContext=(*env)->GetFieldID(env, cls, "glContext", "I"); + fglContext=(*env)->GetFieldID(env, cls, "glContext", "J"); if (fglContext == 0) ret= JNI_FALSE; - else gc =(GLXContext)(*env)->GetIntField(env, obj, fglContext); + else gc =(GLXContext) + ( (PointerHolder) (*env)->GetLongField(env, obj, fglContext) ); } if(ret==JNI_TRUE) { - fpData = (*env)->GetFieldID(env, cls, "pData", "I"); + fpData = (*env)->GetFieldID(env, cls, "pData", "J"); if (fpData == 0) ret= JNI_FALSE; - else pData =(*env)->GetIntField(env, obj, fpData); + else pData =(*env)->GetLongField(env, obj, fpData); } if(ret==JNI_TRUE) { - fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "I"); + fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J"); if (fpixmapHandle == 0) ret= JNI_FALSE; - else pix = (Pixmap)(*env)->GetIntField(env, obj, fpixmapHandle); + else pix = (Pixmap) + ( (PointerHolder) (*env)->GetLongField(env, obj, fpixmapHandle)); + } + + if(ret==JNI_TRUE) { + fownwind = (*env)->GetFieldID(env, cls, "createOwnWindow", "Z"); + if (fownwind == 0) ret= JNI_FALSE; + else jownwind =(*env)->GetBooleanField(env, obj, fownwind); } glXWaitGL(); @@ -1166,17 +692,23 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) } ret = JNI_FALSE; } - if( ret==JNI_TRUE && !glXMakeCurrent( disp, None, NULL ) ) + glXMakeCurrent( disp, None, NULL ); + + if(ret==JNI_TRUE) { - fprintf(stderr, "GL4Java: gljDestroy failed\n"); - fflush(stderr); - ret = JNI_FALSE; - } else if(ret==JNI_TRUE) { glXDestroyContext(disp, gc); if(pix!=0) { - XFreePixmap(disp, (Pixmap)pix); + if(win!=0) + glXDestroyGLXPixmap(disp, win); + win=0; + XFreePixmap(disp, pix); } + if(jownwind && win!=0) + { + XDestroyWindow(disp, win); + win=0; + } } } @@ -1190,33 +722,37 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj ) } if(ret==JNI_TRUE && fpixmapHandle!=0) { - (*env)->SetIntField(env, obj, fpixmapHandle, (jint)pix); + (*env)->SetLongField(env, obj, fpixmapHandle, (jlong)((PointerHolder)pix)); } if(ret==JNI_TRUE && fwindowHandle!=0) { - (*env)->SetIntField(env, obj, fwindowHandle, (jint)win); + (*env)->SetLongField(env, obj, fwindowHandle, (jlong)((PointerHolder)win)); } if(ret==JNI_TRUE && fdisplayHandle) { - (*env)->SetIntField(env, obj, fdisplayHandle, (jint)disp); + (*env)->SetLongField(env, obj, fdisplayHandle, (jlong)((PointerHolder)disp)); } if(ret==JNI_TRUE && fglContext) { - (*env)->SetIntField(env, obj, fglContext, (jint)gc); + (*env)->SetLongField(env, obj, fglContext, (jlong)((PointerHolder)gc)); } if(ret==JNI_TRUE && fpData) { - (*env)->SetIntField(env, obj, fpData, (jint)pData); + (*env)->SetLongField(env, obj, fpData, pData); + } + + if(ret==JNI_TRUE && fownwind) { + (*env)->SetBooleanField(env, obj, fownwind, jownwind); } return ret; } JNIEXPORT jboolean JNICALL Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj, - jint disp, - jint thisWin, - jint glContext, + jlong disp, + jlong thisWin, + jlong glContext, jboolean doubleBuffer ) { @@ -1226,95 +762,10 @@ Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj, /* don't double buffer */ glXWaitGL(); } else { - glXSwapBuffers( (Display *)disp, (Window)thisWin ); + glXSwapBuffers( (Display *)((PointerHolder)disp), + (Window)((PointerHolder)thisWin) ); } return JNI_TRUE; } -/* - * Name : get_GC - * - * Parameters: win - the X window use to the OpenGL context with - * visual - The visual to create the context for - * gc - a pointer to a GLXContext structure. This is how - * the created context will be returned to the caller - * - * Returns : a pointer to a created GLXContext is returned through the - * gc argument. - * int - an error code: 0 means everything was fine - * -1 context creation failed - * -2 context/window association failed - * - * Purpose : create an X window Graphics context and assocaite it with - * the window. It returns 0 if everything was fine, -1 if the - * context could not be created, -2 if the context could not - * be associated with the window - */ -static int get_GC( Display *display, Window win, XVisualInfo *visual, - GLXContext *gc, GLXContext gc_share) -{ - int trial = 2; - - while(trial>0) - { - switch(trial) - { - case 2: - *gc = glXCreateContext( display, visual, gc_share, GL_TRUE ); - break; - case 1: - *gc = glXCreateContext( display, visual, gc_share, GL_FALSE ); - break; - } - trial--; - - /* check if the context could be created */ - if( *gc == NULL ) { - continue; - } - - /* associated the context with the X window */ - if( glXMakeCurrent( display, win, *gc ) == False) { - glXDestroyContext( display, *gc ); - continue; - } else return 0; - } - - return -2; -} - -static jboolean testX11Java() -{ - jboolean ret=JNI_TRUE; - - /* NON DEPENDENCE CHECKS */ - - /* FIRST OF ALL CHECK IF A NATIVE POINTER OR X11-TYPE FITS IN �jint� */ - - if( sizeof(jint) < sizeof(Display *) ) - { - fprintf(stderr,"GL4Java: (Display *) fits not in jint\n"); - ret = JNI_FALSE; - } - - if( sizeof(jint) < sizeof(GLXContext) ) - { - fprintf(stderr,"GL4Java: GLXContext fits not in jint\n"); - ret = JNI_FALSE; - } - - if( sizeof(jint) < sizeof(Window) ) - { - fprintf(stderr,"GL4Java: Window fits not in jint\n"); - ret = JNI_FALSE; - } - - if(ret==JNI_FALSE) - { - fflush(stderr); - } - - return ret; -} - diff --git a/CNativeCode/OpenGL_misc.c b/CNativeCode/OpenGL_misc.c index d2ad7c6..5f9d502 100644 --- a/CNativeCode/OpenGL_misc.c +++ b/CNativeCode/OpenGL_misc.c @@ -27,22 +27,11 @@ static const char * _lib_version_= __LIB_VERSION__ ; static const char * _lib_vendor_ = "Jausoft - Sven Goethel Software Development"; #endif -#ifndef LIBAPIENTRY - #define LIBAPIENTRY -#endif -#ifndef LIBAPI - #define LIBAPI -#endif #ifndef CALLBACK #define CALLBACK #endif -jboolean testJavaGLTypes(jboolean verbose); - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM * vm, void *reserved); -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved); - -jboolean testJavaGLTypes(jboolean verbose) +jboolean LIBAPIENTRY testJavaGLTypes(jboolean verbose) { jboolean ret=JNI_TRUE; jint i1 = (jint)0xaaff; @@ -156,6 +145,12 @@ jboolean testJavaGLTypes(jboolean verbose) * GLbitfield : dito. */ + if( sizeof(void *) > sizeof(PointerHolder) ) + { + fprintf(stderr,"(void *) > (PointerHolder)\n"); + ret = JNI_FALSE; + } + if( sizeof(void *) > sizeof(jlong) ) { fprintf(stderr,"(void *) > (jlong)\n"); @@ -208,8 +203,12 @@ jboolean testJavaGLTypes(jboolean verbose) fprintf(stderr,"jfloat %d\n", sizeof(jfloat)); fprintf(stderr,"jdouble %d\n", sizeof(jdouble)); - fflush(stderr); + fprintf(stderr,"\nPointerHolder %d\n", sizeof(PointerHolder)); + + fprintf(stderr, "GL4Java: useJAWT=%d\n\n", + (int) Java_gl4java_GLContext_useJAWT( 0, 0 ) ); + fflush(stderr); return ret; } @@ -232,19 +231,6 @@ Java_gl4java_GLContext_gljGetNativeLibVendorNative(JNIEnv *env, jobject obj ) return (*env)->NewStringUTF(env, _lib_vendor_); } -JNIEXPORT jint JNICALL -JNI_OnLoad(JavaVM * vm, void *reserved) -{ - return 0x00010001; /* old JDK 1.1 JNI :-) */ -} - -JNIEXPORT void JNICALL -JNI_OnUnload(JavaVM *vm, void *reserved) -{ - /* old JNI :-) */ -} - - /** * Experimental Code, not done yet ! * This one is to upspeed the Offscreen rendering engine for e.g. Swing ! diff --git a/CNativeCode/OpenGL_misc.h b/CNativeCode/OpenGL_misc.h index 2312d8c..368e2f7 100644 --- a/CNativeCode/OpenGL_misc.h +++ b/CNativeCode/OpenGL_misc.h @@ -22,6 +22,19 @@ #define LIBAPI #endif + #ifndef USE_64BIT_POINTER + typedef int PointerHolder; + #else + typedef long PointerHolder; + #endif + + /* testJavaGLTypes does important implementation plattformspecific checks: + * + * o do fit the JNI <-> GL Variables-Type Mapping + * o IF ERROR OR VERBOSE -> DUMP JNI,GL Type-Length + */ + LIBAPI jboolean LIBAPIENTRY testJavaGLTypes(jboolean verbose); + LIBAPI void * LIBAPIENTRY getGLProcAddressHelper (const char * func, int * method, int debug, int verbose ); diff --git a/CNativeCode/jni12tools.c b/CNativeCode/jni12tools.c index afe60ad..b4236b3 100644 --- a/CNativeCode/jni12tools.c +++ b/CNativeCode/jni12tools.c @@ -526,4 +526,16 @@ void * LIBAPIENTRY jnitoolsCreateNativeArray (JavaBasicType jbt, int dataArrayLe } return arrdata; } +
+ +JNIEXPORT jint JNICALL +JNI_OnLoad(JavaVM * vm, void *reserved) +{ + return JNI_VERSION_1_2; +} + +JNIEXPORT void JNICALL +JNI_OnUnload(JavaVM *vm, void *reserved) +{ +} diff --git a/CNativeCode/jnitools.c b/CNativeCode/jnitools.c index 948d797..2e6f282 100644 --- a/CNativeCode/jnitools.c +++ b/CNativeCode/jnitools.c @@ -577,3 +577,16 @@ void * LIBAPIENTRY jnitoolsCreateNativeArray (JavaBasicType jbt, int dataArrayLe return arrdata; } +JNIEXPORT jint JNICALL +JNI_OnLoad(JavaVM * vm, void *reserved) +{ + return JNI_VERSION_1_1; +} + +JNIEXPORT void JNICALL +JNI_OnUnload(JavaVM *vm, void *reserved) +{ + /* old JNI :-) */ +} + + diff --git a/CNativeCode/jnitools.h b/CNativeCode/jnitools.h index ee02405..d4eb716 100644 --- a/CNativeCode/jnitools.h +++ b/CNativeCode/jnitools.h @@ -119,4 +119,12 @@ LIBAPI void * LIBAPIENTRY jnitoolsCreateNativeArray (JavaBasicType jbt, int dataArrayLen, const char * errText); + + /** + * It is very important that OnLoad returns + * the right JNI Version Number ... !! + */ + JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM * vm, void *reserved); + JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved); + #endif |