aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--C2J/manual/glu-manualCodedImplJNI.c2
-rw-r--r--C2J/manual/glu-manualCodedImplJNI2.java2
-rw-r--r--CHANGES.txt55
-rw-r--r--CNativeCode/OpenGLU_JauJNI12_funcs.c2
-rw-r--r--CNativeCode/OpenGLU_JauJNI12tst_funcs.c2
-rw-r--r--CNativeCode/OpenGLU_JauJNI_funcs.c2
-rw-r--r--CNativeCode/OpenGLU_JauJNInf_funcs.c4544
-rw-r--r--CNativeCode/OpenGLU_JauJNItst_funcs.c2
-rwxr-xr-xCNativeCode/OpenGL_Win32.c135
-rwxr-xr-xCNativeCode/OpenGL_Win32_common.c196
-rwxr-xr-xCNativeCode/OpenGL_Win32_common.h18
-rwxr-xr-xCNativeCode/OpenGL_Win32_jawt.c1402
-rw-r--r--CNativeCode/OpenGL_X11.c206
-rw-r--r--CNativeCode/OpenGL_X11_common.c402
-rw-r--r--CNativeCode/OpenGL_X11_common.h41
-rw-r--r--CNativeCode/OpenGL_X11_jawt.c221
-rw-r--r--CNativeCode/OpenGL_misc.c244
-rw-r--r--CNativeCode/OpenGL_misc.h54
-rw-r--r--CNativeCode/jawt_misc.c12
-rwxr-xr-xInstaller/makeMSIESignedCab.sh2
-rwxr-xr-xInstaller/makeMScert.sh4
-rwxr-xr-xInstaller/makeNetscapeSignedJar-Unix.sh2
-rw-r--r--Installer/versiondef.sh4
-rwxr-xr-xWin32VC6/GL4JavaJauGLJNI/GL4JavaJauGLJNI.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLJNI12/GL4JavaJauGLJNI12.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLJNI12tst/GL4JavaJauGLJNI12tst.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLJNInf/GL4JavaJauGLJNInf.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLJNItst/GL4JavaJauGLJNItst.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLUJNI/GL4JavaJauGLUJNI.plg11
-rwxr-xr-xWin32VC6/GL4JavaJauGLUJNI12/GL4JavaJauGLUJNI12.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLUJNI12tst/GL4JavaJauGLUJNI12tst.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLUJNInf/GL4JavaJauGLUJNI.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGLUJNItst/GL4JavaJauGLUJNItst.plg8
-rwxr-xr-xWin32VC6/GL4JavaJauGljJNI/GL4JavaJauGljJNI.plg407
-rwxr-xr-xWin32VC6/GL4JavaJauGljJNI12/GL4JavaJauGljJNI12.plg12
-rwxr-xr-xWin32VC6/GL4JavaJauGljJNI13/GL4JavaJauGljJNI13.dsp4
-rwxr-xr-xWin32VC6/GL4JavaMSJDirect/GL4JavaMSJDirect.plg8
-rw-r--r--demos/HodglimsNeHe/Lesson18.java3
-rw-r--r--demos/HodglimsNeHe/Lesson8.java96
-rwxr-xr-xdemos/MiscDemos/TriangleRotate.java70
-rw-r--r--demos/MiscDemos/alpha3D.java42
-rw-r--r--demos/MiscDemos/gears.java85
-rw-r--r--demos/MiscDemos/stencil.java90
-rwxr-xr-xdemos/RonsDemos/dinoshade.java2209
-rw-r--r--demos/RonsDemos/shadowvol.java76
-rw-r--r--gl4java/GLContext.java.skel242
-rw-r--r--gl4java/GLUFuncJauJNI.java10
-rw-r--r--gl4java/GLUFuncJauJNInf.java1650
-rw-r--r--gl4java/awt/GLAnimCanvas.java1489
-rw-r--r--gl4java/awt/GLCanvas.java1877
-rwxr-xr-xgl4java/awt/GLImageCanvas.java811
-rw-r--r--gl4java/swing/GLAnimJPanel.java92
-rw-r--r--gl4java/swing/GLJPanel.java1798
-rw-r--r--makefile84
-rw-r--r--symbols.mak.win32-java2-32bit6
55 files changed, 9749 insertions, 9049 deletions
diff --git a/C2J/manual/glu-manualCodedImplJNI.c b/C2J/manual/glu-manualCodedImplJNI.c
index 5f3c925..26c9be9 100644
--- a/C2J/manual/glu-manualCodedImplJNI.c
+++ b/C2J/manual/glu-manualCodedImplJNI.c
@@ -27,7 +27,7 @@ Java_gl4java_GLUFuncJauJNI_gluGetString ( JNIEnv *env, jobject obj,
}
static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _glu_lib_version_="2.4.1.0";
+static const char * _glu_lib_version_="2.5.2.0";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
diff --git a/C2J/manual/glu-manualCodedImplJNI2.java b/C2J/manual/glu-manualCodedImplJNI2.java
index 0beb75f..4af651f 100644
--- a/C2J/manual/glu-manualCodedImplJNI2.java
+++ b/C2J/manual/glu-manualCodedImplJNI2.java
@@ -9,7 +9,7 @@ public final String getClassVendor ( )
{ return "Jausoft - Sven Goethel Software Development"; }
public final String getClassVersion ( )
-{ return "2.4.1.0"; }
+{ return "2.5.2.0"; }
/**
diff --git a/CHANGES.txt b/CHANGES.txt
index 16c82f8..3277b21 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,6 @@
\begin{verbatim}
-Last Changes: 12th February 2001 (Version 2.5.2 - Release 0 )
+Last Changes: 23th February 2001 (Version 2.6.0 - Release 0 )
Started: July 1997 (Version 0)
-----------------
@@ -8,7 +8,55 @@ TOP = NEW
DOWN = OLD
-----------------
-12th February 2001 (Version 2.5.2 - Release 0 )
+23th February 2001 (Version 2.6.0 - Release 0 )
+ o Converted David Bucciarelli's gltestperf
+ to java !
+ Go to directory demos, and do "java gltestperf --help" !
+
+ o Implemented JDK >= 1.3's GraphicsConfiguration
+
+ With the new GLCapabilities and the factory
+ SunJDK13GLDrawableFactory (only usable JDK>=1.3),
+ a Canvas and it's native Window
+ can be created with the right native format
+ for the OpenGL features(set in GLCapabilities),
+ so there is no more need for an own created window !
+
+ GLContext, GLCanvas and GLAnimCanvas supports
+ now GLCapabilities and GraphicsConfiguration
+ within it's constructor !
+
+ GLContext has no more protected attributes, like
+ doubleBuffer, etc., because it now holds an
+ GLCapabilities object !
+
+ For a raw example, see:
+ gl4java.GLContext (itself's main method)
+ demos/MiscDemos/alpha3D.java
+ demos/HodglimsNeHe/Lesson8.java
+
+ The MacOs's implementation of the Factory to use
+ GraphicsConfiguration is currently missing ...
+
+ o Introducing the new GLDrawable/GLEventListener model
+ initiated by Kenneth B Russel.
+ This includes usage of new Factories, see above !
+
+ Have a look at the gl4java.drawable package !
+
+ The following demos does use the new style also:
+ demos/MiscDemos/gears.java
+ demos/MiscDemos/stencil.java
+ demos/MiscDemos/TestListener.java
+ demos/MiscDemos/TriangleRotate.java
+ ... have a look.
+
+ You can now implement a GLDrawable,
+ like GLCanvas and GLAnimCanvas,
+ which can add some GLEventListener's.
+
+ GLEventListener implements all needed rendering functions.
+
o Implements JDK >= 1.3.X 's JAWT
The mechanism of fetching the native window handle (etc.),
is - since JDK 1.3.0 - now an official standard !
@@ -16,8 +64,7 @@ DOWN = OLD
This feature is used within the "GL4JavaJauGljJNI13"
native library, which is used dynamically if JVM >= 1.3 !
- Many thanxs to Kenneth B. Russel for
- motivations:
+ Many thanxs to Kenneth B. Russel for motivations:
JDK 1.4 will no more support the old
illegal style of fetching the native window handle !
diff --git a/CNativeCode/OpenGLU_JauJNI12_funcs.c b/CNativeCode/OpenGLU_JauJNI12_funcs.c
index 5ad9e76..0b59881 100644
--- a/CNativeCode/OpenGLU_JauJNI12_funcs.c
+++ b/CNativeCode/OpenGLU_JauJNI12_funcs.c
@@ -62,7 +62,7 @@ Java_gl4java_GLUFuncJauJNI_gluGetString ( JNIEnv *env, jobject obj,
}
static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _glu_lib_version_="2.4.1.0";
+static const char * _glu_lib_version_="2.5.2.0";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
diff --git a/CNativeCode/OpenGLU_JauJNI12tst_funcs.c b/CNativeCode/OpenGLU_JauJNI12tst_funcs.c
index 1fc3b2c..4c6fa7e 100644
--- a/CNativeCode/OpenGLU_JauJNI12tst_funcs.c
+++ b/CNativeCode/OpenGLU_JauJNI12tst_funcs.c
@@ -62,7 +62,7 @@ Java_gl4java_GLUFuncJauJNI_gluGetString ( JNIEnv *env, jobject obj,
}
static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _glu_lib_version_="2.4.1.0";
+static const char * _glu_lib_version_="2.5.2.0";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
diff --git a/CNativeCode/OpenGLU_JauJNI_funcs.c b/CNativeCode/OpenGLU_JauJNI_funcs.c
index 1fda2a3..8b2f135 100644
--- a/CNativeCode/OpenGLU_JauJNI_funcs.c
+++ b/CNativeCode/OpenGLU_JauJNI_funcs.c
@@ -62,7 +62,7 @@ Java_gl4java_GLUFuncJauJNI_gluGetString ( JNIEnv *env, jobject obj,
}
static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _glu_lib_version_="2.4.1.0";
+static const char * _glu_lib_version_="2.5.2.0";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
diff --git a/CNativeCode/OpenGLU_JauJNInf_funcs.c b/CNativeCode/OpenGLU_JauJNInf_funcs.c
index 9860fad..ddddcee 100644
--- a/CNativeCode/OpenGLU_JauJNInf_funcs.c
+++ b/CNativeCode/OpenGLU_JauJNInf_funcs.c
@@ -1,9 +1,9 @@
-/* WARNING ! WARNING *** THIS FILE IS GENERATED BY C2J !!!
-
- DO NOT MAKE ANY CHANGES *** MAKE CHANGES IN THE SKELETON FILES !!!
-*/
-
-
+/* WARNING ! WARNING *** THIS FILE IS GENERATED BY C2J !!!
+
+ DO NOT MAKE ANY CHANGES *** MAKE CHANGES IN THE SKELETON FILES !!!
+*/
+
+
/*
* Leo Chan -- 1995
*
@@ -33,2269 +33,2269 @@
* herein lies the native JAVA methods for the OpenGL functions.
*/
-static const char _glu_n_a_string[] = "GLU-String not avaiable !";
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluErrorString ( JNIEnv *env, jobject obj,
- jint errorCode )
-{
- const char *tmpString=0;
-
- tmpString = gluErrorString ( /* jint */ errorCode );
- if(tmpString==NULL)
- tmpString=_glu_n_a_string;
-
- return (*env)->NewStringUTF(env, tmpString);
-}
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluGetString ( JNIEnv *env, jobject obj,
- jint name )
-{
- const char *tmpString=0;
-
- tmpString = gluGetString ( /* jint */ name);
- if(tmpString==NULL)
- tmpString=_glu_n_a_string;
-
- return (*env)->NewStringUTF(env, tmpString);
-}
-
-static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _glu_lib_version_="2.4.1.0";
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLUFuncJauJNInf_getNativeVendor ( JNIEnv *env, jobject obj )
-{
- return (*env)->NewStringUTF(env, _glu_lib_vendor_);
-}
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLUFuncJauJNInf_getNativeVersion ( JNIEnv *env, jobject obj )
-{
- return (*env)->NewStringUTF(env, _glu_lib_version_);
-}
-
-static void _AddCallbackNode(JNIEnv *env,
- jlong qnt_obj, jint which,
- jobject methodClassInstance,
- jstring methodName,
- jstring signature,
- jint arrayLen1,
- jint arrayLen2,
- jint arrayLen3,
- jint arrayLen4,
- jint arrayLen5)
-{
- char * strMethodName = jnitoolsGetJavaString(env, methodName);
- char * strSignature = jnitoolsGetJavaString(env, signature);
- jlong glx=0;
-
- glx = GetCurrentGLContext();
-
- AddCallbackNode(env, methodClassInstance, strMethodName, strSignature,
- arrayLen1, arrayLen2, arrayLen3,
- arrayLen4, arrayLen5,
- (void *)((PointerHolder)qnt_obj), which, glx);
- free(strMethodName);
- free(strSignature);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluQuadricCallback( JNIEnv *env, jobject obj,
- jlong qobj, jint which,
- jobject methodClassInstance,
- jstring methodName,
- jstring signature)
-{
- switch(which)
- {
- case GLU_ERROR:
- gluQuadricCallback((void *)((PointerHolder)qobj),
- which, cbf_GLU_ERROR );
- break;
- default:
- jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
- return;
- }
- _AddCallbackNode(env,
- qobj, which, methodClassInstance, methodName,
- signature,
- 0, 0, 0, 0, 0);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluNurbsCallback( JNIEnv *env, jobject obj,
- jlong nobj, jint which,
- jobject methodClassInstance,
- jstring methodName,
- jstring signature)
-{
- switch(which)
- {
- case GLU_ERROR:
- gluNurbsCallback((void *)((PointerHolder)nobj), which,
- cbf_GLU_ERROR );
- break;
- default:
- jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
- return;
- }
- _AddCallbackNode(env,
- nobj, which, methodClassInstance, methodName,
- signature,
- 0, 0, 0, 0, 0);
-}
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluTessCallback( JNIEnv *env, jobject obj,
- jlong tobj, jint which,
- jobject methodClassInstance,
- jstring methodName,
- jstring signature,
- jint arrayLen1,
- jint arrayLen2,
- jint arrayLen3,
- jint arrayLen4,
- jint arrayLen5)
-{
- switch(which)
- {
- case GLU_TESS_BEGIN:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_BEGIN );
- break;
- case GLU_TESS_BEGIN_DATA:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_BEGIN_DATA );
- break;
- case GLU_TESS_EDGE_FLAG:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_EDGE_FLAG );
- break;
- case GLU_TESS_EDGE_FLAG_DATA:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_EDGE_FLAG_DATA );
- break;
- case GLU_TESS_VERTEX:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_VERTEX );
- break;
- case GLU_TESS_VERTEX_DATA:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_VERTEX_DATA );
- break;
- case GLU_TESS_END:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_END );
- break;
- case GLU_TESS_END_DATA:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_END_DATA );
- break;
- case GLU_TESS_ERROR:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_ERROR );
- break;
- case GLU_TESS_ERROR_DATA:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_ERROR_DATA );
- break;
- case GLU_TESS_COMBINE:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_COMBINE );
- break;
- case GLU_TESS_COMBINE_DATA:
- gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
- which,
- cbf_GLU_TESS_COMBINE_DATA );
- break;
- default:
- jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
- return;
- }
- _AddCallbackNode(env,
- tobj, which, methodClassInstance, methodName,
- signature,
- arrayLen1, arrayLen2, arrayLen3,
- arrayLen4, arrayLen5);
-}
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluDeleteQuadric( JNIEnv *env, jobject obj,
- jlong qobj )
-{
- gluDeleteQuadric((void *)((PointerHolder)qobj));
- RemoveCallbackNodes((void *)((PointerHolder)qobj));
-}
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj,
- jlong nobj )
-{
- gluDeleteNurbsRenderer((void *)((PointerHolder)nobj));
- RemoveCallbackNodes((void *)((PointerHolder)nobj));
-}
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj,
- 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)
-{
- return (jlong)((PointerHolder)gluNewTess());
-}
-
-/**
- * C2J Parser Version 1.5 Beta
- * Jausoft - Sven Goethel Software Development
- * Reading from file: glu-proto-auto.orig.h . . .
- * Destination-Class: gl4java_GLUFuncJauJNInf !
- */
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluLookAt ( GLdouble eyex , GLdouble eyey , GLdouble eyez , GLdouble centerx , GLdouble centery , GLdouble centerz , GLdouble upx , GLdouble upy , GLdouble upz ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluLookAt (
- JNIEnv *env, jobject obj,
- jdouble eyex,
- jdouble eyey,
- jdouble eyez,
- jdouble centerx,
- jdouble centery,
- jdouble centerz,
- jdouble upx,
- jdouble upy,
- jdouble upz)
- {
-
- gluLookAt (
- (GLdouble) eyex,
- (GLdouble) eyey,
- (GLdouble) eyez,
- (GLdouble) centerx,
- (GLdouble) centery,
- (GLdouble) centerz,
- (GLdouble) upx,
- (GLdouble) upy,
- (GLdouble) upz
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluOrtho2D ( GLdouble left , GLdouble right , GLdouble bottom , GLdouble top ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluOrtho2D (
- JNIEnv *env, jobject obj,
- jdouble left,
- jdouble right,
- jdouble bottom,
- jdouble top)
- {
-
- gluOrtho2D (
- (GLdouble) left,
- (GLdouble) right,
- (GLdouble) bottom,
- (GLdouble) top
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPerspective ( GLdouble fovy , GLdouble aspect , GLdouble zNear , GLdouble zFar ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluPerspective (
- JNIEnv *env, jobject obj,
- jdouble fovy,
- jdouble aspect,
- jdouble zNear,
- jdouble zFar)
- {
-
- gluPerspective (
- (GLdouble) fovy,
- (GLdouble) aspect,
- (GLdouble) zNear,
- (GLdouble) zFar
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPickMatrix ( GLdouble x , GLdouble y , GLdouble width , GLdouble height , GLint * viewport ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluPickMatrix (
- JNIEnv *env, jobject obj,
- jdouble x,
- jdouble y,
- jdouble width,
- jdouble height,
- jintArray viewport)
- {
- jboolean isCopiedArray4 = JNI_FALSE;
- jint *ptr4 = NULL;
-
- if(viewport!=NULL)
- {
- ptr4 = (*env)->GetIntArrayElements(env, viewport, &isCopiedArray4);
- }
- gluPickMatrix (
- (GLdouble) x,
- (GLdouble) y,
- (GLdouble) width,
- (GLdouble) height,
- (GLint *) ptr4
- );
-
- if(viewport!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, viewport, ptr4, (isCopiedArray4 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluProject ( GLdouble objx , GLdouble objy , GLdouble objz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * winx , GLdouble * winy , GLdouble * winz ) ;
- * </pre>
- */
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluProject (
- JNIEnv *env, jobject obj,
- jdouble objx,
- jdouble objy,
- jdouble objz,
- jdoubleArray modelMatrix,
- jdoubleArray projMatrix,
- jintArray viewport,
- jdoubleArray winx,
- jdoubleArray winy,
- jdoubleArray winz)
- {
- jint ret;
-
- jdouble *ptr3 = NULL;
- jdouble *ptr4 = NULL;
- jint *ptr5 = NULL;
- jboolean isCopiedArray6 = JNI_FALSE;
- jdouble *ptr6 = NULL;
- jboolean isCopiedArray7 = JNI_FALSE;
- jdouble *ptr7 = NULL;
- jboolean isCopiedArray8 = JNI_FALSE;
- jdouble *ptr8 = NULL;
-
- if(modelMatrix!=NULL)
- {
- ptr3 = (*env)->GetDoubleArrayElements(env, modelMatrix, 0);
- }
- if(projMatrix!=NULL)
- {
- ptr4 = (*env)->GetDoubleArrayElements(env, projMatrix, 0);
- }
- if(viewport!=NULL)
- {
- ptr5 = (*env)->GetIntArrayElements(env, viewport, 0);
- }
- if(winx!=NULL)
- {
- ptr6 = (*env)->GetDoubleArrayElements(env, winx, &isCopiedArray6);
- }
- if(winy!=NULL)
- {
- ptr7 = (*env)->GetDoubleArrayElements(env, winy, &isCopiedArray7);
- }
- if(winz!=NULL)
- {
- ptr8 = (*env)->GetDoubleArrayElements(env, winz, &isCopiedArray8);
- }
- ret = (jint) gluProject (
- (GLdouble) objx,
- (GLdouble) objy,
- (GLdouble) objz,
- (const GLdouble *) ptr3,
- (const GLdouble *) ptr4,
- (const GLint *) ptr5,
- (GLdouble *) ptr6,
- (GLdouble *) ptr7,
- (GLdouble *) ptr8
- );
-
- if(modelMatrix!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, modelMatrix, ptr3, JNI_ABORT);
- }
- if(projMatrix!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, projMatrix, ptr4, JNI_ABORT);
- }
- if(viewport!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, viewport, ptr5, JNI_ABORT);
- }
- if(winx!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, winx, ptr6, (isCopiedArray6 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(winy!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, winy, ptr7, (isCopiedArray7 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(winz!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, winz, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT);
- }
- return ret;
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluUnProject ( GLdouble winx , GLdouble winy , GLdouble winz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * objx , GLdouble * objy , GLdouble * objz ) ;
- * </pre>
- */
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluUnProject (
- JNIEnv *env, jobject obj,
- jdouble winx,
- jdouble winy,
- jdouble winz,
- jdoubleArray modelMatrix,
- jdoubleArray projMatrix,
- jintArray viewport,
- jdoubleArray objx,
- jdoubleArray objy,
- jdoubleArray objz)
- {
- jint ret;
-
- jdouble *ptr3 = NULL;
- jdouble *ptr4 = NULL;
- jint *ptr5 = NULL;
- jboolean isCopiedArray6 = JNI_FALSE;
- jdouble *ptr6 = NULL;
- jboolean isCopiedArray7 = JNI_FALSE;
- jdouble *ptr7 = NULL;
- jboolean isCopiedArray8 = JNI_FALSE;
- jdouble *ptr8 = NULL;
-
- if(modelMatrix!=NULL)
- {
- ptr3 = (*env)->GetDoubleArrayElements(env, modelMatrix, 0);
- }
- if(projMatrix!=NULL)
- {
- ptr4 = (*env)->GetDoubleArrayElements(env, projMatrix, 0);
- }
- if(viewport!=NULL)
- {
- ptr5 = (*env)->GetIntArrayElements(env, viewport, 0);
- }
- if(objx!=NULL)
- {
- ptr6 = (*env)->GetDoubleArrayElements(env, objx, &isCopiedArray6);
- }
- if(objy!=NULL)
- {
- ptr7 = (*env)->GetDoubleArrayElements(env, objy, &isCopiedArray7);
- }
- if(objz!=NULL)
- {
- ptr8 = (*env)->GetDoubleArrayElements(env, objz, &isCopiedArray8);
- }
- ret = (jint) gluUnProject (
- (GLdouble) winx,
- (GLdouble) winy,
- (GLdouble) winz,
- (const GLdouble *) ptr3,
- (const GLdouble *) ptr4,
- (const GLint *) ptr5,
- (GLdouble *) ptr6,
- (GLdouble *) ptr7,
- (GLdouble *) ptr8
- );
-
- if(modelMatrix!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, modelMatrix, ptr3, JNI_ABORT);
- }
- if(projMatrix!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, projMatrix, ptr4, JNI_ABORT);
- }
- if(viewport!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, viewport, ptr5, JNI_ABORT);
- }
- if(objx!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, objx, ptr6, (isCopiedArray6 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(objy!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, objy, ptr7, (isCopiedArray7 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(objz!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, objz, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT);
- }
- return ret;
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluScaleImage ( GLenum format , GLsizei widthin , GLsizei heightin , GLenum typein , const char * datain , GLsizei widthout , GLsizei heightout , GLenum typeout , char * dataout ) ;
- * </pre>
- */
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluScaleImage (
- JNIEnv *env, jobject obj,
- jint format,
- jint widthin,
- jint heightin,
- jint typein,
- jbyteArray datain,
- jint widthout,
- jint heightout,
- jint typeout,
- jbyteArray dataout)
- {
- jint ret;
-
- jbyte *ptr4 = NULL;
- jboolean isCopiedArray8 = JNI_FALSE;
- jbyte *ptr8 = NULL;
-
- if(datain!=NULL)
- {
- ptr4 = (*env)->GetByteArrayElements(env, datain, 0);
- }
- if(dataout!=NULL)
- {
- ptr8 = (*env)->GetByteArrayElements(env, dataout, &isCopiedArray8);
- }
- ret = (jint) gluScaleImage (
- (GLenum) format,
- (GLsizei) widthin,
- (GLsizei) heightin,
- (GLenum) typein,
- (const char *) ptr4,
- (GLsizei) widthout,
- (GLsizei) heightout,
- (GLenum) typeout,
- (char *) ptr8
- );
-
- if(datain!=NULL)
- {
- (*env)->ReleaseByteArrayElements(env, datain, ptr4, JNI_ABORT);
- }
- if(dataout!=NULL)
- {
- (*env)->ReleaseByteArrayElements(env, dataout, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT);
- }
- return ret;
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluBuild1DMipmaps ( GLenum target , GLint components , GLint width , GLenum format , GLenum type , const void * data ) ;
- * </pre>
- */
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3B (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jbyteArray data)
- {
- jint ret;
-
- jbyte *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetByteArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseByteArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3S (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jshortArray data)
- {
- jint ret;
-
- jshort *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetShortArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseShortArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3I (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jintArray data)
- {
- jint ret;
-
- jint *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetIntArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3F (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jfloatArray data)
- {
- jint ret;
-
- jfloat *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetFloatArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3D (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jdoubleArray data)
- {
- jint ret;
-
- jdouble *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetDoubleArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3Z (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jbooleanArray data)
- {
- jint ret;
-
- jboolean *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetBooleanArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseBooleanArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3J (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint format,
- jint type,
- jlongArray data)
- {
- jint ret;
-
- jlong *ptr5 = NULL;
-
- if(data!=NULL)
- {
- ptr5 = (*env)->GetLongArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild1DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr5
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseLongArrayElements(env, data, ptr5, JNI_ABORT);
- }
- return ret;
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluBuild2DMipmaps ( GLenum target , GLint components , GLint width , GLint height , GLenum format , GLenum type , const void * data ) ;
- * </pre>
- */
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3B (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jbyteArray data)
- {
- jint ret;
-
- jbyte *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetByteArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseByteArrayElements(env, data, ptr6, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3S (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jshortArray data)
- {
- jint ret;
-
- jshort *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetShortArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseShortArrayElements(env, data, ptr6, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3I (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jintArray data)
- {
- jint ret;
-
- jint *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetIntArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, data, ptr6, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3F (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jfloatArray data)
- {
- jint ret;
-
- jfloat *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetFloatArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, data, ptr6, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3D (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jdoubleArray data)
- {
- jint ret;
-
- jdouble *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetDoubleArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, data, ptr6, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3Z (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jbooleanArray data)
- {
- jint ret;
-
- jboolean *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetBooleanArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseBooleanArrayElements(env, data, ptr6, JNI_ABORT);
- }
- return ret;
- }
- JNIEXPORT jint JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3J (
- JNIEnv *env, jobject obj,
- jint target,
- jint components,
- jint width,
- jint height,
- jint format,
- jint type,
- jlongArray data)
- {
- jint ret;
-
- jlong *ptr6 = NULL;
-
- if(data!=NULL)
- {
- ptr6 = (*env)->GetLongArrayElements(env, data, 0);
- }
- ret = (jint) gluBuild2DMipmaps (
- (GLenum) target,
- (GLint) components,
- (GLint) width,
- (GLint) height,
- (GLenum) format,
- (GLenum) type,
- (const void *) ptr6
- );
-
- if(data!=NULL)
- {
- (*env)->ReleaseLongArrayElements(env, data, ptr6, JNI_ABORT);
- }
- 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,
- jlong quadObject,
- jint drawStyle)
- {
-
- gluQuadricDrawStyle (
- (GLUquadricObj *) (PointerHolder) quadObject,
- (GLenum) drawStyle
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricOrientation ( GLUquadricObj * quadObject , GLenum orientation ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluQuadricOrientation (
- JNIEnv *env, jobject obj,
- jlong quadObject,
- jint orientation)
- {
-
- gluQuadricOrientation (
- (GLUquadricObj *) (PointerHolder) quadObject,
- (GLenum) orientation
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricNormals ( GLUquadricObj * quadObject , GLenum normals ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluQuadricNormals (
- JNIEnv *env, jobject obj,
- jlong quadObject,
- jint normals)
- {
-
- gluQuadricNormals (
- (GLUquadricObj *) (PointerHolder) quadObject,
- (GLenum) normals
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricTexture ( GLUquadricObj * quadObject , GLboolean textureCoords ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluQuadricTexture (
- JNIEnv *env, jobject obj,
- jlong quadObject,
- jboolean textureCoords)
- {
-
- gluQuadricTexture (
- (GLUquadricObj *) (PointerHolder) quadObject,
- (GLboolean) textureCoords
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluCylinder ( GLUquadricObj * qobj , GLdouble baseRadius , GLdouble topRadius , GLdouble height , GLint slices , GLint stacks ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluCylinder (
- JNIEnv *env, jobject obj,
- jlong qobj,
- jdouble baseRadius,
- jdouble topRadius,
- jdouble height,
- jint slices,
- jint stacks)
- {
-
- gluCylinder (
- (GLUquadricObj *) (PointerHolder) qobj,
- (GLdouble) baseRadius,
- (GLdouble) topRadius,
- (GLdouble) height,
- (GLint) slices,
- (GLint) stacks
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluSphere ( GLUquadricObj * qobj , GLdouble radius , GLint slices , GLint stacks ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluSphere (
- JNIEnv *env, jobject obj,
- jlong qobj,
- jdouble radius,
- jint slices,
- jint stacks)
- {
-
- gluSphere (
- (GLUquadricObj *) (PointerHolder) qobj,
- (GLdouble) radius,
- (GLint) slices,
- (GLint) stacks
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluDisk (
- JNIEnv *env, jobject obj,
- jlong qobj,
- jdouble innerRadius,
- jdouble outerRadius,
- jint slices,
- jint loops)
- {
-
- gluDisk (
- (GLUquadricObj *) (PointerHolder) qobj,
- (GLdouble) innerRadius,
- (GLdouble) outerRadius,
- (GLint) slices,
- (GLint) loops
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPartialDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops , GLdouble startAngle , GLdouble sweepAngle ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluPartialDisk (
- JNIEnv *env, jobject obj,
- jlong qobj,
- jdouble innerRadius,
- jdouble outerRadius,
- jint slices,
- jint loops,
- jdouble startAngle,
- jdouble sweepAngle)
- {
-
- gluPartialDisk (
- (GLUquadricObj *) (PointerHolder) qobj,
- (GLdouble) innerRadius,
- (GLdouble) outerRadius,
- (GLint) slices,
- (GLint) loops,
- (GLdouble) startAngle,
- (GLdouble) sweepAngle
- );
-
- }
-
-/**
- * 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,
- jlong nobj,
- jfloatArray modelMatrix,
- jfloatArray projMatrix,
- jintArray viewport)
- {
- jfloat *ptr1 = NULL;
- jfloat *ptr2 = NULL;
- jint *ptr3 = NULL;
-
- if(modelMatrix!=NULL)
- {
- ptr1 = (*env)->GetFloatArrayElements(env, modelMatrix, 0);
- }
- if(projMatrix!=NULL)
- {
- ptr2 = (*env)->GetFloatArrayElements(env, projMatrix, 0);
- }
- if(viewport!=NULL)
- {
- ptr3 = (*env)->GetIntArrayElements(env, viewport, 0);
- }
- gluLoadSamplingMatrices (
- (GLUnurbsObj *) (PointerHolder) nobj,
- (const GLfloat *) ptr1,
- (const GLfloat *) ptr2,
- (const GLint *) ptr3
- );
-
- if(modelMatrix!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, modelMatrix, ptr1, JNI_ABORT);
- }
- if(projMatrix!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, projMatrix, ptr2, JNI_ABORT);
- }
- if(viewport!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, viewport, ptr3, JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat value ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluNurbsProperty (
- JNIEnv *env, jobject obj,
- jlong nobj,
- jint property,
- jfloat value)
- {
-
- gluNurbsProperty (
- (GLUnurbsObj *) (PointerHolder) nobj,
- (GLenum) property,
- (GLfloat) value
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluGetNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat * value ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluGetNurbsProperty (
- JNIEnv *env, jobject obj,
- jlong nobj,
- jint property,
- jfloatArray value)
- {
- jboolean isCopiedArray2 = JNI_FALSE;
- jfloat *ptr2 = NULL;
-
- if(value!=NULL)
- {
- ptr2 = (*env)->GetFloatArrayElements(env, value, &isCopiedArray2);
- }
- gluGetNurbsProperty (
- (GLUnurbsObj *) (PointerHolder) nobj,
- (GLenum) property,
- (GLfloat *) ptr2
- );
-
- if(value!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, value, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginCurve ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBeginCurve (
- JNIEnv *env, jobject obj,
- jlong nobj)
- {
-
- gluBeginCurve (
- (GLUnurbsObj *) (PointerHolder) nobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndCurve ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluEndCurve (
- JNIEnv *env, jobject obj,
- jlong nobj)
- {
-
- gluEndCurve (
- (GLUnurbsObj *) (PointerHolder) nobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNurbsCurve ( GLUnurbsObj * nobj , GLint nknots , GLfloat * knot , GLint stride , GLfloat * ctlarray , GLint order , GLenum type ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluNurbsCurve (
- JNIEnv *env, jobject obj,
- jlong nobj,
- jint nknots,
- jfloatArray knot,
- jint stride,
- jfloatArray ctlarray,
- jint order,
- jint type)
- {
- jboolean isCopiedArray2 = JNI_FALSE;
- jfloat *ptr2 = NULL;
- jboolean isCopiedArray4 = JNI_FALSE;
- jfloat *ptr4 = NULL;
-
- if(knot!=NULL)
- {
- ptr2 = (*env)->GetFloatArrayElements(env, knot, &isCopiedArray2);
- }
- if(ctlarray!=NULL)
- {
- ptr4 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray4);
- }
- gluNurbsCurve (
- (GLUnurbsObj *) (PointerHolder) nobj,
- (GLint) nknots,
- (GLfloat *) ptr2,
- (GLint) stride,
- (GLfloat *) ptr4,
- (GLint) order,
- (GLenum) type
- );
-
- if(knot!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, knot, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(ctlarray!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, ctlarray, ptr4, (isCopiedArray4 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginSurface ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBeginSurface (
- JNIEnv *env, jobject obj,
- jlong nobj)
- {
-
- gluBeginSurface (
- (GLUnurbsObj *) (PointerHolder) nobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndSurface ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluEndSurface (
- JNIEnv *env, jobject obj,
- jlong nobj)
- {
-
- gluEndSurface (
- (GLUnurbsObj *) (PointerHolder) nobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNurbsSurface ( GLUnurbsObj * nobj , GLint sknot_count , GLfloat * sknot , GLint tknot_count , GLfloat * tknot , GLint s_stride , GLint t_stride , GLfloat * ctlarray , GLint sorder , GLint torder , GLenum type ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluNurbsSurface (
- JNIEnv *env, jobject obj,
- jlong nobj,
- jint sknot_count,
- jfloatArray sknot,
- jint tknot_count,
- jfloatArray tknot,
- jint s_stride,
- jint t_stride,
- jfloatArray ctlarray,
- jint sorder,
- jint torder,
- jint type)
- {
- jboolean isCopiedArray2 = JNI_FALSE;
- jfloat *ptr2 = NULL;
- jboolean isCopiedArray4 = JNI_FALSE;
- jfloat *ptr4 = NULL;
- jboolean isCopiedArray7 = JNI_FALSE;
- jfloat *ptr7 = NULL;
-
- if(sknot!=NULL)
- {
- ptr2 = (*env)->GetFloatArrayElements(env, sknot, &isCopiedArray2);
- }
- if(tknot!=NULL)
- {
- ptr4 = (*env)->GetFloatArrayElements(env, tknot, &isCopiedArray4);
- }
- if(ctlarray!=NULL)
- {
- ptr7 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray7);
- }
- gluNurbsSurface (
- (GLUnurbsObj *) (PointerHolder) nobj,
- (GLint) sknot_count,
- (GLfloat *) ptr2,
- (GLint) tknot_count,
- (GLfloat *) ptr4,
- (GLint) s_stride,
- (GLint) t_stride,
- (GLfloat *) ptr7,
- (GLint) sorder,
- (GLint) torder,
- (GLenum) type
- );
-
- if(sknot!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, sknot, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(tknot!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, tknot, ptr4, (isCopiedArray4 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(ctlarray!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, ctlarray, ptr7, (isCopiedArray7 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginTrim ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBeginTrim (
- JNIEnv *env, jobject obj,
- jlong nobj)
- {
-
- gluBeginTrim (
- (GLUnurbsObj *) (PointerHolder) nobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndTrim ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluEndTrim (
- JNIEnv *env, jobject obj,
- jlong nobj)
- {
-
- gluEndTrim (
- (GLUnurbsObj *) (PointerHolder) nobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPwlCurve ( GLUnurbsObj * nobj , GLint count , GLfloat * array , GLint stride , GLenum type ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluPwlCurve (
- JNIEnv *env, jobject obj,
- jlong nobj,
- jint count,
- jfloatArray array,
- jint stride,
- jint type)
- {
- jboolean isCopiedArray2 = JNI_FALSE;
- jfloat *ptr2 = NULL;
-
- if(array!=NULL)
- {
- ptr2 = (*env)->GetFloatArrayElements(env, array, &isCopiedArray2);
- }
- gluPwlCurve (
- (GLUnurbsObj *) (PointerHolder) nobj,
- (GLint) count,
- (GLfloat *) ptr2,
- (GLint) stride,
- (GLenum) type
- );
-
- if(array!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, array, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3B (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jbyteArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jbyte *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetByteArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseByteArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3S (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jshortArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jshort *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetShortArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseShortArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3I (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jintArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jint *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetIntArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3F (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jfloatArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jfloat *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetFloatArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3D (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3Z (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jbooleanArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jboolean *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetBooleanArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseBooleanArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3J (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jlongArray polygon_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jlong *ptr1 = NULL;
-
- if(polygon_data!=NULL)
- {
- ptr1 = (*env)->GetLongArrayElements(env, polygon_data, &isCopiedArray1);
- }
- gluTessBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj,
- (void *) ptr1
- );
-
- if(polygon_data!=NULL)
- {
- (*env)->ReleaseLongArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessBeginContour ( GLUtesselator * tobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessBeginContour (
- JNIEnv *env, jobject obj,
- jlong tobj)
- {
-
- gluTessBeginContour (
- (GLUtesselator *) (PointerHolder) tobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessVertex ( GLUtesselator * tobj , GLdouble coords [ 3 ] , void * vertex_data ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3B (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jbyteArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jbyte *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetByteArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseByteArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3S (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jshortArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jshort *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetShortArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseShortArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3I (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jintArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jint *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetIntArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseIntArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3F (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jfloatArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jfloat *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetFloatArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseFloatArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3D (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jdoubleArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jdouble *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetDoubleArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3Z (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jbooleanArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jboolean *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetBooleanArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseBooleanArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3J (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdoubleArray coords,
- jlongArray vertex_data)
- {
- jboolean isCopiedArray1 = JNI_FALSE;
- jdouble *ptr1 = NULL;
- jboolean isCopiedArray2 = JNI_FALSE;
- jlong *ptr2 = NULL;
-
- if(coords!=NULL)
- {
- ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
- }
- if(vertex_data!=NULL)
- {
- ptr2 = (*env)->GetLongArrayElements(env, vertex_data, &isCopiedArray2);
- }
- gluTessVertex (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble *) ptr1,
- (void *) ptr2
- );
-
- if(coords!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
- }
- if(vertex_data!=NULL)
- {
- (*env)->ReleaseLongArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessEndContour ( GLUtesselator * tobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessEndContour (
- JNIEnv *env, jobject obj,
- jlong tobj)
- {
-
- gluTessEndContour (
- (GLUtesselator *) (PointerHolder) tobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessEndPolygon ( GLUtesselator * tobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessEndPolygon (
- JNIEnv *env, jobject obj,
- jlong tobj)
- {
-
- gluTessEndPolygon (
- (GLUtesselator *) (PointerHolder) tobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble value ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessProperty (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jint which,
- jdouble value)
- {
-
- gluTessProperty (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLenum) which,
- (GLdouble) value
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessNormal ( GLUtesselator * tobj , GLdouble x , GLdouble y , GLdouble z ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluTessNormal (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jdouble x,
- jdouble y,
- jdouble z)
- {
-
- gluTessNormal (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLdouble) x,
- (GLdouble) y,
- (GLdouble) z
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluGetTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble * value ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluGetTessProperty (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jint which,
- jdoubleArray value)
- {
- jboolean isCopiedArray2 = JNI_FALSE;
- jdouble *ptr2 = NULL;
-
- if(value!=NULL)
- {
- ptr2 = (*env)->GetDoubleArrayElements(env, value, &isCopiedArray2);
- }
- gluGetTessProperty (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLenum) which,
- (GLdouble *) ptr2
- );
-
- if(value!=NULL)
- {
- (*env)->ReleaseDoubleArrayElements(env, value, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
- }
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginPolygon ( GLUtesselator * tobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluBeginPolygon (
- JNIEnv *env, jobject obj,
- jlong tobj)
- {
-
- gluBeginPolygon (
- (GLUtesselator *) (PointerHolder) tobj
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNextContour ( GLUtesselator * tobj , GLenum type ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluNextContour (
- JNIEnv *env, jobject obj,
- jlong tobj,
- jint type)
- {
-
- gluNextContour (
- (GLUtesselator *) (PointerHolder) tobj,
- (GLenum) type
- );
-
- }
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndPolygon ( GLUtesselator * tobj ) ;
- * </pre>
- */
- JNIEXPORT void JNICALL
- Java_gl4java_GLUFuncJauJNInf_gluEndPolygon (
- JNIEnv *env, jobject obj,
- jlong tobj)
- {
-
- gluEndPolygon (
- (GLUtesselator *) (PointerHolder) tobj
- );
-
- }
-
-/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */
+static const char _glu_n_a_string[] = "GLU-String not avaiable !";
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluErrorString ( JNIEnv *env, jobject obj,
+ jint errorCode )
+{
+ const char *tmpString=0;
+
+ tmpString = gluErrorString ( /* jint */ errorCode );
+ if(tmpString==NULL)
+ tmpString=_glu_n_a_string;
+
+ return (*env)->NewStringUTF(env, tmpString);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluGetString ( JNIEnv *env, jobject obj,
+ jint name )
+{
+ const char *tmpString=0;
+
+ tmpString = gluGetString ( /* jint */ name);
+ if(tmpString==NULL)
+ tmpString=_glu_n_a_string;
+
+ return (*env)->NewStringUTF(env, tmpString);
+}
+
+static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
+static const char * _glu_lib_version_="2.5.2.0";
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLUFuncJauJNInf_getNativeVendor ( JNIEnv *env, jobject obj )
+{
+ return (*env)->NewStringUTF(env, _glu_lib_vendor_);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLUFuncJauJNInf_getNativeVersion ( JNIEnv *env, jobject obj )
+{
+ return (*env)->NewStringUTF(env, _glu_lib_version_);
+}
+
+static void _AddCallbackNode(JNIEnv *env,
+ jlong qnt_obj, jint which,
+ jobject methodClassInstance,
+ jstring methodName,
+ jstring signature,
+ jint arrayLen1,
+ jint arrayLen2,
+ jint arrayLen3,
+ jint arrayLen4,
+ jint arrayLen5)
+{
+ char * strMethodName = jnitoolsGetJavaString(env, methodName);
+ char * strSignature = jnitoolsGetJavaString(env, signature);
+ jlong glx=0;
+
+ glx = GetCurrentGLContext();
+
+ AddCallbackNode(env, methodClassInstance, strMethodName, strSignature,
+ arrayLen1, arrayLen2, arrayLen3,
+ arrayLen4, arrayLen5,
+ (void *)((PointerHolder)qnt_obj), which, glx);
+ free(strMethodName);
+ free(strSignature);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluQuadricCallback( JNIEnv *env, jobject obj,
+ jlong qobj, jint which,
+ jobject methodClassInstance,
+ jstring methodName,
+ jstring signature)
+{
+ switch(which)
+ {
+ case GLU_ERROR:
+ gluQuadricCallback((void *)((PointerHolder)qobj),
+ which, cbf_GLU_ERROR );
+ break;
+ default:
+ jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
+ return;
+ }
+ _AddCallbackNode(env,
+ qobj, which, methodClassInstance, methodName,
+ signature,
+ 0, 0, 0, 0, 0);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluNurbsCallback( JNIEnv *env, jobject obj,
+ jlong nobj, jint which,
+ jobject methodClassInstance,
+ jstring methodName,
+ jstring signature)
+{
+ switch(which)
+ {
+ case GLU_ERROR:
+ gluNurbsCallback((void *)((PointerHolder)nobj), which,
+ cbf_GLU_ERROR );
+ break;
+ default:
+ jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
+ return;
+ }
+ _AddCallbackNode(env,
+ nobj, which, methodClassInstance, methodName,
+ signature,
+ 0, 0, 0, 0, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluTessCallback( JNIEnv *env, jobject obj,
+ jlong tobj, jint which,
+ jobject methodClassInstance,
+ jstring methodName,
+ jstring signature,
+ jint arrayLen1,
+ jint arrayLen2,
+ jint arrayLen3,
+ jint arrayLen4,
+ jint arrayLen5)
+{
+ switch(which)
+ {
+ case GLU_TESS_BEGIN:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_BEGIN );
+ break;
+ case GLU_TESS_BEGIN_DATA:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_BEGIN_DATA );
+ break;
+ case GLU_TESS_EDGE_FLAG:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_EDGE_FLAG );
+ break;
+ case GLU_TESS_EDGE_FLAG_DATA:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_EDGE_FLAG_DATA );
+ break;
+ case GLU_TESS_VERTEX:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_VERTEX );
+ break;
+ case GLU_TESS_VERTEX_DATA:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_VERTEX_DATA );
+ break;
+ case GLU_TESS_END:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_END );
+ break;
+ case GLU_TESS_END_DATA:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_END_DATA );
+ break;
+ case GLU_TESS_ERROR:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_ERROR );
+ break;
+ case GLU_TESS_ERROR_DATA:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_ERROR_DATA );
+ break;
+ case GLU_TESS_COMBINE:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_COMBINE );
+ break;
+ case GLU_TESS_COMBINE_DATA:
+ gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
+ which,
+ cbf_GLU_TESS_COMBINE_DATA );
+ break;
+ default:
+ jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
+ return;
+ }
+ _AddCallbackNode(env,
+ tobj, which, methodClassInstance, methodName,
+ signature,
+ arrayLen1, arrayLen2, arrayLen3,
+ arrayLen4, arrayLen5);
+}
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluDeleteQuadric( JNIEnv *env, jobject obj,
+ jlong qobj )
+{
+ gluDeleteQuadric((void *)((PointerHolder)qobj));
+ RemoveCallbackNodes((void *)((PointerHolder)qobj));
+}
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj,
+ jlong nobj )
+{
+ gluDeleteNurbsRenderer((void *)((PointerHolder)nobj));
+ RemoveCallbackNodes((void *)((PointerHolder)nobj));
+}
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLUFuncJauJNInf_gluDeleteTess( JNIEnv *env, jobject obj,
+ 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)
+{
+ return (jlong)((PointerHolder)gluNewTess());
+}
+
+/**
+ * C2J Parser Version 1.5 Beta
+ * Jausoft - Sven Goethel Software Development
+ * Reading from file: glu-proto-auto.orig.h . . .
+ * Destination-Class: gl4java_GLUFuncJauJNInf !
+ */
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluLookAt ( GLdouble eyex , GLdouble eyey , GLdouble eyez , GLdouble centerx , GLdouble centery , GLdouble centerz , GLdouble upx , GLdouble upy , GLdouble upz ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluLookAt (
+ JNIEnv *env, jobject obj,
+ jdouble eyex,
+ jdouble eyey,
+ jdouble eyez,
+ jdouble centerx,
+ jdouble centery,
+ jdouble centerz,
+ jdouble upx,
+ jdouble upy,
+ jdouble upz)
+ {
+
+ gluLookAt (
+ (GLdouble) eyex,
+ (GLdouble) eyey,
+ (GLdouble) eyez,
+ (GLdouble) centerx,
+ (GLdouble) centery,
+ (GLdouble) centerz,
+ (GLdouble) upx,
+ (GLdouble) upy,
+ (GLdouble) upz
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluOrtho2D ( GLdouble left , GLdouble right , GLdouble bottom , GLdouble top ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluOrtho2D (
+ JNIEnv *env, jobject obj,
+ jdouble left,
+ jdouble right,
+ jdouble bottom,
+ jdouble top)
+ {
+
+ gluOrtho2D (
+ (GLdouble) left,
+ (GLdouble) right,
+ (GLdouble) bottom,
+ (GLdouble) top
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPerspective ( GLdouble fovy , GLdouble aspect , GLdouble zNear , GLdouble zFar ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluPerspective (
+ JNIEnv *env, jobject obj,
+ jdouble fovy,
+ jdouble aspect,
+ jdouble zNear,
+ jdouble zFar)
+ {
+
+ gluPerspective (
+ (GLdouble) fovy,
+ (GLdouble) aspect,
+ (GLdouble) zNear,
+ (GLdouble) zFar
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPickMatrix ( GLdouble x , GLdouble y , GLdouble width , GLdouble height , GLint * viewport ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluPickMatrix (
+ JNIEnv *env, jobject obj,
+ jdouble x,
+ jdouble y,
+ jdouble width,
+ jdouble height,
+ jintArray viewport)
+ {
+ jboolean isCopiedArray4 = JNI_FALSE;
+ jint *ptr4 = NULL;
+
+ if(viewport!=NULL)
+ {
+ ptr4 = (*env)->GetIntArrayElements(env, viewport, &isCopiedArray4);
+ }
+ gluPickMatrix (
+ (GLdouble) x,
+ (GLdouble) y,
+ (GLdouble) width,
+ (GLdouble) height,
+ (GLint *) ptr4
+ );
+
+ if(viewport!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, viewport, ptr4, (isCopiedArray4 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluProject ( GLdouble objx , GLdouble objy , GLdouble objz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * winx , GLdouble * winy , GLdouble * winz ) ;
+ * </pre>
+ */
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluProject (
+ JNIEnv *env, jobject obj,
+ jdouble objx,
+ jdouble objy,
+ jdouble objz,
+ jdoubleArray modelMatrix,
+ jdoubleArray projMatrix,
+ jintArray viewport,
+ jdoubleArray winx,
+ jdoubleArray winy,
+ jdoubleArray winz)
+ {
+ jint ret;
+
+ jdouble *ptr3 = NULL;
+ jdouble *ptr4 = NULL;
+ jint *ptr5 = NULL;
+ jboolean isCopiedArray6 = JNI_FALSE;
+ jdouble *ptr6 = NULL;
+ jboolean isCopiedArray7 = JNI_FALSE;
+ jdouble *ptr7 = NULL;
+ jboolean isCopiedArray8 = JNI_FALSE;
+ jdouble *ptr8 = NULL;
+
+ if(modelMatrix!=NULL)
+ {
+ ptr3 = (*env)->GetDoubleArrayElements(env, modelMatrix, 0);
+ }
+ if(projMatrix!=NULL)
+ {
+ ptr4 = (*env)->GetDoubleArrayElements(env, projMatrix, 0);
+ }
+ if(viewport!=NULL)
+ {
+ ptr5 = (*env)->GetIntArrayElements(env, viewport, 0);
+ }
+ if(winx!=NULL)
+ {
+ ptr6 = (*env)->GetDoubleArrayElements(env, winx, &isCopiedArray6);
+ }
+ if(winy!=NULL)
+ {
+ ptr7 = (*env)->GetDoubleArrayElements(env, winy, &isCopiedArray7);
+ }
+ if(winz!=NULL)
+ {
+ ptr8 = (*env)->GetDoubleArrayElements(env, winz, &isCopiedArray8);
+ }
+ ret = (jint) gluProject (
+ (GLdouble) objx,
+ (GLdouble) objy,
+ (GLdouble) objz,
+ (const GLdouble *) ptr3,
+ (const GLdouble *) ptr4,
+ (const GLint *) ptr5,
+ (GLdouble *) ptr6,
+ (GLdouble *) ptr7,
+ (GLdouble *) ptr8
+ );
+
+ if(modelMatrix!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, modelMatrix, ptr3, JNI_ABORT);
+ }
+ if(projMatrix!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, projMatrix, ptr4, JNI_ABORT);
+ }
+ if(viewport!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, viewport, ptr5, JNI_ABORT);
+ }
+ if(winx!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, winx, ptr6, (isCopiedArray6 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(winy!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, winy, ptr7, (isCopiedArray7 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(winz!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, winz, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ return ret;
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluUnProject ( GLdouble winx , GLdouble winy , GLdouble winz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * objx , GLdouble * objy , GLdouble * objz ) ;
+ * </pre>
+ */
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluUnProject (
+ JNIEnv *env, jobject obj,
+ jdouble winx,
+ jdouble winy,
+ jdouble winz,
+ jdoubleArray modelMatrix,
+ jdoubleArray projMatrix,
+ jintArray viewport,
+ jdoubleArray objx,
+ jdoubleArray objy,
+ jdoubleArray objz)
+ {
+ jint ret;
+
+ jdouble *ptr3 = NULL;
+ jdouble *ptr4 = NULL;
+ jint *ptr5 = NULL;
+ jboolean isCopiedArray6 = JNI_FALSE;
+ jdouble *ptr6 = NULL;
+ jboolean isCopiedArray7 = JNI_FALSE;
+ jdouble *ptr7 = NULL;
+ jboolean isCopiedArray8 = JNI_FALSE;
+ jdouble *ptr8 = NULL;
+
+ if(modelMatrix!=NULL)
+ {
+ ptr3 = (*env)->GetDoubleArrayElements(env, modelMatrix, 0);
+ }
+ if(projMatrix!=NULL)
+ {
+ ptr4 = (*env)->GetDoubleArrayElements(env, projMatrix, 0);
+ }
+ if(viewport!=NULL)
+ {
+ ptr5 = (*env)->GetIntArrayElements(env, viewport, 0);
+ }
+ if(objx!=NULL)
+ {
+ ptr6 = (*env)->GetDoubleArrayElements(env, objx, &isCopiedArray6);
+ }
+ if(objy!=NULL)
+ {
+ ptr7 = (*env)->GetDoubleArrayElements(env, objy, &isCopiedArray7);
+ }
+ if(objz!=NULL)
+ {
+ ptr8 = (*env)->GetDoubleArrayElements(env, objz, &isCopiedArray8);
+ }
+ ret = (jint) gluUnProject (
+ (GLdouble) winx,
+ (GLdouble) winy,
+ (GLdouble) winz,
+ (const GLdouble *) ptr3,
+ (const GLdouble *) ptr4,
+ (const GLint *) ptr5,
+ (GLdouble *) ptr6,
+ (GLdouble *) ptr7,
+ (GLdouble *) ptr8
+ );
+
+ if(modelMatrix!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, modelMatrix, ptr3, JNI_ABORT);
+ }
+ if(projMatrix!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, projMatrix, ptr4, JNI_ABORT);
+ }
+ if(viewport!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, viewport, ptr5, JNI_ABORT);
+ }
+ if(objx!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, objx, ptr6, (isCopiedArray6 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(objy!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, objy, ptr7, (isCopiedArray7 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(objz!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, objz, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ return ret;
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluScaleImage ( GLenum format , GLsizei widthin , GLsizei heightin , GLenum typein , const char * datain , GLsizei widthout , GLsizei heightout , GLenum typeout , char * dataout ) ;
+ * </pre>
+ */
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluScaleImage (
+ JNIEnv *env, jobject obj,
+ jint format,
+ jint widthin,
+ jint heightin,
+ jint typein,
+ jbyteArray datain,
+ jint widthout,
+ jint heightout,
+ jint typeout,
+ jbyteArray dataout)
+ {
+ jint ret;
+
+ jbyte *ptr4 = NULL;
+ jboolean isCopiedArray8 = JNI_FALSE;
+ jbyte *ptr8 = NULL;
+
+ if(datain!=NULL)
+ {
+ ptr4 = (*env)->GetByteArrayElements(env, datain, 0);
+ }
+ if(dataout!=NULL)
+ {
+ ptr8 = (*env)->GetByteArrayElements(env, dataout, &isCopiedArray8);
+ }
+ ret = (jint) gluScaleImage (
+ (GLenum) format,
+ (GLsizei) widthin,
+ (GLsizei) heightin,
+ (GLenum) typein,
+ (const char *) ptr4,
+ (GLsizei) widthout,
+ (GLsizei) heightout,
+ (GLenum) typeout,
+ (char *) ptr8
+ );
+
+ if(datain!=NULL)
+ {
+ (*env)->ReleaseByteArrayElements(env, datain, ptr4, JNI_ABORT);
+ }
+ if(dataout!=NULL)
+ {
+ (*env)->ReleaseByteArrayElements(env, dataout, ptr8, (isCopiedArray8 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ return ret;
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluBuild1DMipmaps ( GLenum target , GLint components , GLint width , GLenum format , GLenum type , const void * data ) ;
+ * </pre>
+ */
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3B (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jbyteArray data)
+ {
+ jint ret;
+
+ jbyte *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetByteArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseByteArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3S (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jshortArray data)
+ {
+ jint ret;
+
+ jshort *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetShortArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseShortArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3I (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jintArray data)
+ {
+ jint ret;
+
+ jint *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetIntArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3F (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jfloatArray data)
+ {
+ jint ret;
+
+ jfloat *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetFloatArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3D (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jdoubleArray data)
+ {
+ jint ret;
+
+ jdouble *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetDoubleArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3Z (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jbooleanArray data)
+ {
+ jint ret;
+
+ jboolean *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetBooleanArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseBooleanArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild1DMipmaps__IIIII_3J (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint format,
+ jint type,
+ jlongArray data)
+ {
+ jint ret;
+
+ jlong *ptr5 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr5 = (*env)->GetLongArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild1DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr5
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseLongArrayElements(env, data, ptr5, JNI_ABORT);
+ }
+ return ret;
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluBuild2DMipmaps ( GLenum target , GLint components , GLint width , GLint height , GLenum format , GLenum type , const void * data ) ;
+ * </pre>
+ */
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3B (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jbyteArray data)
+ {
+ jint ret;
+
+ jbyte *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetByteArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseByteArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3S (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jshortArray data)
+ {
+ jint ret;
+
+ jshort *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetShortArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseShortArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3I (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jintArray data)
+ {
+ jint ret;
+
+ jint *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetIntArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3F (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jfloatArray data)
+ {
+ jint ret;
+
+ jfloat *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetFloatArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3D (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jdoubleArray data)
+ {
+ jint ret;
+
+ jdouble *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetDoubleArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3Z (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jbooleanArray data)
+ {
+ jint ret;
+
+ jboolean *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetBooleanArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseBooleanArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ return ret;
+ }
+ JNIEXPORT jint JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBuild2DMipmaps__IIIIII_3J (
+ JNIEnv *env, jobject obj,
+ jint target,
+ jint components,
+ jint width,
+ jint height,
+ jint format,
+ jint type,
+ jlongArray data)
+ {
+ jint ret;
+
+ jlong *ptr6 = NULL;
+
+ if(data!=NULL)
+ {
+ ptr6 = (*env)->GetLongArrayElements(env, data, 0);
+ }
+ ret = (jint) gluBuild2DMipmaps (
+ (GLenum) target,
+ (GLint) components,
+ (GLint) width,
+ (GLint) height,
+ (GLenum) format,
+ (GLenum) type,
+ (const void *) ptr6
+ );
+
+ if(data!=NULL)
+ {
+ (*env)->ReleaseLongArrayElements(env, data, ptr6, JNI_ABORT);
+ }
+ 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,
+ jlong quadObject,
+ jint drawStyle)
+ {
+
+ gluQuadricDrawStyle (
+ (GLUquadricObj *) (PointerHolder) quadObject,
+ (GLenum) drawStyle
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricOrientation ( GLUquadricObj * quadObject , GLenum orientation ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluQuadricOrientation (
+ JNIEnv *env, jobject obj,
+ jlong quadObject,
+ jint orientation)
+ {
+
+ gluQuadricOrientation (
+ (GLUquadricObj *) (PointerHolder) quadObject,
+ (GLenum) orientation
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricNormals ( GLUquadricObj * quadObject , GLenum normals ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluQuadricNormals (
+ JNIEnv *env, jobject obj,
+ jlong quadObject,
+ jint normals)
+ {
+
+ gluQuadricNormals (
+ (GLUquadricObj *) (PointerHolder) quadObject,
+ (GLenum) normals
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricTexture ( GLUquadricObj * quadObject , GLboolean textureCoords ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluQuadricTexture (
+ JNIEnv *env, jobject obj,
+ jlong quadObject,
+ jboolean textureCoords)
+ {
+
+ gluQuadricTexture (
+ (GLUquadricObj *) (PointerHolder) quadObject,
+ (GLboolean) textureCoords
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluCylinder ( GLUquadricObj * qobj , GLdouble baseRadius , GLdouble topRadius , GLdouble height , GLint slices , GLint stacks ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluCylinder (
+ JNIEnv *env, jobject obj,
+ jlong qobj,
+ jdouble baseRadius,
+ jdouble topRadius,
+ jdouble height,
+ jint slices,
+ jint stacks)
+ {
+
+ gluCylinder (
+ (GLUquadricObj *) (PointerHolder) qobj,
+ (GLdouble) baseRadius,
+ (GLdouble) topRadius,
+ (GLdouble) height,
+ (GLint) slices,
+ (GLint) stacks
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluSphere ( GLUquadricObj * qobj , GLdouble radius , GLint slices , GLint stacks ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluSphere (
+ JNIEnv *env, jobject obj,
+ jlong qobj,
+ jdouble radius,
+ jint slices,
+ jint stacks)
+ {
+
+ gluSphere (
+ (GLUquadricObj *) (PointerHolder) qobj,
+ (GLdouble) radius,
+ (GLint) slices,
+ (GLint) stacks
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluDisk (
+ JNIEnv *env, jobject obj,
+ jlong qobj,
+ jdouble innerRadius,
+ jdouble outerRadius,
+ jint slices,
+ jint loops)
+ {
+
+ gluDisk (
+ (GLUquadricObj *) (PointerHolder) qobj,
+ (GLdouble) innerRadius,
+ (GLdouble) outerRadius,
+ (GLint) slices,
+ (GLint) loops
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPartialDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops , GLdouble startAngle , GLdouble sweepAngle ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluPartialDisk (
+ JNIEnv *env, jobject obj,
+ jlong qobj,
+ jdouble innerRadius,
+ jdouble outerRadius,
+ jint slices,
+ jint loops,
+ jdouble startAngle,
+ jdouble sweepAngle)
+ {
+
+ gluPartialDisk (
+ (GLUquadricObj *) (PointerHolder) qobj,
+ (GLdouble) innerRadius,
+ (GLdouble) outerRadius,
+ (GLint) slices,
+ (GLint) loops,
+ (GLdouble) startAngle,
+ (GLdouble) sweepAngle
+ );
+
+ }
+
+/**
+ * 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,
+ jlong nobj,
+ jfloatArray modelMatrix,
+ jfloatArray projMatrix,
+ jintArray viewport)
+ {
+ jfloat *ptr1 = NULL;
+ jfloat *ptr2 = NULL;
+ jint *ptr3 = NULL;
+
+ if(modelMatrix!=NULL)
+ {
+ ptr1 = (*env)->GetFloatArrayElements(env, modelMatrix, 0);
+ }
+ if(projMatrix!=NULL)
+ {
+ ptr2 = (*env)->GetFloatArrayElements(env, projMatrix, 0);
+ }
+ if(viewport!=NULL)
+ {
+ ptr3 = (*env)->GetIntArrayElements(env, viewport, 0);
+ }
+ gluLoadSamplingMatrices (
+ (GLUnurbsObj *) (PointerHolder) nobj,
+ (const GLfloat *) ptr1,
+ (const GLfloat *) ptr2,
+ (const GLint *) ptr3
+ );
+
+ if(modelMatrix!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, modelMatrix, ptr1, JNI_ABORT);
+ }
+ if(projMatrix!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, projMatrix, ptr2, JNI_ABORT);
+ }
+ if(viewport!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, viewport, ptr3, JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat value ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluNurbsProperty (
+ JNIEnv *env, jobject obj,
+ jlong nobj,
+ jint property,
+ jfloat value)
+ {
+
+ gluNurbsProperty (
+ (GLUnurbsObj *) (PointerHolder) nobj,
+ (GLenum) property,
+ (GLfloat) value
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluGetNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat * value ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluGetNurbsProperty (
+ JNIEnv *env, jobject obj,
+ jlong nobj,
+ jint property,
+ jfloatArray value)
+ {
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jfloat *ptr2 = NULL;
+
+ if(value!=NULL)
+ {
+ ptr2 = (*env)->GetFloatArrayElements(env, value, &isCopiedArray2);
+ }
+ gluGetNurbsProperty (
+ (GLUnurbsObj *) (PointerHolder) nobj,
+ (GLenum) property,
+ (GLfloat *) ptr2
+ );
+
+ if(value!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, value, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginCurve ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBeginCurve (
+ JNIEnv *env, jobject obj,
+ jlong nobj)
+ {
+
+ gluBeginCurve (
+ (GLUnurbsObj *) (PointerHolder) nobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndCurve ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluEndCurve (
+ JNIEnv *env, jobject obj,
+ jlong nobj)
+ {
+
+ gluEndCurve (
+ (GLUnurbsObj *) (PointerHolder) nobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNurbsCurve ( GLUnurbsObj * nobj , GLint nknots , GLfloat * knot , GLint stride , GLfloat * ctlarray , GLint order , GLenum type ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluNurbsCurve (
+ JNIEnv *env, jobject obj,
+ jlong nobj,
+ jint nknots,
+ jfloatArray knot,
+ jint stride,
+ jfloatArray ctlarray,
+ jint order,
+ jint type)
+ {
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jfloat *ptr2 = NULL;
+ jboolean isCopiedArray4 = JNI_FALSE;
+ jfloat *ptr4 = NULL;
+
+ if(knot!=NULL)
+ {
+ ptr2 = (*env)->GetFloatArrayElements(env, knot, &isCopiedArray2);
+ }
+ if(ctlarray!=NULL)
+ {
+ ptr4 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray4);
+ }
+ gluNurbsCurve (
+ (GLUnurbsObj *) (PointerHolder) nobj,
+ (GLint) nknots,
+ (GLfloat *) ptr2,
+ (GLint) stride,
+ (GLfloat *) ptr4,
+ (GLint) order,
+ (GLenum) type
+ );
+
+ if(knot!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, knot, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(ctlarray!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, ctlarray, ptr4, (isCopiedArray4 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginSurface ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBeginSurface (
+ JNIEnv *env, jobject obj,
+ jlong nobj)
+ {
+
+ gluBeginSurface (
+ (GLUnurbsObj *) (PointerHolder) nobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndSurface ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluEndSurface (
+ JNIEnv *env, jobject obj,
+ jlong nobj)
+ {
+
+ gluEndSurface (
+ (GLUnurbsObj *) (PointerHolder) nobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNurbsSurface ( GLUnurbsObj * nobj , GLint sknot_count , GLfloat * sknot , GLint tknot_count , GLfloat * tknot , GLint s_stride , GLint t_stride , GLfloat * ctlarray , GLint sorder , GLint torder , GLenum type ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluNurbsSurface (
+ JNIEnv *env, jobject obj,
+ jlong nobj,
+ jint sknot_count,
+ jfloatArray sknot,
+ jint tknot_count,
+ jfloatArray tknot,
+ jint s_stride,
+ jint t_stride,
+ jfloatArray ctlarray,
+ jint sorder,
+ jint torder,
+ jint type)
+ {
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jfloat *ptr2 = NULL;
+ jboolean isCopiedArray4 = JNI_FALSE;
+ jfloat *ptr4 = NULL;
+ jboolean isCopiedArray7 = JNI_FALSE;
+ jfloat *ptr7 = NULL;
+
+ if(sknot!=NULL)
+ {
+ ptr2 = (*env)->GetFloatArrayElements(env, sknot, &isCopiedArray2);
+ }
+ if(tknot!=NULL)
+ {
+ ptr4 = (*env)->GetFloatArrayElements(env, tknot, &isCopiedArray4);
+ }
+ if(ctlarray!=NULL)
+ {
+ ptr7 = (*env)->GetFloatArrayElements(env, ctlarray, &isCopiedArray7);
+ }
+ gluNurbsSurface (
+ (GLUnurbsObj *) (PointerHolder) nobj,
+ (GLint) sknot_count,
+ (GLfloat *) ptr2,
+ (GLint) tknot_count,
+ (GLfloat *) ptr4,
+ (GLint) s_stride,
+ (GLint) t_stride,
+ (GLfloat *) ptr7,
+ (GLint) sorder,
+ (GLint) torder,
+ (GLenum) type
+ );
+
+ if(sknot!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, sknot, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(tknot!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, tknot, ptr4, (isCopiedArray4 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(ctlarray!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, ctlarray, ptr7, (isCopiedArray7 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginTrim ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBeginTrim (
+ JNIEnv *env, jobject obj,
+ jlong nobj)
+ {
+
+ gluBeginTrim (
+ (GLUnurbsObj *) (PointerHolder) nobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndTrim ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluEndTrim (
+ JNIEnv *env, jobject obj,
+ jlong nobj)
+ {
+
+ gluEndTrim (
+ (GLUnurbsObj *) (PointerHolder) nobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPwlCurve ( GLUnurbsObj * nobj , GLint count , GLfloat * array , GLint stride , GLenum type ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluPwlCurve (
+ JNIEnv *env, jobject obj,
+ jlong nobj,
+ jint count,
+ jfloatArray array,
+ jint stride,
+ jint type)
+ {
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jfloat *ptr2 = NULL;
+
+ if(array!=NULL)
+ {
+ ptr2 = (*env)->GetFloatArrayElements(env, array, &isCopiedArray2);
+ }
+ gluPwlCurve (
+ (GLUnurbsObj *) (PointerHolder) nobj,
+ (GLint) count,
+ (GLfloat *) ptr2,
+ (GLint) stride,
+ (GLenum) type
+ );
+
+ if(array!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, array, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3B (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jbyteArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jbyte *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetByteArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseByteArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3S (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jshortArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jshort *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetShortArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseShortArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3I (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jintArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jint *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetIntArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3F (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jfloatArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jfloat *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetFloatArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3D (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3Z (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jbooleanArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jboolean *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetBooleanArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseBooleanArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginPolygon__J_3J (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jlongArray polygon_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jlong *ptr1 = NULL;
+
+ if(polygon_data!=NULL)
+ {
+ ptr1 = (*env)->GetLongArrayElements(env, polygon_data, &isCopiedArray1);
+ }
+ gluTessBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (void *) ptr1
+ );
+
+ if(polygon_data!=NULL)
+ {
+ (*env)->ReleaseLongArrayElements(env, polygon_data, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessBeginContour ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessBeginContour (
+ JNIEnv *env, jobject obj,
+ jlong tobj)
+ {
+
+ gluTessBeginContour (
+ (GLUtesselator *) (PointerHolder) tobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessVertex ( GLUtesselator * tobj , GLdouble coords [ 3 ] , void * vertex_data ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3B (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jbyteArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jbyte *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetByteArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseByteArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3S (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jshortArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jshort *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetShortArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseShortArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3I (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jintArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jint *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetIntArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseIntArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3F (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jfloatArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jfloat *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetFloatArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseFloatArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3D (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jdoubleArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jdouble *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetDoubleArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3Z (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jbooleanArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jboolean *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetBooleanArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseBooleanArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessVertex__J_3D_3J (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdoubleArray coords,
+ jlongArray vertex_data)
+ {
+ jboolean isCopiedArray1 = JNI_FALSE;
+ jdouble *ptr1 = NULL;
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jlong *ptr2 = NULL;
+
+ if(coords!=NULL)
+ {
+ ptr1 = (*env)->GetDoubleArrayElements(env, coords, &isCopiedArray1);
+ }
+ if(vertex_data!=NULL)
+ {
+ ptr2 = (*env)->GetLongArrayElements(env, vertex_data, &isCopiedArray2);
+ }
+ gluTessVertex (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble *) ptr1,
+ (void *) ptr2
+ );
+
+ if(coords!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, coords, ptr1, (isCopiedArray1 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ if(vertex_data!=NULL)
+ {
+ (*env)->ReleaseLongArrayElements(env, vertex_data, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessEndContour ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessEndContour (
+ JNIEnv *env, jobject obj,
+ jlong tobj)
+ {
+
+ gluTessEndContour (
+ (GLUtesselator *) (PointerHolder) tobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessEndPolygon ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessEndPolygon (
+ JNIEnv *env, jobject obj,
+ jlong tobj)
+ {
+
+ gluTessEndPolygon (
+ (GLUtesselator *) (PointerHolder) tobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble value ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessProperty (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jint which,
+ jdouble value)
+ {
+
+ gluTessProperty (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLenum) which,
+ (GLdouble) value
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessNormal ( GLUtesselator * tobj , GLdouble x , GLdouble y , GLdouble z ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluTessNormal (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jdouble x,
+ jdouble y,
+ jdouble z)
+ {
+
+ gluTessNormal (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLdouble) x,
+ (GLdouble) y,
+ (GLdouble) z
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluGetTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble * value ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluGetTessProperty (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jint which,
+ jdoubleArray value)
+ {
+ jboolean isCopiedArray2 = JNI_FALSE;
+ jdouble *ptr2 = NULL;
+
+ if(value!=NULL)
+ {
+ ptr2 = (*env)->GetDoubleArrayElements(env, value, &isCopiedArray2);
+ }
+ gluGetTessProperty (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLenum) which,
+ (GLdouble *) ptr2
+ );
+
+ if(value!=NULL)
+ {
+ (*env)->ReleaseDoubleArrayElements(env, value, ptr2, (isCopiedArray2 == JNI_TRUE)?0:JNI_ABORT);
+ }
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginPolygon ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluBeginPolygon (
+ JNIEnv *env, jobject obj,
+ jlong tobj)
+ {
+
+ gluBeginPolygon (
+ (GLUtesselator *) (PointerHolder) tobj
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNextContour ( GLUtesselator * tobj , GLenum type ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluNextContour (
+ JNIEnv *env, jobject obj,
+ jlong tobj,
+ jint type)
+ {
+
+ gluNextContour (
+ (GLUtesselator *) (PointerHolder) tobj,
+ (GLenum) type
+ );
+
+ }
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndPolygon ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ JNIEXPORT void JNICALL
+ Java_gl4java_GLUFuncJauJNInf_gluEndPolygon (
+ JNIEnv *env, jobject obj,
+ jlong tobj)
+ {
+
+ gluEndPolygon (
+ (GLUtesselator *) (PointerHolder) tobj
+ );
+
+ }
+
+/* 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 1fc3b2c..4c6fa7e 100644
--- a/CNativeCode/OpenGLU_JauJNItst_funcs.c
+++ b/CNativeCode/OpenGLU_JauJNItst_funcs.c
@@ -62,7 +62,7 @@ Java_gl4java_GLUFuncJauJNI_gluGetString ( JNIEnv *env, jobject obj,
}
static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _glu_lib_version_="2.4.1.0";
+static const char * _glu_lib_version_="2.5.2.0";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
diff --git a/CNativeCode/OpenGL_Win32.c b/CNativeCode/OpenGL_Win32.c
index 8f77752..df4ad2d 100755
--- a/CNativeCode/OpenGL_Win32.c
+++ b/CNativeCode/OpenGL_Win32.c
@@ -75,26 +75,26 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
jfieldID fpixmapHandle=0;
jfieldID foffScreenRenderer=0;
jfieldID faccumSize=0;
- jfieldID fwindowHandle=0, fpData=0, fdoubleBuffer=0, fstereoView=0, fstencilBits=0;
+ jfieldID fwindowHandle=0, fpData=0;
jfieldID fverbose=0;
jfieldID fglContext=0;
jfieldID fshareWith=0;
jfieldID fcreatewinw = 0, fcreatewinh = 0;
+ jfieldID fglCaps=0;
/* these variables will be mapped in the java-object ! */
jboolean joffScreenRenderer=JNI_FALSE;
- jboolean jdoubleBuffer=JNI_TRUE;
- jboolean jstereoView=JNI_FALSE;
- jint jstencilBits=0;
- jint jaccumSize=0;
HDC thisWin=0;
HGLRC gc=0;
+ PIXELFORMATDESCRIPTOR pfd;
HDC pData=0;
HGLRC shareWith=NULL;
jint jcreatewinw = 0, jcreatewinh = 0;
HBITMAP pix=0;
-
- PIXELFORMATDESCRIPTOR pfd;
+ GLCapabilities glCaps;
+ jobject jglCaps=0;
+ jthrowable exc;
+ jclass _GLCapabilities= 0;
(void) canvas;
@@ -103,7 +103,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
{
fprintf(stderr,"oo0.0 cls==0\n");
fflush(stderr);
- ret=JNI_FALSE;
+ return JNI_FALSE;
}
if(ret==JNI_TRUE)
@@ -113,7 +113,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
{
fprintf(stderr,"oo0.2 fverbose==0\n");
fflush(stderr);
- ret=JNI_FALSE;
+ return JNI_FALSE;
} else {
verbose = (*env)->GetStaticBooleanField(env, cls, fverbose);
}
@@ -133,8 +133,11 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
if(ret==JNI_TRUE) {
fpData = (*env)->GetFieldID(env, cls, "pData", "J");
- if (fpData == 0) ret= JNI_FALSE;
- else pData = (HDC)
+ if (fpData == 0) {
+ fprintf(stderr, "pData not accessible !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ } else pData = (HDC)
( (PointerHolder)(*env)->GetLongField(env, obj, fpData));
}
if(JNI_TRUE==verbose)
@@ -144,43 +147,80 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
if(ret==JNI_TRUE) {
fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
- if (fwindowHandle == 0) ret= JNI_FALSE;
+ if (fwindowHandle == 0) {
+ fprintf(stderr, "windowHandle not accessible !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ }
}
if(ret==JNI_TRUE) {
fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
- if (fglContext == 0) ret= JNI_FALSE;
+ if (fglContext == 0)
+ {
+ fprintf(stderr, "fglContext not accessible !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ }
}
if(ret==JNI_TRUE) {
foffScreenRenderer =
(*env)->GetFieldID(env, cls, "offScreenRenderer", "Z");
- if (foffScreenRenderer == 0) ret= JNI_FALSE;
+ if (foffScreenRenderer == 0)
+ {
+ fprintf(stderr, "foffScreenRenderer not accessible !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ }
else joffScreenRenderer =(*env)->GetBooleanField(env, obj, foffScreenRenderer);
}
if(ret==JNI_TRUE) {
- fdoubleBuffer = (*env)->GetFieldID(env, cls, "doubleBuffer", "Z");
- if (fdoubleBuffer == 0) ret= JNI_FALSE;
- else jdoubleBuffer =(*env)->GetBooleanField(env, obj, fdoubleBuffer);
- }
-
- if(ret==JNI_TRUE) {
- fstereoView = (*env)->GetFieldID(env, cls, "stereoView", "Z");
- if (fstereoView == 0) ret= JNI_FALSE;
- else jstereoView =(*env)->GetBooleanField(env, obj, fstereoView);
+ fglCaps = (*env)->GetFieldID(env, cls, "glCaps", "Lgl4java/GLCapabilities;");
+ if (fglCaps == 0)
+ {
+ fprintf(stderr, "fglCaps not accessible !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ }
+ else jglCaps =(*env)->GetObjectField(env, obj, fglCaps);
}
- if(ret==JNI_TRUE) {
- fstencilBits = (*env)->GetFieldID(env, cls, "stencilBits", "I");
- if (fstencilBits == 0) ret= JNI_FALSE;
- else jstencilBits =(*env)->GetIntField(env, obj, fstencilBits);
+ if( jglCaps==0 )
+ {
+ fprintf(stderr,"\nGL4Java openOpenGL ERROR: ZERO capsObj was fetched by GetObjectField !\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ _GLCapabilities= (*env)->FindClass(env, "Lgl4java/GLCapabilities;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: openOpen FindClass gl4java/GLCapabilities failed, cannot check glCaps object\n");
+ (*env)->ExceptionDescribe(env);
+ fflush(stderr);
+ }
+ (*env)->ExceptionClear(env);
+ _GLCapabilities=0;
+ }
+ exc=0;
+
+ if( _GLCapabilities!=0 &&
+ (*env)->IsInstanceOf(env, jglCaps, _GLCapabilities)==JNI_FALSE )
+ {
+ fprintf(stderr,"\nGL4Java openOpenGL ERROR: glCaps is not instanceof gl4java/GLCapabilities !\n");
+ fflush(stderr);
+ return JNI_FALSE;
}
- if(ret==JNI_TRUE) {
- faccumSize = (*env)->GetFieldID(env, cls, "accumSize", "I");
- if (faccumSize == 0) ret= JNI_FALSE;
- else jaccumSize =(*env)->GetIntField(env, obj, faccumSize);
+ if( JNI_TRUE != javaGLCapabilities2NativeGLCapabilities ( env, jglCaps, &glCaps ) )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: glCaps Object is not valid !\n");
+ fflush(stderr);
+ return JNI_FALSE;
}
if(ret==JNI_TRUE) {
@@ -209,7 +249,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
if(joffScreenRenderer==JNI_TRUE)
{
- jdoubleBuffer = JNI_FALSE;
+ glCaps.buffer=BUFFER_SINGLE;
}
if(JNI_TRUE==verbose && joffScreenRenderer==JNI_TRUE)
@@ -236,8 +276,10 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
thisWin = (HDC)pData;
/* get the graphics context for this widget */
- if( (gc = get_GC( &thisWin, jdoubleBuffer, jstereoView, jstencilBits, shareWith,
- joffScreenRenderer, jcreatewinw, jcreatewinh, &pix, verbose)) == 0 )
+ if( (gc = get_GC( &thisWin, &glCaps, shareWith,
+ joffScreenRenderer, jcreatewinw, jcreatewinh,
+ &pix, verbose)) == 0
+ )
{
printf( "getGC error" );
return JNI_FALSE;
@@ -246,24 +288,19 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
/* fetch the states of doubleBuffer and stereo */
(void) PixelFormatDescriptorFromDc( thisWin, &pfd);
- jdoubleBuffer = (pfd.dwFlags & PFD_DOUBLEBUFFER)?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && fdoubleBuffer!=0) {
- (*env)->SetBooleanField(env, obj, fdoubleBuffer,
- jdoubleBuffer);
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stdout,"\nGL4Java: writing capabilities to GLContext's java object\n");
+ fflush(stdout);
}
- jstencilBits = (jint)(pfd.cStencilBits);
- if(ret==JNI_TRUE && fstencilBits!=0) {
- (*env)->SetIntField(env, obj,
- fstencilBits, (jint)jstencilBits);
- }
-
- jaccumSize=(jint)(pfd.cAccumRedBits+pfd.cAccumGreenBits+pfd.cAccumBlueBits+pfd.cAccumAlphaBits);
- if(ret==JNI_TRUE && faccumSize!=0) {
- (*env)->SetIntField(env, obj,
- faccumSize, (jint)jaccumSize);
- }
+ if(jglCaps!=0)
+ (void) nativeGLCapabilities2JavaGLCapabilities (env, jglCaps, &glCaps);
+ if(ret==JNI_TRUE && fglCaps && jglCaps) {
+ (*env)->SetObjectField(env, obj, fglCaps, jglCaps);
+ }
+
if(ret==JNI_TRUE && fwindowHandle!=0) {
(*env)->SetLongField(env, obj, fwindowHandle,
(jlong)((PointerHolder)thisWin));
diff --git a/CNativeCode/OpenGL_Win32_common.c b/CNativeCode/OpenGL_Win32_common.c
index dcf5822..8368677 100755
--- a/CNativeCode/OpenGL_Win32_common.c
+++ b/CNativeCode/OpenGL_Win32_common.c
@@ -17,8 +17,8 @@
#include "OpenGL_Win32_common.h"
-HGLRC LIBAPIENTRY get_GC( HDC * hDC, jboolean doubleBuffer,
- jboolean stereo, jint stencilBits, HGLRC shareWith,
+HGLRC LIBAPIENTRY get_GC( HDC * hDC, GLCapabilities *glCaps,
+ HGLRC shareWith,
jboolean offScreenRenderer,
int width, int height, HBITMAP *pix,
jboolean verbose)
@@ -45,7 +45,7 @@ HGLRC LIBAPIENTRY get_GC( HDC * hDC, jboolean doubleBuffer,
/* setupPalette(hDC); USE MY PROC */
}
- SetDCPixelFormat(*hDC, doubleBuffer, stereo, stencilBits, offScreenRenderer, verbose);
+ SetDCPixelFormat(*hDC, glCaps, offScreenRenderer, verbose);
// Create palette if needed
hPalette = GetOpenGLPalette(*hDC);
@@ -89,64 +89,116 @@ HGLRC LIBAPIENTRY get_GC( HDC * hDC, jboolean doubleBuffer,
return tempRC;
}
-// Select the pixel format for a given device context
-void LIBAPIENTRY SetDCPixelFormat(HDC hDC, jboolean doubleBuffer,
- jboolean stereo, jint stencilBits, jboolean offScreenRenderer,
- jboolean verbose)
+void LIBAPIENTRY setPixelFormatByGLCapabilities(
+ PIXELFORMATDESCRIPTOR *pfd,
+ GLCapabilities *glCaps,
+ jboolean offScreenRenderer,
+ HDC hdc)
{
- int nPixelFormat=0;
- const char * text=0;
- 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
+ int colorBits = glCaps->redBits + glCaps->greenBits + glCaps->blueBits;
+
+ pfd->nSize=sizeof(PIXELFORMATDESCRIPTOR);
+ pfd->nVersion=1;
+ pfd->dwFlags=PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED; /* refined later */
+ pfd->iPixelType=0;
+ pfd->cColorBits=0;
+ pfd->cRedBits=0;
+ pfd->cRedShift=0;
+ pfd->cGreenBits=0;
+ pfd->cGreenShift=0;
+ pfd->cBlueBits=0;
+ pfd->cBlueShift=0;
+ pfd->cAlphaBits=0;
+ pfd->cAlphaShift=0;
+ pfd->cAccumBits=0;
+ pfd->cAccumRedBits=0;
+ pfd->cAccumGreenBits=0;
+ pfd->cAccumBlueBits=0;
+ pfd->cAccumAlphaBits=0;
+ pfd->cDepthBits=32;
+ pfd->cStencilBits=0;
+ pfd->cAuxBuffers=0;
+ pfd->iLayerType=PFD_MAIN_PLANE;
+ pfd->bReserved=0;
+ pfd->dwLayerMask=0;
+ pfd->dwVisibleMask=0;
+ pfd->dwDamageMask=0;
+
+ if(COLOR_RGBA == glCaps->color)
+ pfd->iPixelType=PFD_TYPE_RGBA;
+ else
+ pfd->iPixelType=PFD_TYPE_COLORINDEX;
- if(offScreenRenderer)
- dw_flags |= PFD_DRAW_TO_BITMAP; // Draw to Bitmap
+ if(offScreenRenderer)
+ pfd->dwFlags |= PFD_DRAW_TO_BITMAP; // Draw to Bitmap
else
- dw_flags |= PFD_DRAW_TO_WINDOW; // Draw to Window (not to bitmap)
+ pfd->dwFlags |= PFD_DRAW_TO_WINDOW; // Draw to Window (not to bitmap)
+
+
+ if(BUFFER_DOUBLE==glCaps->buffer)
+ pfd->dwFlags |= PFD_DOUBLEBUFFER ; // Double buffered is optional
+ if(STEREO_ON==glCaps->stereo)
+ pfd->dwFlags |= PFD_STEREO ; // Stereo is optional
- if(doubleBuffer==JNI_TRUE)
- dw_flags |= PFD_DOUBLEBUFFER ; // Double buffered is optional
+ if(hdc!=NULL && GetDeviceCaps(hdc, BITSPIXEL)<colorBits)
+ pfd->cColorBits = GetDeviceCaps(hdc, BITSPIXEL);
+ else
+ pfd->cColorBits = (BYTE)colorBits;
- if(stereo==JNI_TRUE)
- dw_flags |= PFD_STEREO ; // Stereo is optional
+ pfd->cStencilBits = (BYTE) glCaps->stencilBits;
+}
- pfd.dwFlags = dw_flags;
- pfd.cColorBits = GetDeviceCaps(hDC, BITSPIXEL);
+void LIBAPIENTRY SetDCPixelFormat(HDC hDC, GLCapabilities *glCaps,
+ jboolean offScreenRenderer, jboolean verbose)
+{
+ int nPixelFormat=-1;
+ const char * text=0;
- if(stencilBits>0)
- pfd.cStencilBits = (BYTE) stencilBits;
+ PIXELFORMATDESCRIPTOR pfd ;
- if(verbose==JNI_TRUE)
- {
+ if(verbose==JNI_TRUE)
+ {
+ fprintf(stdout, "GL4Java SetDCPixelFormat: input capabilities:\n");
+ printGLCapabilities ( glCaps );
+ }
+
+ if(glCaps->nativeVisualID>=0)
+ {
+ if ( 0 < DescribePixelFormat( hDC, (int)(glCaps->nativeVisualID),
+ sizeof(pfd), &pfd ) )
+ {
+ nPixelFormat=(int)(glCaps->nativeVisualID);
+ if(verbose==JNI_TRUE)
+ {
+ fprintf(stderr,"\n\nUSER found stored PIXELFORMAT number: %ld\n",
+ nPixelFormat);
+ fflush(stderr);
+ }
+ } else {
+ fprintf(stderr,"\n\nUSER no stored PIXELFORMAT number found !!\n");
+ nPixelFormat = -1;
+ fflush(stderr);
+ }
+ }
+
+ if(nPixelFormat<0)
+ setPixelFormatByGLCapabilities( &pfd, glCaps, offScreenRenderer, hDC);
+
+ if(verbose==JNI_TRUE)
+ {
fprintf(stderr,"\n\nUSER CHOOSED PIXELFORMAT (TRYING):\n");
- text=GetTextualPixelFormatByPFD(&pfd, 0);
+ text=GetTextualPixelFormatByPFD(&pfd, nPixelFormat);
fprintf(stderr,text);
- }
+ fflush(stderr);
+ }
// Choose a pixel format that best matches that described in pfd
if( hDC == 0 )
printf( "SetDCPixelFormat: Error, no HDC-Contex is given\n");
- else
+ else if(nPixelFormat<0)
nPixelFormat = ChoosePixelFormat(hDC, &pfd);
if( nPixelFormat == 0 )
@@ -155,6 +207,16 @@ void LIBAPIENTRY SetDCPixelFormat(HDC hDC, jboolean doubleBuffer,
// Set the pixel format for the device context
if( SetPixelFormat(hDC, nPixelFormat, &pfd) == FALSE)
printf( "setpixel failed\n" );
+ else {
+ (void) setGLCapabilities ( hDC, nPixelFormat, glCaps );
+ if(verbose==JNI_TRUE)
+ {
+ fprintf(stdout, "GL4Java SetDCPixelFormat: used capabilities:\n");
+ printGLCapabilities ( glCaps );
+ }
+ }
+ fflush(stdout);
+ fflush(stderr);
}
@@ -267,6 +329,7 @@ jboolean LIBAPIENTRY testWin32Java()
}
+
static void
PrintMessage( const char *Format, ... )
{
@@ -335,8 +398,8 @@ GetTextualPixelFormatByPFD(PIXELFORMATDESCRIPTOR *ppfd, int format)
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," cAlphaBits - %d (N.A.)\n", ppfd->cAlphaBits);
+ strcat(buffer, line); sprintf(line," cAlphaShift - 0x%x (N.A.)\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);
@@ -658,3 +721,44 @@ HPALETTE LIBAPIENTRY setupPalette(HDC hDC)
}
+jboolean LIBAPIENTRY setGLCapabilities ( HDC hdc,
+ int nPixelFormat,
+ GLCapabilities *glCaps )
+{
+ PIXELFORMATDESCRIPTOR pfd;
+
+ (void) PixelFormatDescriptorFromDc( hdc, &pfd);
+
+ if (pfd.dwFlags & PFD_DOUBLEBUFFER)
+ glCaps->buffer=BUFFER_DOUBLE;
+ else
+ glCaps->buffer=BUFFER_SINGLE;
+
+ if (pfd.dwFlags & PFD_STEREO)
+ glCaps->stereo=STEREO_ON;
+ else
+ glCaps->stereo=STEREO_OFF;
+
+ if (pfd.iPixelType == PFD_TYPE_RGBA)
+ glCaps->color=COLOR_RGBA;
+
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
+ glCaps->color=COLOR_INDEX;
+
+ glCaps->depthBits = pfd.cDepthBits;
+ glCaps->stencilBits = pfd.cStencilBits;
+
+ glCaps->redBits = pfd.cRedBits;
+ glCaps->greenBits= pfd.cGreenBits;
+ glCaps->blueBits= pfd.cBlueBits;
+ /* glCaps->alphaBits= pfd.cAlphaBits; N.A. */
+ glCaps->accumRedBits = pfd.cAccumRedBits;
+ glCaps->accumGreenBits= pfd.cAccumGreenBits;
+ glCaps->accumBlueBits= pfd.cAccumBlueBits;
+ glCaps->accumAlphaBits= pfd.cAccumAlphaBits;
+
+ glCaps->nativeVisualID=nPixelFormat;
+
+ return JNI_TRUE;
+}
+
diff --git a/CNativeCode/OpenGL_Win32_common.h b/CNativeCode/OpenGL_Win32_common.h
index ed7287f..9e99aed 100755
--- a/CNativeCode/OpenGL_Win32_common.h
+++ b/CNativeCode/OpenGL_Win32_common.h
@@ -6,16 +6,20 @@
#include <wingdi.h>
+LIBAPI void LIBAPIENTRY setPixelFormatByGLCapabilities(
+ PIXELFORMATDESCRIPTOR *pfd,
+ GLCapabilities *glCaps,
+ jboolean offScreenRenderer,
+ HDC hdc);
+
// Set Pixel Format function - forward declaration
-LIBAPI void LIBAPIENTRY SetDCPixelFormat(HDC hDC, jboolean doubleBuffer,
- jboolean stereo, jint stencilBits, jboolean offScreenRenderer,
- jboolean verbose);
+LIBAPI void LIBAPIENTRY SetDCPixelFormat(HDC hDC, GLCapabilities *glCaps,
+ jboolean offScreenRenderer, jboolean verbose);
LIBAPI HPALETTE LIBAPIENTRY GetOpenGLPalette(HDC hDC);
-LIBAPI HGLRC LIBAPIENTRY get_GC( HDC *hDC, jboolean doubleBuffer,
- jboolean stereo, jint stencilBits, HGLRC shareWith,
- jboolean offScreenRenderer,
+LIBAPI HGLRC LIBAPIENTRY get_GC( HDC *hDC, GLCapabilities *glCaps,
+ HGLRC shareWith, jboolean offScreenRenderer,
int width, int height, HBITMAP *pix,
jboolean verbose);
@@ -41,4 +45,6 @@ LIBAPI void LIBAPIENTRY resizeDIB(HDC hDC, HBITMAP *hOldBitmap,
LIBAPI HPALETTE LIBAPIENTRY setupPalette(HDC hDC);
+LIBAPI jboolean LIBAPIENTRY setGLCapabilities ( HDC hdc, int nPixelFormat,
+ GLCapabilities *glCaps );
#endif
diff --git a/CNativeCode/OpenGL_Win32_jawt.c b/CNativeCode/OpenGL_Win32_jawt.c
index 4eeeb8e..d025603 100755
--- a/CNativeCode/OpenGL_Win32_jawt.c
+++ b/CNativeCode/OpenGL_Win32_jawt.c
@@ -1,676 +1,726 @@
-/*
- * Original Author: Leo Chan -- 1995
- *
- * Adam King 1997
- * Ported to Win32 from X
- *
- * This file takes care of the C implementation of finding the correct
- * Win32 window, assigning an OpenGL graphics context to it, storing that
- * graphics context in the java class data structure.
- *
- * also contains the use() and swap() functions for double buffering
- *
- * September 12, 1997 - Adam King
- * - Added support for rendering directly into a Canvas ( BIG rewrite )
- */
-
-/**
- * Pointer Semantics of GLContext:
- * ==============================
-
- "displayHandle" := not used
-
- "pData" := (JAWTDataHolder *)
- "windowHandle" := "pData"
-
- This holds the current state of the JAWT context !
-
- This is used as the "not initialized" flag also !
- It is reset to zero while Destroy Method
-
- "pData"->dsi_win := (HDC)
- if("offScreenRenderer" == TRUE)
- "pData"->dsi_win contains the window handle,
- of the last lock !
- "pData"->dsi_win_created=0 !
-
- "pixmapHandle" := (HBITMAP)
- if("offScreenRenderer" == TRUE)
- "pixmapHandle" contains the new BITMAP (by CreateDIBSection)!
- "windowHandle" contains the new created OffScreenWindow
- (by CreateCompatibleDC)!
- else
- "pixmapHandle" is unused !
-
- "sharedGLContextNative" := (HGLRC)
- This is the optional shared GLContext !
-
- "glContext" := (HGLRC)
- This is THE used GLContext !
- */
-
-#include "OpenGL_Win32_common.h"
-
-#include "jawt_misc.h"
-
-/*
- * Macros ..
- */
-
-#define GET_W32_JAWT_DSI(a) \
- ( (JAWT_Win32DrawingSurfaceInfo *) \
- ( ( (JAWTDataHolder *)((PointerHolder)(a)) ) ->dsi_os ) \
- )
-
-#define GET_USED_WINDOW(a) \
- ( (HDC) \
- ( ( (JAWTDataHolder *)((PointerHolder)(a)) ) ->dsi_win ) \
- )
-
-static jboolean verbose = JNI_FALSE;
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_useJAWT( JNIEnv *env, jobject obj )
-{
- (void)env;
- (void)obj;
- return JNI_TRUE;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_hasJAWTSurfaceChanged( JNIEnv *env, jobject obj,
- jlong thisWin )
-{
- JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
- (void)env;
- (void)obj;
-
- if(pData!=0)
- return (pData->lock & JAWT_LOCK_SURFACE_CHANGED) != 0 ;
-
- return JNI_FALSE;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
- jobject canvas)
-{
- jboolean ret = JNI_TRUE;
-
- jclass cls = 0;
- jfieldID fpixmapHandle=0;
- jfieldID foffScreenRenderer=0;
- jfieldID faccumSize=0;
- jfieldID fwindowHandle=0, fpData=0, fdoubleBuffer=0, fstereoView=0, fstencilBits=0;
- jfieldID fverbose=0;
- jfieldID fglContext=0;
- jfieldID fshareWith=0;
- jfieldID fcreatewinw = 0, fcreatewinh = 0;
-
- /* these variables will be mapped in the java-object ! */
- jboolean joffScreenRenderer=JNI_FALSE;
- jboolean jdoubleBuffer=JNI_TRUE;
- jboolean jstereoView=JNI_FALSE;
- jint jstencilBits=0;
- jint jaccumSize=0;
- HDC theWindow=0;
- HGLRC gc=0;
- JAWTDataHolder * pData=0;
- HGLRC shareWith=NULL;
- jint jcreatewinw = 0, jcreatewinh = 0;
- HBITMAP pix=0;
-
- PIXELFORMATDESCRIPTOR pfd;
-
- cls = (*env)->GetObjectClass(env, obj);
- if(cls==0)
- {
- fprintf(stderr,"oo0.0 cls==0\n");
- fflush(stderr);
- ret=JNI_FALSE;
- }
-
- if(ret==JNI_TRUE)
- {
- fverbose =(*env)->GetStaticFieldID(env, cls, "gljNativeDebug", "Z");
- if (fverbose == 0)
- {
- fprintf(stderr,"oo0.2 fverbose==0\n");
- fflush(stderr);
- ret=JNI_FALSE;
- } else {
- verbose = (*env)->GetStaticBooleanField(env, cls, fverbose);
- }
- }
-
- if(JNI_TRUE==verbose)
- {
- 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 �jlong� */
- ret = testWin32Java();
-
- ret = testJavaGLTypes(verbose);
-
- if(ret==JNI_TRUE) {
- fpData = (*env)->GetFieldID(env, cls, "pData", "J");
- if (fpData == 0) ret= JNI_FALSE;
- else pData = (JAWTDataHolder *)
- ( (PointerHolder)(*env)->GetLongField(env, obj, fpData));
- }
- if(JNI_TRUE==verbose)
- {
- fprintf(stderr, "received pData : %d\n", (int)pData);
- }
-
- if(ret==JNI_TRUE) {
- fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
- if (fwindowHandle == 0) ret= JNI_FALSE;
- }
-
- if(ret==JNI_TRUE) {
- fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
- if (fglContext == 0) ret= JNI_FALSE;
- }
-
- if(ret==JNI_TRUE) {
- foffScreenRenderer =
- (*env)->GetFieldID(env, cls, "offScreenRenderer", "Z");
- if (foffScreenRenderer == 0) ret= JNI_FALSE;
- else joffScreenRenderer =(*env)->GetBooleanField(env, obj, foffScreenRenderer);
- }
-
- if(ret==JNI_TRUE) {
- fdoubleBuffer = (*env)->GetFieldID(env, cls, "doubleBuffer", "Z");
- if (fdoubleBuffer == 0) ret= JNI_FALSE;
- else jdoubleBuffer =(*env)->GetBooleanField(env, obj, fdoubleBuffer);
- }
-
- if(ret==JNI_TRUE) {
- fstereoView = (*env)->GetFieldID(env, cls, "stereoView", "Z");
- if (fstereoView == 0) ret= JNI_FALSE;
- else jstereoView =(*env)->GetBooleanField(env, obj, fstereoView);
- }
-
- if(ret==JNI_TRUE) {
- fstencilBits = (*env)->GetFieldID(env, cls, "stencilBits", "I");
- if (fstencilBits == 0) ret= JNI_FALSE;
- else jstencilBits =(*env)->GetIntField(env, obj, fstencilBits);
- }
-
- if(ret==JNI_TRUE) {
- faccumSize = (*env)->GetFieldID(env, cls, "accumSize", "I");
- if (faccumSize == 0) ret= JNI_FALSE;
- else jaccumSize =(*env)->GetIntField(env, obj, faccumSize);
- }
-
- if(ret==JNI_TRUE) {
- fcreatewinw = (*env)->GetFieldID(env, cls, "createwinw", "I");
- if (fcreatewinw == 0) ret= JNI_FALSE;
- else jcreatewinw =(*env)->GetIntField(env, obj, fcreatewinw);
- }
-
- if(ret==JNI_TRUE) {
- fcreatewinh = (*env)->GetFieldID(env, cls, "createwinh", "I");
- if (fcreatewinh == 0) ret= JNI_FALSE;
- else jcreatewinh =(*env)->GetIntField(env, obj, fcreatewinh);
- }
-
- if(ret==JNI_TRUE) {
- fshareWith = (*env)->GetFieldID(env, cls, "sharedGLContextNative", "J");
- if (fshareWith == 0) ret= JNI_FALSE;
- else shareWith = (HGLRC)
- ( (PointerHolder)(*env)->GetLongField(env, obj, fshareWith));
- }
-
- if(ret==JNI_TRUE) {
- fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J");
- if (fpixmapHandle == 0) ret= JNI_FALSE;
- }
-
- if(joffScreenRenderer==JNI_TRUE)
- {
- jdoubleBuffer = JNI_FALSE;
- }
-
- if(JNI_TRUE==verbose && joffScreenRenderer==JNI_TRUE)
- {
- fprintf(stderr,"\nGL4Java: (USING OFFSCREEN GLPIXMAP BUFFER,\n\t forced: !doubleBuffer)\n");
- fflush(stderr);
- }
-
- if(joffScreenRenderer==JNI_TRUE)
- {
- jawt_create_offscreen(env, &pData, verbose);
- }
- else {
- if(jawt_create_open(env, canvas, &pData, verbose)==JNI_FALSE ||
- pData->result==JNI_FALSE
- )
- {
- fprintf(stderr,"\nGL4Java ERROR: openOpen could not create&open JAWT reference!\n");
- fflush(stderr);
- jawt_free_close_unlock(env, &pData, JNI_FALSE);
- ret=JNI_FALSE;
- return ret;
- }
-
- if(jawt_lock(env, pData, JNI_TRUE, verbose)==JNI_FALSE ||
- pData->result==JNI_FALSE
- )
- {
- fprintf(stderr,"\nGL4Java ERROR: openOpen could not lock JAWT reference!\n");
- fflush(stderr);
- jawt_free_close_unlock(env, &pData, JNI_FALSE);
- ret=JNI_FALSE;
- return ret;
- }
- }
-
- if(pData->result==JNI_TRUE)
- {
- if(joffScreenRenderer==JNI_FALSE)
- {
- theWindow = GET_W32_JAWT_DSI(pData)->hdc;
- jcreatewinw = pData->dsi->bounds.width;
- jcreatewinh = pData->dsi->bounds.height;
- }
- }
-
- wglMakeCurrent(NULL, NULL);
-
- /**
- * with version jdk1.1.6 and later, we are able to use
- * the java-function straight to achieve the native window
- * handle ....
- *
- * this handle is saved to pData for the windows version !
- */
- if( theWindow == 0 && !joffScreenRenderer)
- {
- printf( "get_GC: Error, pData->hdc is zero\n");
- jawt_free_close_unlock(env, &pData, JNI_FALSE);
- return JNI_FALSE;
- }
-
- /* get the graphics context for this widget */
- if( (gc = get_GC( &theWindow, jdoubleBuffer, jstereoView, jstencilBits,
- shareWith, joffScreenRenderer, jcreatewinw,
- jcreatewinh, &pix, verbose)) == 0 )
- {
- printf( "getGC error" );
- return JNI_FALSE;
- }
-
- /* fetch the states of doubleBuffer and stereo */
- (void) PixelFormatDescriptorFromDc( theWindow, &pfd);
-
- jdoubleBuffer = (pfd.dwFlags & PFD_DOUBLEBUFFER)?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && fdoubleBuffer!=0) {
- (*env)->SetBooleanField(env, obj, fdoubleBuffer,
- jdoubleBuffer);
- }
-
- jstencilBits = (jint)(pfd.cStencilBits);
- if(ret==JNI_TRUE && fstencilBits!=0) {
- (*env)->SetIntField(env, obj,
- fstencilBits, (jint)jstencilBits);
- }
-
- jaccumSize=(jint)(pfd.cAccumRedBits+pfd.cAccumGreenBits+pfd.cAccumBlueBits+pfd.cAccumAlphaBits);
- if(ret==JNI_TRUE && faccumSize!=0) {
- (*env)->SetIntField(env, obj,
- faccumSize, (jint)jaccumSize);
- }
-
- jawt_close_unlock(env, pData, verbose);
-
- if(ret==JNI_TRUE && fwindowHandle!=0) {
- (*env)->SetLongField(env, obj, fwindowHandle,
- (jlong)((PointerHolder)pData));
- }
- if(ret==JNI_TRUE && fpData!=0) {
- (*env)->SetLongField(env, obj, fpData,
- (jlong)((PointerHolder)pData));
- }
-
- if(ret==JNI_TRUE && fpixmapHandle!=0) {
- (*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)->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);
- }
-
- /*
- gl4java_bind_ext(JNI_TRUE==verbose);
- */
-
- return ret;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj,
- jobject canvas,
- jlong disp,
- jlong thisWin,
- jlong glContext)
-{
- jboolean ret = JNI_TRUE;
- JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
-
- if( !thisWin )
- {
- return JNI_FALSE;
- }
-
- if( !glContext )
- {
- return JNI_FALSE;
- }
-
- if(jawt_open(env, canvas, pData, verbose)==JNI_FALSE ||
- pData->result==JNI_FALSE
- )
- {
- fprintf(stderr,"\nGL4Java ERROR: MakeCurrent could not open JAWT reference!\n");
- fflush(stderr);
- ret=JNI_FALSE;
- jawt_close_unlock(env, pData, JNI_FALSE);
- return ret;
- }
-
- if(jawt_lock(env, pData, JNI_FALSE, verbose)==JNI_FALSE ||
- pData->result==JNI_FALSE
- )
- {
- /* this can happen:
- if ( (pJData->lock & JAWT_LOCK_SURFACE_CHANGED) != 0 )
-
- In this case, we need a new GLXContext ...
-
- This has to be queried by the java class,
- while using the native method hasJAWTSurfaceChanged !
- */
- if(verbose)
- {
- fprintf(stderr,"\nGL4Java ERROR: MakeCurrent could not lock JAWT reference!\n");
- fflush(stderr);
- }
- ret=JNI_FALSE;
- jawt_close_unlock(env, pData, JNI_FALSE);
- return ret;
- }
-
- if ( ret==JNI_TRUE && !wglMakeCurrent(GET_USED_WINDOW(thisWin),
- (HGLRC)((PointerHolder)glContext)) )
- {
- jawt_close_unlock(env, pData, JNI_FALSE);
- return JNI_FALSE;
- }
- return JNI_TRUE;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj,
- jobject canvas,
- jlong disp,
- jlong thisWin,
- jlong glContext
- )
-{
- JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
- jboolean ret = JNI_TRUE;
-
- (void)glContext;
- (void)disp;
- (void)canvas;
-
- if ( ! wglMakeCurrent( NULL, NULL ) )
- {
- fprintf(stderr, "gljFree failed\n");
- fflush(stderr);
- ret = JNI_FALSE;
- }
-
- if(pData!=NULL)
- jawt_close_unlock(env, pData, verbose);
-
- return ret;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj,
- jobject canvas)
-{
- jboolean ret = JNI_TRUE;
-
- jclass cls = 0;
- jfieldID fpData=0;
- jfieldID fwindowHandle=0, fpixmapHandle=0;
- jfieldID fglContext=0;
- jfieldID foffScreenRenderer=0;
- jfieldID fownwind=0;
-
- jboolean jownwind = JNI_FALSE ;
- jboolean joffScreenRenderer=JNI_FALSE;
- HBITMAP pix=0;
- HDC thisWin=0;
- HGLRC gc=0;
- JAWTDataHolder * pData = NULL;
-
- (void)canvas;
-
- cls = (*env)->GetObjectClass(env, obj);
- if(cls==0)
- {
- ret=JNI_FALSE;
- }
-
- if(ret==JNI_TRUE) {
- fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
- if (fwindowHandle == 0) ret= JNI_FALSE;
- }
-
- if(ret==JNI_TRUE) {
- fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
- if (fglContext == 0) ret= JNI_FALSE;
- else gc =(HGLRC)
- ((PointerHolder)(*env)->GetLongField(env, obj, fglContext));
- }
-
-
- if(ret==JNI_TRUE) {
- fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J");
- if (fpixmapHandle == 0) ret= JNI_FALSE;
- else pix =(HBITMAP)
- ((PointerHolder)(*env)->GetLongField(env, obj, fpixmapHandle));
- }
-
- if(ret==JNI_TRUE) {
- foffScreenRenderer =
- (*env)->GetFieldID(env, cls, "offScreenRenderer", "Z");
- if (foffScreenRenderer == 0) ret= JNI_FALSE;
- 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) {
- fpData = (*env)->GetFieldID(env, cls, "pData", "J");
- if (fpData == 0) ret= JNI_FALSE;
- else pData =(JAWTDataHolder *)
- ( (PointerHolder) (*env)->GetLongField(env, obj, fpData) );
- }
-
-
- if(jawt_open(env, canvas, pData, verbose)==JNI_FALSE ||
- pData->result==JNI_FALSE
- )
- {
- fprintf(stderr,"\nGL4Java ERROR: gljDestroy could not open JAWT reference!\n");
- fflush(stderr);
- ret=JNI_FALSE;
- jawt_close_unlock(env, pData, JNI_FALSE);
- return ret;
- }
-
- if(jawt_lock(env, pData, JNI_TRUE, verbose)==JNI_FALSE ||
- pData->result==JNI_FALSE
- )
- {
- if(JNI_TRUE==verbose)
- {
- fprintf(stderr, "GL4Java: gljDestroy lock failed\n");
- fflush(stderr);
- }
- /**
- * we have to continue destroying the context !
- *
- * therefore, the show ain't over yet !
- *
- jawt_close_unlock(env, pData, JNI_FALSE);
- return JNI_FALSE;
- */
- pData->result=JNI_TRUE; // the force will be with us ;-)
- }
-
- thisWin = GET_USED_WINDOW(pData);
-
- if(ret==JNI_TRUE)
- {
- if ( gc == 0 )
- {
- if(JNI_TRUE==verbose)
- {
- fprintf(stderr, "gljDestroy error, GL context is 0\n");
- fflush(stderr);
- }
- }
-
- if ( ! wglMakeCurrent( NULL, NULL ) )
- {
- fprintf(stderr, "gljDestroy failed (free)\n");
- fflush(stderr);
- }
-
- if(ret==JNI_TRUE)
- {
- if(gc!=0)
- wglDeleteContext(gc);
-
- if(pix!=0)
- {
- if(thisWin!=0)
- DeleteDC(thisWin);
- thisWin=0;
- pData->dsi_win = NULL;
- pData->dsi_win_created = 0;
- DeleteObject(pix);
- pix=0;
- }
- if(jownwind && thisWin!=0)
- {
- DeleteDC(thisWin);
- thisWin=0;
- pData->dsi_win = NULL;
- pData->dsi_win_created = 0;
- jownwind=JNI_FALSE;
- }
- }
- }
-
- gc = 0;
- thisWin = 0;
-
- jawt_free_close_unlock(env, &pData, verbose);
-
- pData=0;
- ret=JNI_TRUE; // force ..
-
- if(ret==JNI_TRUE && fpData!=0) {
- (*env)->SetLongField(env, obj, fpData, (jlong)((PointerHolder)pData));
- }
-
- if(ret==JNI_TRUE && fwindowHandle!=0) {
- (*env)->SetLongField(env, obj, fwindowHandle, (jlong)((PointerHolder)pData));
- }
-
- if(ret==JNI_TRUE && fglContext) {
- (*env)->SetLongField(env, obj, fglContext, (jlong)((PointerHolder)gc));
- }
-
-
- if(ret==JNI_TRUE && fpixmapHandle!=0) {
- (*env)->SetLongField(env, obj, fpixmapHandle, (jlong)((PointerHolder)pix));
- }
-
- if(ret==JNI_TRUE && fownwind) {
- (*env)->SetBooleanField(env, obj, fownwind, jownwind);
- }
-
- return ret;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj,
- jlong disp,
- jlong thisWin,
- jlong glContext,
- jboolean doubleBuffer
- )
-{
- jboolean ret = JNI_TRUE;
-
- (void)glContext;
- (void)disp;
-
- if( !thisWin || GET_USED_WINDOW(thisWin)==0)
- {
- fprintf(stderr,"Swap does not got the window ...\n");
- return JNI_FALSE;
- }
-
- if( doubleBuffer==JNI_TRUE )
- {
- if( SwapBuffers( GET_USED_WINDOW(thisWin) ) == FALSE )
- {
- /* Error in Win2000 implementation :o)
- * printf( "Error in swap buffer!\n" );
- */
- return JNI_FALSE;
- }
- } else {
- glFlush();
- }
- return ret;
-}
-
-JNIEXPORT void JNICALL
-Java_gl4java_GLContext_gljResizeNative( JNIEnv *env, jobject obj,
- jboolean isOwnWindow,
- jlong disp, jlong thisWin,
- jint width, jint height)
-{
- (void)isOwnWindow;
- (void)disp;
- (void)thisWin;
- (void)width;
- (void)height;
-
- return;
-}
-
+/*
+ * Original Author: Leo Chan -- 1995
+ *
+ * Adam King 1997
+ * Ported to Win32 from X
+ *
+ * This file takes care of the C implementation of finding the correct
+ * Win32 window, assigning an OpenGL graphics context to it, storing that
+ * graphics context in the java class data structure.
+ *
+ * also contains the use() and swap() functions for double buffering
+ *
+ * September 12, 1997 - Adam King
+ * - Added support for rendering directly into a Canvas ( BIG rewrite )
+ */
+
+/**
+ * Pointer Semantics of GLContext:
+ * ==============================
+
+ "displayHandle" := not used
+
+ "pData" := (JAWTDataHolder *)
+ "windowHandle" := "pData"
+
+ This holds the current state of the JAWT context !
+
+ This is used as the "not initialized" flag also !
+ It is reset to zero while Destroy Method
+
+ "pData"->dsi_win := (HDC)
+ if("offScreenRenderer" == TRUE)
+ "pData"->dsi_win contains the window handle,
+ of the last lock !
+ "pData"->dsi_win_created=0 !
+
+ "pixmapHandle" := (HBITMAP)
+ if("offScreenRenderer" == TRUE)
+ "pixmapHandle" contains the new BITMAP (by CreateDIBSection)!
+ "windowHandle" contains the new created OffScreenWindow
+ (by CreateCompatibleDC)!
+ else
+ "pixmapHandle" is unused !
+
+ "sharedGLContextNative" := (HGLRC)
+ This is the optional shared GLContext !
+
+ "glContext" := (HGLRC)
+ This is THE used GLContext !
+ */
+
+#include "OpenGL_Win32_common.h"
+
+#include "jawt_misc.h"
+
+/*
+ * Macros ..
+ */
+
+#define GET_W32_JAWT_DSI(a) \
+ ( (JAWT_Win32DrawingSurfaceInfo *) \
+ ( ( (JAWTDataHolder *)((PointerHolder)(a)) ) ->dsi_os ) \
+ )
+
+#define GET_USED_WINDOW(a) \
+ ( (HDC) \
+ ( ( (JAWTDataHolder *)((PointerHolder)(a)) ) ->dsi_win ) \
+ )
+
+static jboolean verbose = JNI_FALSE;
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_useJAWT( JNIEnv *env, jobject obj )
+{
+ (void)env;
+ (void)obj;
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_hasJAWTSurfaceChanged( JNIEnv *env, jobject obj,
+ jlong thisWin )
+{
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+ (void)env;
+ (void)obj;
+
+ if(pData!=0)
+ return (pData->lock & JAWT_LOCK_SURFACE_CHANGED) != 0 ;
+
+ return JNI_FALSE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
+ jobject canvas)
+{
+ jboolean ret = JNI_TRUE;
+
+ jclass cls = 0;
+ jfieldID fpixmapHandle=0;
+ jfieldID foffScreenRenderer=0;
+ jfieldID fwindowHandle=0, fpData=0;
+ jfieldID fverbose=0;
+ jfieldID fglContext=0;
+ jfieldID fshareWith=0;
+ jfieldID fcreatewinw = 0, fcreatewinh = 0;
+ jfieldID fglCaps=0;
+
+ /* these variables will be mapped in the java-object ! */
+ jboolean joffScreenRenderer=JNI_FALSE;
+ HDC theWindow=0;
+ PIXELFORMATDESCRIPTOR pfd;
+ HGLRC gc=0;
+ JAWTDataHolder * pData=0;
+ HGLRC shareWith=NULL;
+ jint jcreatewinw = 0, jcreatewinh = 0;
+ HBITMAP pix=0;
+
+ GLCapabilities glCaps;
+ jobject jglCaps=0;
+ jthrowable exc;
+ jclass _GLCapabilities= 0;
+ jclass _AwtComponent=0;
+
+ cls = (*env)->GetObjectClass(env, obj);
+ if(cls==0)
+ {
+ fprintf(stderr,"oo0.0 cls==0\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ if(ret==JNI_TRUE)
+ {
+ fverbose =(*env)->GetStaticFieldID(env, cls, "gljNativeDebug", "Z");
+ if (fverbose == 0)
+ {
+ fprintf(stderr,"oo0.2 fverbose==0\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ } else {
+ verbose = (*env)->GetStaticBooleanField(env, cls, fverbose);
+ }
+ }
+
+ if(JNI_TRUE==verbose)
+ {
+ 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 �jlong� */
+ ret = testWin32Java();
+
+ ret = testJavaGLTypes(verbose);
+
+ if(ret==JNI_TRUE) {
+ fpData = (*env)->GetFieldID(env, cls, "pData", "J");
+ if (fpData == 0) ret= JNI_FALSE;
+ else pData = (JAWTDataHolder *)
+ ( (PointerHolder)(*env)->GetLongField(env, obj, fpData));
+ }
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "received pData : %d\n", (int)pData);
+ }
+
+ if(ret==JNI_TRUE) {
+ fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
+ if (fwindowHandle == 0) ret= JNI_FALSE;
+ }
+
+ if(ret==JNI_TRUE) {
+ fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
+ if (fglContext == 0) ret= JNI_FALSE;
+ }
+
+ if(ret==JNI_TRUE) {
+ foffScreenRenderer =
+ (*env)->GetFieldID(env, cls, "offScreenRenderer", "Z");
+ if (foffScreenRenderer == 0) ret= JNI_FALSE;
+ else joffScreenRenderer =(*env)->GetBooleanField(env, obj, foffScreenRenderer);
+ }
+
+ if(ret==JNI_TRUE) {
+ fglCaps = (*env)->GetFieldID(env, cls, "glCaps", "Lgl4java/GLCapabilities;");
+ if (fglCaps == 0)
+ {
+ fprintf(stderr, "fglCaps not accessible !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ }
+ else jglCaps =(*env)->GetObjectField(env, obj, fglCaps);
+ }
+
+ if( jglCaps==0 )
+ {
+ fprintf(stderr,"\nGL4Java openOpenGL ERROR: ZERO capsObj was fetched by GetObjectField !\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ _GLCapabilities= (*env)->FindClass(env, "Lgl4java/GLCapabilities;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: openOpen FindClass gl4java/GLCapabilities failed, cannot check glCaps object\n");
+ (*env)->ExceptionDescribe(env);
+ fflush(stderr);
+ }
+ (*env)->ExceptionClear(env);
+ _GLCapabilities=0;
+ }
+ exc=0;
+
+ if( _GLCapabilities!=0 &&
+ (*env)->IsInstanceOf(env, jglCaps, _GLCapabilities)==JNI_FALSE )
+ {
+ fprintf(stderr,"\nGL4Java openOpenGL ERROR: glCaps is not instanceof gl4java/GLCapabilities !\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ if(JNI_TRUE != javaGLCapabilities2NativeGLCapabilities
+ ( env, jglCaps, &glCaps ) )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: glCaps Object is not valid !\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ if(ret==JNI_TRUE) {
+ fcreatewinw = (*env)->GetFieldID(env, cls, "createwinw", "I");
+ if (fcreatewinw == 0) ret= JNI_FALSE;
+ else jcreatewinw =(*env)->GetIntField(env, obj, fcreatewinw);
+ }
+
+ if(ret==JNI_TRUE) {
+ fcreatewinh = (*env)->GetFieldID(env, cls, "createwinh", "I");
+ if (fcreatewinh == 0) ret= JNI_FALSE;
+ else jcreatewinh =(*env)->GetIntField(env, obj, fcreatewinh);
+ }
+
+ if(ret==JNI_TRUE) {
+ fshareWith = (*env)->GetFieldID(env, cls, "sharedGLContextNative", "J");
+ if (fshareWith == 0) ret= JNI_FALSE;
+ else shareWith = (HGLRC)
+ ( (PointerHolder)(*env)->GetLongField(env, obj, fshareWith));
+ }
+
+ if(ret==JNI_TRUE) {
+ fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J");
+ if (fpixmapHandle == 0) ret= JNI_FALSE;
+ }
+
+ if(joffScreenRenderer==JNI_TRUE)
+ {
+ glCaps.buffer=BUFFER_SINGLE;
+ }
+
+ if(JNI_TRUE==verbose && joffScreenRenderer==JNI_TRUE)
+ {
+ fprintf(stderr,"\nGL4Java: (USING OFFSCREEN GLPIXMAP BUFFER,\n\t forced: !doubleBuffer)\n");
+ fflush(stderr);
+ }
+
+ _AwtComponent= (*env)->FindClass(env, "Ljava/awt/Component;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: openOpen FindClass java/awt/Component failed, cannot check canvas object\n");
+ (*env)->ExceptionDescribe(env);
+ fflush(stderr);
+ }
+ (*env)->ExceptionClear(env);
+ _AwtComponent=0;
+ }
+ exc=0;
+
+ if(ret==JNI_TRUE) {
+ if (canvas == 0)
+ {
+ ret= JNI_FALSE;
+ fprintf(stderr,"\nGL4Java ERROR: canvas == NULL !\n");
+ fflush(stderr);
+ } else {
+ if( _AwtComponent!=0 &&
+ (*env)->IsInstanceOf(env, canvas, _AwtComponent)==JNI_FALSE)
+ {
+ fprintf(stderr,"\nGL4Java ERROR: canvas is not instanceof java/awt/Component !\n");
+ fflush(stderr);
+ ret= JNI_FALSE;
+ }
+ }
+ }
+
+ if(joffScreenRenderer==JNI_TRUE)
+ {
+ jawt_create_offscreen(env, &pData, verbose);
+ }
+ else {
+ if(jawt_create_open(env, canvas, &pData, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: openOpen could not create&open JAWT reference!\n");
+ fflush(stderr);
+ jawt_free_close_unlock(env, &pData, JNI_FALSE);
+ ret=JNI_FALSE;
+ return ret;
+ }
+
+ if(jawt_lock(env, pData, JNI_TRUE, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: openOpen could not lock JAWT reference!\n");
+ fflush(stderr);
+ jawt_free_close_unlock(env, &pData, JNI_FALSE);
+ ret=JNI_FALSE;
+ return ret;
+ }
+ }
+
+ if(pData->result==JNI_TRUE)
+ {
+ if(joffScreenRenderer==JNI_FALSE)
+ {
+ theWindow = GET_W32_JAWT_DSI(pData)->hdc;
+ jcreatewinw = pData->dsi->bounds.width;
+ jcreatewinh = pData->dsi->bounds.height;
+ }
+ }
+
+ wglMakeCurrent(NULL, NULL);
+
+ /**
+ * with version jdk1.1.6 and later, we are able to use
+ * the java-function straight to achieve the native window
+ * handle ....
+ *
+ * this handle is saved to pData for the windows version !
+ */
+ if( theWindow == 0 && !joffScreenRenderer)
+ {
+ printf( "get_GC: Error, pData->hdc is zero\n");
+ jawt_free_close_unlock(env, &pData, JNI_FALSE);
+ return JNI_FALSE;
+ }
+
+ /* get the graphics context for this widget */
+ if( (gc = get_GC( &theWindow, &glCaps,
+ shareWith, joffScreenRenderer, jcreatewinw,
+ jcreatewinh, &pix, verbose)) == 0 )
+ {
+ printf( "getGC error" );
+ return JNI_FALSE;
+ }
+
+ /* fetch the states of doubleBuffer and stereo */
+ (void) PixelFormatDescriptorFromDc( theWindow, &pfd);
+
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stdout,"\nGL4Java: writing capabilities to GLContext's java object\n");
+ fflush(stdout);
+ }
+
+ (void) nativeGLCapabilities2JavaGLCapabilities (env, jglCaps, &glCaps);
+
+ if(ret==JNI_TRUE && fglCaps) {
+ (*env)->SetObjectField(env, obj, fglCaps, jglCaps);
+ }
+
+ jawt_close_unlock(env, pData, verbose);
+
+ if(ret==JNI_TRUE && fwindowHandle!=0) {
+ (*env)->SetLongField(env, obj, fwindowHandle,
+ (jlong)((PointerHolder)pData));
+ }
+ if(ret==JNI_TRUE && fpData!=0) {
+ (*env)->SetLongField(env, obj, fpData,
+ (jlong)((PointerHolder)pData));
+ }
+
+ if(ret==JNI_TRUE && fpixmapHandle!=0) {
+ (*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)->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);
+ }
+
+ /*
+ gl4java_bind_ext(JNI_TRUE==verbose);
+ */
+
+ return ret;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj,
+ jobject canvas,
+ jlong disp,
+ jlong thisWin,
+ jlong glContext)
+{
+ jboolean ret = JNI_TRUE;
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+
+ if( !thisWin )
+ {
+ return JNI_FALSE;
+ }
+
+ if( !glContext )
+ {
+ return JNI_FALSE;
+ }
+
+ if(jawt_open(env, canvas, pData, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: MakeCurrent could not open JAWT reference!\n");
+ fflush(stderr);
+ ret=JNI_FALSE;
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return ret;
+ }
+
+ if(jawt_lock(env, pData, JNI_FALSE, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ /* this can happen:
+ if ( (pJData->lock & JAWT_LOCK_SURFACE_CHANGED) != 0 )
+
+ In this case, we need a new GLXContext ...
+
+ This has to be queried by the java class,
+ while using the native method hasJAWTSurfaceChanged !
+ */
+ if(verbose)
+ {
+ fprintf(stderr,"\nGL4Java ERROR: MakeCurrent could not lock JAWT reference!\n");
+ fflush(stderr);
+ }
+ ret=JNI_FALSE;
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return ret;
+ }
+
+ if ( ret==JNI_TRUE && !wglMakeCurrent(GET_USED_WINDOW(thisWin),
+ (HGLRC)((PointerHolder)glContext)) )
+ {
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj,
+ jobject canvas,
+ jlong disp,
+ jlong thisWin,
+ jlong glContext
+ )
+{
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+ jboolean ret = JNI_TRUE;
+
+ (void)glContext;
+ (void)disp;
+ (void)canvas;
+
+ if ( ! wglMakeCurrent( NULL, NULL ) )
+ {
+ fprintf(stderr, "gljFree failed\n");
+ fflush(stderr);
+ ret = JNI_FALSE;
+ }
+
+ if(pData!=NULL)
+ jawt_close_unlock(env, pData, verbose);
+
+ return ret;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj,
+ jobject canvas)
+{
+ jboolean ret = JNI_TRUE;
+
+ jclass cls = 0;
+ jfieldID fpData=0;
+ jfieldID fwindowHandle=0, fpixmapHandle=0;
+ jfieldID fglContext=0;
+ jfieldID foffScreenRenderer=0;
+ jfieldID fownwind=0;
+
+ jboolean jownwind = JNI_FALSE ;
+ jboolean joffScreenRenderer=JNI_FALSE;
+ HBITMAP pix=0;
+ HDC thisWin=0;
+ HGLRC gc=0;
+ JAWTDataHolder * pData = NULL;
+
+ (void)canvas;
+
+ cls = (*env)->GetObjectClass(env, obj);
+ if(cls==0)
+ {
+ ret=JNI_FALSE;
+ }
+
+ if(ret==JNI_TRUE) {
+ fwindowHandle = (*env)->GetFieldID(env, cls, "windowHandle", "J");
+ if (fwindowHandle == 0) ret= JNI_FALSE;
+ }
+
+ if(ret==JNI_TRUE) {
+ fglContext=(*env)->GetFieldID(env, cls, "glContext", "J");
+ if (fglContext == 0) ret= JNI_FALSE;
+ else gc =(HGLRC)
+ ((PointerHolder)(*env)->GetLongField(env, obj, fglContext));
+ }
+
+
+ if(ret==JNI_TRUE) {
+ fpixmapHandle = (*env)->GetFieldID(env, cls, "pixmapHandle", "J");
+ if (fpixmapHandle == 0) ret= JNI_FALSE;
+ else pix =(HBITMAP)
+ ((PointerHolder)(*env)->GetLongField(env, obj, fpixmapHandle));
+ }
+
+ if(ret==JNI_TRUE) {
+ foffScreenRenderer =
+ (*env)->GetFieldID(env, cls, "offScreenRenderer", "Z");
+ if (foffScreenRenderer == 0) ret= JNI_FALSE;
+ 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) {
+ fpData = (*env)->GetFieldID(env, cls, "pData", "J");
+ if (fpData == 0) ret= JNI_FALSE;
+ else pData =(JAWTDataHolder *)
+ ( (PointerHolder) (*env)->GetLongField(env, obj, fpData) );
+ }
+
+
+ if(jawt_open(env, canvas, pData, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: gljDestroy could not open JAWT reference!\n");
+ fflush(stderr);
+ ret=JNI_FALSE;
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return ret;
+ }
+
+ if(jawt_lock(env, pData, JNI_TRUE, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: gljDestroy lock failed\n");
+ fflush(stderr);
+ }
+ /**
+ * we have to continue destroying the context !
+ *
+ * therefore, the show ain't over yet !
+ *
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return JNI_FALSE;
+ */
+ pData->result=JNI_TRUE; // the force will be with us ;-)
+ }
+
+ thisWin = GET_USED_WINDOW(pData);
+
+ if(ret==JNI_TRUE)
+ {
+ if ( gc == 0 )
+ {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "gljDestroy error, GL context is 0\n");
+ fflush(stderr);
+ }
+ }
+
+ if ( ! wglMakeCurrent( NULL, NULL ) )
+ {
+ fprintf(stderr, "gljDestroy failed (free)\n");
+ fflush(stderr);
+ }
+
+ if(ret==JNI_TRUE)
+ {
+ if(gc!=0)
+ wglDeleteContext(gc);
+
+ if(pix!=0)
+ {
+ if(thisWin!=0)
+ DeleteDC(thisWin);
+ thisWin=0;
+ pData->dsi_win = NULL;
+ pData->dsi_win_created = 0;
+ DeleteObject(pix);
+ pix=0;
+ }
+ if(jownwind && thisWin!=0)
+ {
+ DeleteDC(thisWin);
+ thisWin=0;
+ pData->dsi_win = NULL;
+ pData->dsi_win_created = 0;
+ jownwind=JNI_FALSE;
+ }
+ }
+ }
+
+ gc = 0;
+ thisWin = 0;
+
+ jawt_free_close_unlock(env, &pData, verbose);
+
+ pData=0;
+ ret=JNI_TRUE; // force ..
+
+ if(ret==JNI_TRUE && fpData!=0) {
+ (*env)->SetLongField(env, obj, fpData, (jlong)((PointerHolder)pData));
+ }
+
+ if(ret==JNI_TRUE && fwindowHandle!=0) {
+ (*env)->SetLongField(env, obj, fwindowHandle, (jlong)((PointerHolder)pData));
+ }
+
+ if(ret==JNI_TRUE && fglContext) {
+ (*env)->SetLongField(env, obj, fglContext, (jlong)((PointerHolder)gc));
+ }
+
+
+ if(ret==JNI_TRUE && fpixmapHandle!=0) {
+ (*env)->SetLongField(env, obj, fpixmapHandle, (jlong)((PointerHolder)pix));
+ }
+
+ if(ret==JNI_TRUE && fownwind) {
+ (*env)->SetBooleanField(env, obj, fownwind, jownwind);
+ }
+
+ return ret;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj,
+ jlong disp,
+ jlong thisWin,
+ jlong glContext,
+ jboolean doubleBuffer
+ )
+{
+ jboolean ret = JNI_TRUE;
+
+ (void)glContext;
+ (void)disp;
+
+ if( !thisWin || GET_USED_WINDOW(thisWin)==0)
+ {
+ fprintf(stderr,"Swap does not got the window ...\n");
+ return JNI_FALSE;
+ }
+
+ if( doubleBuffer==JNI_TRUE )
+ {
+ if( SwapBuffers( GET_USED_WINDOW(thisWin) ) == FALSE )
+ {
+ /* Error in Win2000 implementation :o)
+ * printf( "Error in swap buffer!\n" );
+ */
+ return JNI_FALSE;
+ }
+ } else {
+ glFlush();
+ }
+ return ret;
+}
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLContext_gljResizeNative( JNIEnv *env, jobject obj,
+ jboolean isOwnWindow,
+ jlong disp, jlong thisWin,
+ jint width, jint height)
+{
+ (void)isOwnWindow;
+ (void)disp;
+ (void)thisWin;
+ (void)width;
+ (void)height;
+
+ return;
+}
+
diff --git a/CNativeCode/OpenGL_X11.c b/CNativeCode/OpenGL_X11.c
index 610611d..ac88c70 100644
--- a/CNativeCode/OpenGL_X11.c
+++ b/CNativeCode/OpenGL_X11.c
@@ -126,18 +126,16 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
jfieldID fdisplayHandle=0, fwindowHandle=0, fpixmapHandle=0;
jfieldID fverbose=0;
jfieldID fglContext=0;
- jfieldID fstereoView=0, frgba=0, fstencilBits=0,
- faccumSize=0, fownwind=0;
- jfieldID fdoubleBuffer=0, foffScreenRenderer;
+ jfieldID fglCaps=0;
+ jfieldID fownwind=0, foffScreenRenderer;
jfieldID fcreatewinw = 0, fcreatewinh = 0;
jfieldID fshareWith = 0;
jboolean joffScreenRenderer=JNI_FALSE;
- jboolean jdoubleBuffer=JNI_TRUE;
- jboolean jstereoView=JNI_FALSE;
- jboolean jrgba=JNI_TRUE;
- jint jstencilBits=0;
- jint jaccumSize=0;
+
+ jobject jglCaps=0;
+ GLCapabilities glCaps;
+
jboolean jownwind = JNI_FALSE ;
jint jcreatewinw = 0, jcreatewinh = 0;
GLXContext jshareWith = 0;
@@ -148,7 +146,8 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
Window rootwini = 0;
Pixmap pix;
- int iValue, iValue1, iValue2, iValue3;
+ jthrowable exc;
+ jclass _GLCapabilities= 0;
(void)canvas;
@@ -191,33 +190,39 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
}
if(ret==JNI_TRUE) {
- fdoubleBuffer = (*env)->GetFieldID(env, cls, "doubleBuffer", "Z");
- if (fdoubleBuffer == 0) ret= JNI_FALSE;
- else jdoubleBuffer =(*env)->GetBooleanField(env, obj, fdoubleBuffer);
- }
-
- if(ret==JNI_TRUE) {
- fstereoView = (*env)->GetFieldID(env, cls, "stereoView", "Z");
- if (fstereoView == 0) ret= JNI_FALSE;
- else jstereoView =(*env)->GetBooleanField(env, obj, fstereoView);
- }
-
- if(ret==JNI_TRUE) {
- frgba = (*env)->GetFieldID(env, cls, "rgba", "Z");
- if (frgba == 0) ret= JNI_FALSE;
- else jrgba =(*env)->GetBooleanField(env, obj, frgba);
- }
-
- if(ret==JNI_TRUE) {
- fstencilBits = (*env)->GetFieldID(env, cls, "stencilBits", "I");
- if (fstencilBits == 0) ret= JNI_FALSE;
- else jstencilBits =(*env)->GetIntField(env, obj, fstencilBits);
+ fglCaps = (*env)->GetFieldID(env, cls, "glCaps", "Lgl4java/GLCapabilities;");
+ if (fglCaps == 0) ret= JNI_FALSE;
+ else jglCaps =(*env)->GetObjectField(env, obj, fglCaps);
+ }
+
+ _GLCapabilities= (*env)->FindClass(env, "Lgl4java/GLCapabilities;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: openOpen FindClass gl4java/GLCapabilities failed, cannot check glCaps object\n");
+ (*env)->ExceptionDescribe(env);
+ fflush(stderr);
+ }
+ (*env)->ExceptionClear(env);
+ _GLCapabilities=0;
+ }
+ exc=0;
+
+ if( _GLCapabilities!=0 &&
+ (*env)->IsInstanceOf(env, jglCaps, _GLCapabilities)==JNI_FALSE )
+ {
+ fprintf(stderr,"\nGL4Java openOpenGL ERROR: glCaps is not instanceof gl4java/GLCapabilities !\n");
+ fflush(stderr);
+ return JNI_FALSE;
}
- if(ret==JNI_TRUE) {
- faccumSize = (*env)->GetFieldID(env, cls, "accumSize", "I");
- if (faccumSize == 0) ret= JNI_FALSE;
- else jaccumSize =(*env)->GetIntField(env, obj, faccumSize);
+ if(JNI_TRUE != javaGLCapabilities2NativeGLCapabilities
+ ( env, jglCaps, &glCaps ) )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: glCaps Object is not valid !\n");
+ fflush(stderr);
+ return JNI_FALSE;
}
if(ret==JNI_TRUE) {
@@ -283,14 +288,6 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
fflush(stderr);
}
- if(JNI_TRUE==verbose)
- {
- fprintf(stderr,"\nGL4Java: (try to use visuals: doubleBuffer=%d, stereoView=%d, rgba=%d, stencilBits=%d, accumSize=%d, ownWindow=%d)\n)\n",
- (int)jdoubleBuffer, (int)jstereoView, (int)jrgba, (int)jstencilBits, (int)jaccumSize,
- (int)jownwind );
- fflush(stderr);
- }
-
if(ret==JNI_TRUE) {
fdisplayHandle = (*env)->GetFieldID(env, cls, "displayHandle", "J");
if (fdisplayHandle == 0) ret= JNI_FALSE;
@@ -327,12 +324,11 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
fprintf(stderr, "GL4Java ERROR: Can not query glx extension -> Server does not support OpenGL\n");
fflush(stderr);
ret = JNI_FALSE;
- } else {
- if (JNI_TRUE==verbose) {
+ } else if (JNI_TRUE==verbose)
+ {
fprintf(stdout, "GLX by %s Version %s\n",
glXGetClientString(display, GLX_VENDOR),
glXGetClientString(display, GLX_VERSION));
- }
}
}
@@ -346,18 +342,21 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
vgc = findVisualGlX( display, rootwini, &thisWin,
(int)jcreatewinw, (int)jcreatewinh,
- jdoubleBuffer, jstereoView, jrgba,
- jstencilBits, jaccumSize,
+ &glCaps,
&jownwind, jshareWith,
joffScreenRenderer, &pix, verbose);
- if(vgc.success == 0 && jrgba==JNI_TRUE)
+ if(vgc.success == 0 && glCaps.color==COLOR_RGBA)
{
- jrgba=JNI_FALSE;
+ if (JNI_TRUE==verbose) {
+ fprintf(stdout, "GL4Java switching color:=COLOR_INDEX\n");
+ fflush(stdout);
+ }
+ glCaps.color=COLOR_INDEX;
+
vgc = findVisualGlX( display, rootwini, &thisWin,
(int)jcreatewinw, (int)jcreatewinh,
- jdoubleBuffer, jstereoView, jrgba,
- jstencilBits, jaccumSize,
+ &glCaps,
&jownwind, jshareWith,
joffScreenRenderer, &pix, verbose);
}
@@ -374,104 +373,20 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
XCloseDisplay( display );
ret = JNI_FALSE;
} else {
- if(glXGetConfig( display, vgc.visual,
- GLX_DOUBLEBUFFER, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"doubleBuffer: %d\n", iValue);
- fflush(stdout);
- }
- jdoubleBuffer=iValue?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && fdoubleBuffer!=0) {
- (*env)->SetBooleanField(env, obj, fdoubleBuffer,
- jdoubleBuffer);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching doubleBuffer state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,
- GLX_STEREO, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"stereoView: %d\n", iValue);
- fflush(stdout);
- }
- jstereoView=iValue?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && fstereoView!=0) {
- (*env)->SetBooleanField(env, obj, fstereoView,
- jstereoView);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching stereoView state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,
- GLX_RGBA, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"rgba: %d\n", iValue);
- fflush(stdout);
- }
- jrgba=iValue?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && frgba!=0) {
- (*env)->SetBooleanField(env, obj, frgba,
- jrgba);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching rgba state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,
- GLX_STENCIL_SIZE, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"stencilBits: %d\n", iValue);
- fflush(stdout);
- }
- jstencilBits=iValue;
- if(ret==JNI_TRUE && fstencilBits!=0) {
- (*env)->SetIntField(env, obj,
- fstencilBits, (jint)jstencilBits);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching stencilBits state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,GLX_ACCUM_RED_SIZE, &iValue)==0 &&
- glXGetConfig( display, vgc.visual,GLX_ACCUM_GREEN_SIZE, &iValue1)==0 &&
- glXGetConfig( display, vgc.visual,GLX_ACCUM_BLUE_SIZE, &iValue2)==0 &&
- glXGetConfig( display, vgc.visual,GLX_ACCUM_ALPHA_SIZE, &iValue3)==0 )
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"accumSize(red): %d\n", iValue);
- fprintf(stdout,"accumSize(green): %d\n", iValue1);
- fprintf(stdout,"accumSize(blue): %d\n", iValue2);
- fprintf(stdout,"accumSize(alpha): %d\n", iValue3);
- fflush(stdout);
- }
- jaccumSize=iValue+iValue1+iValue2+iValue3;
- if(ret==JNI_TRUE && faccumSize!=0) {
- (*env)->SetIntField(env, obj,
- faccumSize, (jint)jaccumSize);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching accumSize(red) state failed\n");
- fflush(stderr);
- }
+ (void) setGLCapabilities (display, vgc.visual, &glCaps);
+
if(JNI_TRUE==verbose)
{
- fprintf(stderr,"\nGL4Java: (using visuals: doubleBuffer=%d, stereoView=%d, rgba=%d, stencilBits=%d, accumSize=%d, ownWindow=%d)\n)\n",
- (int)jdoubleBuffer, (int)jstereoView, (int)jrgba,
- (int)jstencilBits, (int)jaccumSize, (int)jownwind);
- fflush(stderr);
+ fprintf(stdout,"\nGL4Java: writing capabilities to GLContext's java object\n");
+ fflush(stdout);
}
+ (void) nativeGLCapabilities2JavaGLCapabilities
+ (env, jglCaps, &glCaps);
+
+ if(ret==JNI_TRUE && fglCaps) {
+ (*env)->SetObjectField(env, obj, fglCaps, jglCaps);
+ }
}
}
@@ -769,3 +684,4 @@ Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj,
return JNI_TRUE;
}
+
diff --git a/CNativeCode/OpenGL_X11_common.c b/CNativeCode/OpenGL_X11_common.c
index 0c92a65..a23e8cf 100644
--- a/CNativeCode/OpenGL_X11_common.c
+++ b/CNativeCode/OpenGL_X11_common.c
@@ -96,6 +96,46 @@ int LIBAPIENTRY get_GC( Display *display, Window win, XVisualInfo *visual,
}
+int LIBAPIENTRY setVisualAttribListByGLCapabilities(
+ int visualAttribList[/*>=32*/],
+ GLCapabilities *glCaps )
+{
+ int 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++] = (glCaps->accumRedBits>0)?1:0;
+ visualAttribList[i++] = GLX_ACCUM_GREEN_SIZE;
+ visualAttribList[i++] = (glCaps->accumGreenBits>0)?1:0;
+ visualAttribList[i++] = GLX_ACCUM_BLUE_SIZE;
+ visualAttribList[i++] = (glCaps->accumBlueBits>0)?1:0;
+
+ if(COLOR_RGBA == glCaps->color)
+ {
+ visualAttribList[i++] = GLX_RGBA;
+ visualAttribList[i++] = GLX_ALPHA_SIZE;
+ visualAttribList[i++] = (glCaps->alphaBits>0)?1:0;
+ visualAttribList[i++] = GLX_ACCUM_ALPHA_SIZE;
+ visualAttribList[i++] = (glCaps->accumAlphaBits>0)?1:0;
+ }
+ if(BUFFER_DOUBLE==glCaps->buffer)
+ visualAttribList[i++] = GLX_DOUBLEBUFFER;
+
+ if(STEREO_ON==glCaps->stereo)
+ visualAttribList[i++] = GLX_STEREO;
+
+ visualAttribList[i++] = GLX_STENCIL_SIZE;
+ visualAttribList[i++] = glCaps->stencilBits;
+ visualAttribList[i] = None;
+ return i;
+}
+
/**
* Description for pWin:
@@ -109,11 +149,7 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
Window rootWin,
Window * pWin,
int width, int height,
- jboolean doubleBuffer,
- jboolean stereoView,
- jboolean rgba,
- jint stencilBits,
- jint accumSize,
+ GLCapabilities * glCaps,
jboolean * pOwnWin,
GLXContext shareWith,
jboolean offscreen,
@@ -122,8 +158,7 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
)
{
Window newWin = 0;
- int visualAttribList[32];
- int i=0;
+ int visualAttribList[64];
int j=0;
int done=0;
VisualGC vgc = { NULL, 0, 0 };
@@ -135,12 +170,14 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
*/
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;
+ /* backup ... */
+ GLCapabilities _glCaps = *glCaps;
+
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stdout, "GL4Java findVisualGlX: input capabilities:\n");
+ printGLCapabilities ( glCaps );
+ }
do {
if(JNI_TRUE==verbose)
@@ -148,35 +185,19 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
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)
+ if(glCaps->nativeVisualID>=0)
+ {
+ vgc.visual = findVisualIdByID(&visualList,
+ (int)(glCaps->nativeVisualID),
+ display, *pWin, verbose);
+ }
+
+ if(vgc.visual==NULL)
{
- visualAttribList[i++] = GLX_RGBA;
- visualAttribList[i++] = GLX_ACCUM_ALPHA_SIZE;
- visualAttribList[i++] = accumSize;
+ glCaps->nativeVisualID=0;
+ (void) setVisualAttribListByGLCapabilities(
+ visualAttribList, glCaps);
}
- 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)
{
@@ -187,13 +208,13 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
{
if(vgc.visual!=NULL)
{
- fprintf(stderr, "glXChooseVisual: test visual(ID:%d(0x%X)):\n",
+ fprintf(stdout, "findVisualGlX.glXChooseVisual: found 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);
+ } else {
+ fprintf(stdout, "findVisualGlX.glXChooseVisual: no visual\n");
+ }
+ fflush(stdout);
}
}
@@ -201,25 +222,17 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
{
vgc.visual = findVisualIdByFeature( &visualList,
display, *pWin,
- doubleBuffer, stereoView,
- rgba,
- stencilBits,
- accumSize,
+ glCaps,
verbose);
}
- if(vgc.visual==NULL)
- {
- vgc.visual = findVisualIdByFeature( &visualList,
- display, *pWin,
- doubleBuffer, stereoView,
- rgba,
- stencilBits>0,
- accumSize>0, verbose);
- }
-
if( *pOwnWin == JNI_TRUE && vgc.visual!=NULL)
{
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stdout, "findVisualGlX: CREATING OWN WINDOW !\n");
+ fflush(stdout);
+ }
newWin = createOwnOverlayWin(display,
rootWin,
*pWin /* the parent */,
@@ -302,32 +315,41 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
vgc.visual=NULL;
}
- /* Fall-Back ... */
+ /**
+ * Falling-Back the exact (min. requirement) parameters ..
+ */
if(*pOwnWin==JNI_FALSE && offscreen==JNI_FALSE) {
- rgba=_rgba;
- stencilBits=_stencilBits;
- accumSize=_accumSize;
- stereoView=_stereoView;
- doubleBuffer=_doubleBuffer;
+ *glCaps=_glCaps;
*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( (glCaps->accumRedBits>0 ||
+ glCaps->accumGreenBits>0 ||
+ glCaps->accumBlueBits>0 ||
+ glCaps->accumAlphaBits>0
+ ) && offscreen==JNI_TRUE
+ )
+ {
+ glCaps->accumRedBits=0;
+ glCaps->accumGreenBits=0;
+ glCaps->accumBlueBits=0;
+ glCaps->accumAlphaBits=0;
+ } else if(glCaps->buffer==BUFFER_SINGLE &&
+ offscreen==JNI_TRUE)
+ {
+ glCaps->buffer=BUFFER_DOUBLE;
+ } else if(glCaps->stereo==STEREO_ON) {
+ glCaps->stereo=STEREO_OFF;
+ } else if(glCaps->stencilBits>32) {
+ glCaps->stencilBits=32;
+ } else if(glCaps->stencilBits>16) {
+ glCaps->stencilBits=16;
+ } else if(glCaps->stencilBits>8) {
+ glCaps->stencilBits=8;
+ } else if(glCaps->stencilBits>0) {
+ glCaps->stencilBits=0;
+ } else if(glCaps->buffer==BUFFER_DOUBLE) {
+ glCaps->buffer=BUFFER_SINGLE;
} else if(tryChooseVisual==JNI_TRUE) {
- rgba=_rgba;
- stencilBits=_stencilBits;
- accumSize=_accumSize;
- stereoView=_stereoView;
- doubleBuffer=_doubleBuffer;
+ *glCaps=_glCaps;
*pOwnWin=JNI_FALSE;
tryChooseVisual=JNI_FALSE;
} else done=1;
@@ -336,7 +358,9 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
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",
+ (void) setGLCapabilities (display, vgc.visual, glCaps);
+
+ fprintf(stderr, "\nfindVisualGlX results 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,
@@ -353,10 +377,11 @@ VisualGC LIBAPIENTRY findVisualGlX( Display *display,
void LIBAPIENTRY printVisualInfo ( Display *display, XVisualInfo * vi)
{
- int dblBuffer, stereoView, rgbaMode, stencilSize;
- int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize;
+ GLCapabilities glCaps;
- fprintf(stderr, "\nvi(ID:%d(0x%X)): \n screen %d, depth %d, class %d,\n clrmapsz %d, bitsPerRGB %d\n",
+ setGLCapabilities ( display, vi, &glCaps);
+
+ fprintf(stdout, "\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,
@@ -365,25 +390,7 @@ void LIBAPIENTRY printVisualInfo ( Display *display, XVisualInfo * vi)
(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);
+ printGLCapabilities ( &glCaps );
}
void LIBAPIENTRY printAllVisualInfo ( Display *disp, Window win, jboolean verbose)
@@ -423,45 +430,103 @@ void LIBAPIENTRY printAllVisualInfo ( Display *disp, Window win, jboolean verbos
}
int LIBAPIENTRY testVisualInfo ( Display *display, XVisualInfo * vi,
- int dblBuffer, int stereoView, int rgbaMode,
- int stencilSize, int accumSize)
+ GLCapabilities *glCaps)
{
- int glxCfg;
+ GLCapabilities _glCaps;
+ setGLCapabilities ( display, vi, &_glCaps);
+
+ if(_glCaps.buffer<glCaps->buffer) return 0;
+
+ if(_glCaps.color<glCaps->color) return 0;
+
+ if(_glCaps.stereo<glCaps->stereo) return 0;
- glXGetConfig( display, vi, GLX_DOUBLEBUFFER, &glxCfg);
- if(glxCfg<dblBuffer) return 0;
+ /*
+ if(_glCaps.depthBits<glCaps->depthBits) return 0;
+ */
- glXGetConfig( display, vi, GLX_STEREO, &glxCfg);
- if(glxCfg<stereoView) return 0;
+ if(_glCaps.stencilBits<glCaps->stencilBits) return 0;
- glXGetConfig( display, vi, GLX_RGBA, &glxCfg);
- if(glxCfg<rgbaMode) return 0;
+ /*
+ if(_glCaps.redBits<glCaps->redBits) return 0;
- glXGetConfig( display, vi, GLX_STENCIL_SIZE, &glxCfg);
- if(glxCfg<stencilSize) return 0;
+ if(_glCaps.greenBits<glCaps->greenBits) return 0;
- glXGetConfig(display, vi, GLX_ACCUM_RED_SIZE, &glxCfg);
- if(glxCfg<accumSize) return 0;
+ if(_glCaps.blueBits<glCaps->blueBits) return 0;
+ */
- glXGetConfig(display, vi, GLX_ACCUM_GREEN_SIZE, &glxCfg);
- if(glxCfg<accumSize) return 0;
+ if(_glCaps.accumRedBits<glCaps->accumRedBits) return 0;
- glXGetConfig(display, vi, GLX_ACCUM_BLUE_SIZE, &glxCfg);
- if(glxCfg<accumSize) return 0;
+ if(_glCaps.accumGreenBits<glCaps->accumGreenBits) return 0;
- if(rgbaMode>0) {
- glXGetConfig(display, vi, GLX_ACCUM_ALPHA_SIZE, &glxCfg);
- if(glxCfg<accumSize) return 0;
+ if(_glCaps.accumBlueBits<glCaps->accumBlueBits) return 0;
+
+ if(glCaps->color>0) {
+ /*
+ if(_glCaps.alphaBits<glCaps->alphaBits) return 0;
+ */
+ if(_glCaps.accumAlphaBits<glCaps->accumAlphaBits) return 0;
}
return 1;
}
+XVisualInfo * LIBAPIENTRY findVisualIdByID( XVisualInfo ** visualList,
+ int visualID, Display *disp,
+ Window win, jboolean verbose)
+{
+ 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(vi->visualid==visualID)
+ {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "findVisualIdByID: Found matching Visual:\n");
+ printVisualInfo ( disp, vi);
+ }
+ return vi;
+ }
+ }
+
+ if(JNI_TRUE==verbose)
+ {
+ if( numReturns==0 )
+ fprintf(stderr, "findVisualIdByID: No available visuals. Exiting...\n" );
+ else if( i>=numReturns )
+ fprintf(stderr, "findVisualIdByID: No matching visualID found ...\n" );
+ fflush(stderr);
+ }
+
+ XFree(*visualList);
+ *visualList=NULL;
+ return NULL;
+}
XVisualInfo * LIBAPIENTRY findVisualIdByFeature( XVisualInfo ** visualList,
Display *disp, Window win,
- int dblBuffer, int stereoView, int rgbaMode,
- int stencilSize, int accumSize,
+ GLCapabilities *glCaps,
jboolean verbose)
{
XVisualInfo * vi=0;
@@ -487,8 +552,7 @@ XVisualInfo * LIBAPIENTRY findVisualIdByFeature( XVisualInfo ** visualList,
for(i=0; done==0 && i<numReturns; i++)
{
vi = &((*visualList)[i]);
- if ( testVisualInfo ( disp, vi, dblBuffer, stereoView, rgbaMode,
- stencilSize, accumSize) )
+ if ( testVisualInfo ( disp, vi, glCaps ) )
{
if(JNI_TRUE==verbose)
{
@@ -548,6 +612,86 @@ jboolean LIBAPIENTRY testX11Java()
return ret;
}
+jboolean LIBAPIENTRY setGLCapabilities ( Display * disp,
+ XVisualInfo * visual, GLCapabilities *glCaps)
+{
+ int iValue=0;
+ int iValue1=0;
+ int iValue2=0;
+ int iValue3=0;
+
+ if(glXGetConfig( disp, visual, GLX_DOUBLEBUFFER, &iValue)==0)
+ {
+ glCaps->buffer=iValue?BUFFER_DOUBLE:BUFFER_SINGLE;
+ } else {
+ fprintf(stderr,"GL4Java: fetching doubleBuffer state failed\n");
+ fflush(stderr);
+ }
+
+ if(glXGetConfig( disp, visual, GLX_RGBA, &iValue)==0)
+ {
+ glCaps->color=iValue?COLOR_RGBA:COLOR_INDEX;
+ } else {
+ fprintf(stderr,"GL4Java: fetching rgba state failed\n");
+ fflush(stderr);
+ }
+
+ if(glXGetConfig( disp, visual, GLX_STEREO, &iValue)==0)
+ {
+ glCaps->stereo=iValue?STEREO_ON:STEREO_OFF;
+ } else {
+ fprintf(stderr,"GL4Java: fetching stereoView state failed\n");
+ fflush(stderr);
+ }
+
+ if(glXGetConfig( disp, visual, GLX_DEPTH_SIZE, &iValue)==0)
+ {
+ glCaps->depthBits = iValue;
+ } else {
+ fprintf(stderr,"GL4Java: fetching depthBits state failed\n");
+ fflush(stderr);
+ }
+
+ if(glXGetConfig( disp, visual, GLX_STENCIL_SIZE, &iValue)==0)
+ {
+ glCaps->stencilBits = iValue;
+ } else {
+ fprintf(stderr,"GL4Java: fetching stencilBits state failed\n");
+ fflush(stderr);
+ }
+
+ if(glXGetConfig(disp,visual,GLX_RED_SIZE, &iValue)==0 &&
+ glXGetConfig(disp,visual,GLX_GREEN_SIZE, &iValue1)==0 &&
+ glXGetConfig(disp,visual,GLX_BLUE_SIZE, &iValue2)==0 &&
+ glXGetConfig(disp,visual,GLX_ALPHA_SIZE, &iValue3)==0 )
+ {
+ glCaps->redBits = iValue;
+ glCaps->greenBits= iValue1;
+ glCaps->blueBits= iValue2;
+ glCaps->alphaBits= iValue3;
+ } else {
+ fprintf(stderr,"GL4Java: fetching rgba Size states failed\n");
+ fflush(stderr);
+ }
+
+ if(glXGetConfig(disp,visual,GLX_ACCUM_RED_SIZE, &iValue)==0 &&
+ glXGetConfig(disp,visual,GLX_ACCUM_GREEN_SIZE, &iValue1)==0 &&
+ glXGetConfig(disp,visual,GLX_ACCUM_BLUE_SIZE, &iValue2)==0 &&
+ glXGetConfig(disp,visual,GLX_ACCUM_ALPHA_SIZE, &iValue3)==0 )
+ {
+ glCaps->accumRedBits = iValue;
+ glCaps->accumGreenBits= iValue1;
+ glCaps->accumBlueBits= iValue2;
+ glCaps->accumAlphaBits= iValue3;
+ } else {
+ fprintf(stderr,"GL4Java: fetching rgba AccumSize states failed\n");
+ fflush(stderr);
+ }
+ glCaps->nativeVisualID=(long)visual->visualid;
+
+ return JNI_TRUE;
+}
+
int LIBAPIENTRY x11gl_myErrorHandler(Display *pDisp, XErrorEvent *p_error)
{
diff --git a/CNativeCode/OpenGL_X11_common.h b/CNativeCode/OpenGL_X11_common.h
index bba3040..1bb39c4 100644
--- a/CNativeCode/OpenGL_X11_common.h
+++ b/CNativeCode/OpenGL_X11_common.h
@@ -24,7 +24,7 @@
int success; /* 1: OK, 0: ERROR */
} VisualGC;
-
+
/*
* prototypes for functions local to this file scope
*/
@@ -33,35 +33,37 @@
GLXContext *gc, GLXContext gc_share,
jboolean verbose );
+ LIBAPI int LIBAPIENTRY setVisualAttribListByGLCapabilities(
+ int visualAttribList[/*>=32*/],
+ GLCapabilities *glCaps );
+
LIBAPI VisualGC LIBAPIENTRY 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,
+ Window rootWin,
+ Window * pWin,
+ int width, int height,
+ GLCapabilities *glCaps,
+ jboolean * pOwnWin,
+ GLXContext shareWith,
+ jboolean offscreen,
+ Pixmap *pix,
jboolean verbose
- );
+ );
LIBAPI void LIBAPIENTRY printVisualInfo ( Display *display, XVisualInfo * vi);
LIBAPI void LIBAPIENTRY printAllVisualInfo ( Display *disp, Window win,
jboolean verbose);
LIBAPI int LIBAPIENTRY testVisualInfo ( Display *display, XVisualInfo * vi,
- int dblBuffer, int stereoView, int rgbaMode,
- int stencilSize, int accumSize);
+ GLCapabilities *glCaps);
+ LIBAPI XVisualInfo * LIBAPIENTRY findVisualIdByID( XVisualInfo ** visualList,
+ int visualID, Display *disp,
+ Window win, jboolean verbose);
+
LIBAPI XVisualInfo * LIBAPIENTRY findVisualIdByFeature(
XVisualInfo ** visualList,
Display *disp, Window win,
- int dblBuffer, int stereoView, int rgbaMode,
- int stencilSize, int accumSize,
+ GLCapabilities *glCaps,
jboolean verbose);
/* testX11Java does important implementation plattformspecific checks:
@@ -70,6 +72,9 @@
*/
LIBAPI jboolean LIBAPIENTRY testX11Java();
+ LIBAPI jboolean LIBAPIENTRY setGLCapabilities ( Display * disp,
+ XVisualInfo * visual, GLCapabilities *glCaps);
+
LIBAPI int LIBAPIENTRY x11gl_myErrorHandler(
Display *pDisp, XErrorEvent *p_error);
diff --git a/CNativeCode/OpenGL_X11_jawt.c b/CNativeCode/OpenGL_X11_jawt.c
index db7cd39..995e31a 100644
--- a/CNativeCode/OpenGL_X11_jawt.c
+++ b/CNativeCode/OpenGL_X11_jawt.c
@@ -162,31 +162,29 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
jfieldID fdisplayHandle=0, fpixmapHandle=0;
jfieldID fverbose=0;
jfieldID fglContext=0;
- jfieldID fstereoView=0, frgba=0, fstencilBits=0,
- faccumSize=0, fownwind=0;
- jfieldID fdoubleBuffer=0, foffScreenRenderer=0;
+
+ jfieldID fglCaps=0;
+ jfieldID foffScreenRenderer=0, fownwind=0;
jfieldID fcreatewinw = 0, fcreatewinh = 0;
jfieldID fshareWith = 0;
jboolean joffScreenRenderer=JNI_FALSE;
- jboolean jdoubleBuffer=JNI_TRUE;
- jboolean jstereoView=JNI_FALSE;
- jboolean jrgba=JNI_TRUE;
- jint jstencilBits=0;
- jint jaccumSize=0;
jboolean jownwind = JNI_FALSE ;
jint jcreatewinw = 0, jcreatewinh = 0;
GLXContext jshareWith = 0;
+ jobject jglCaps=0;
+ GLCapabilities glCaps;
+
/* these variables will be mapped in the java-object ! */
JAWTDataHolder * pData = NULL;
Display * display = 0;
Window rootwini = 0;
Window theWindow = 0;
Pixmap pix=0;
- jclass AwtComponent = (*env)->FindClass(env, "Ljava/awt/Component;");
-
- int iValue=0, iValue1=0, iValue2=0, iValue3=0;
+ jthrowable exc;
+ jclass _GLCapabilities= 0;
+ jclass _AwtComponent=0;
cls = (*env)->GetObjectClass(env, obj);
if(cls==0)
@@ -227,33 +225,39 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
}
if(ret==JNI_TRUE) {
- fdoubleBuffer = (*env)->GetFieldID(env, cls, "doubleBuffer", "Z");
- if (fdoubleBuffer == 0) ret= JNI_FALSE;
- else jdoubleBuffer =(*env)->GetBooleanField(env, obj, fdoubleBuffer);
- }
-
- if(ret==JNI_TRUE) {
- fstereoView = (*env)->GetFieldID(env, cls, "stereoView", "Z");
- if (fstereoView == 0) ret= JNI_FALSE;
- else jstereoView =(*env)->GetBooleanField(env, obj, fstereoView);
+ fglCaps = (*env)->GetFieldID(env, cls, "glCaps", "Lgl4java/GLCapabilities;");
+ if (fglCaps == 0) ret= JNI_FALSE;
+ else jglCaps =(*env)->GetObjectField(env, obj, fglCaps);
}
- if(ret==JNI_TRUE) {
- frgba = (*env)->GetFieldID(env, cls, "rgba", "Z");
- if (frgba == 0) ret= JNI_FALSE;
- else jrgba =(*env)->GetBooleanField(env, obj, frgba);
+ _GLCapabilities= (*env)->FindClass(env, "Lgl4java/GLCapabilities;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: openOpen FindClass gl4java/GLCapabilities failed, cannot check glCaps object\n");
+ (*env)->ExceptionDescribe(env);
+ fflush(stderr);
+ }
+ (*env)->ExceptionClear(env);
+ _GLCapabilities=0;
}
+ exc=0;
- if(ret==JNI_TRUE) {
- fstencilBits = (*env)->GetFieldID(env, cls, "stencilBits", "I");
- if (fstencilBits == 0) ret= JNI_FALSE;
- else jstencilBits =(*env)->GetIntField(env, obj, fstencilBits);
+ if( _GLCapabilities!=0 &&
+ (*env)->IsInstanceOf(env, jglCaps, _GLCapabilities)==JNI_FALSE )
+ {
+ fprintf(stderr,"\nGL4Java openOpenGL ERROR: glCaps is not instanceof gl4java/GLCapabilities !\n");
+ fflush(stderr);
+ return JNI_FALSE;
}
- if(ret==JNI_TRUE) {
- faccumSize = (*env)->GetFieldID(env, cls, "accumSize", "I");
- if (faccumSize == 0) ret= JNI_FALSE;
- else jaccumSize =(*env)->GetIntField(env, obj, faccumSize);
+ if(JNI_TRUE != javaGLCapabilities2NativeGLCapabilities
+ ( env, jglCaps, &glCaps ) )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: glCaps Object is not valid !\n");
+ fflush(stderr);
+ return JNI_FALSE;
}
if(ret==JNI_TRUE) {
@@ -302,14 +306,6 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
jownwind = JNI_FALSE;
}
- if(JNI_TRUE==verbose)
- {
- fprintf(stderr,"\nGL4Java: (try to use visuals: doubleBuffer=%d, stereoView=%d, rgba=%d, stencilBits=%d, accumSize=%d, ownWindow=%d)\n)\n",
- (int)jdoubleBuffer, (int)jstereoView, (int)jrgba, (int)jstencilBits, (int)jaccumSize,
- (int)jownwind );
- fflush(stderr);
- }
-
if(ret==JNI_TRUE) {
fdisplayHandle = (*env)->GetFieldID(env, cls, "displayHandle", "J");
if (fdisplayHandle == 0) ret= JNI_FALSE;
@@ -320,6 +316,20 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
if (fglContext == 0) ret= JNI_FALSE;
}
+ _AwtComponent= (*env)->FindClass(env, "Ljava/awt/Component;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ if(JNI_TRUE==verbose)
+ {
+ fprintf(stderr, "GL4Java: openOpen FindClass java/awt/Component failed, cannot check canvas object\n");
+ (*env)->ExceptionDescribe(env);
+ fflush(stderr);
+ }
+ (*env)->ExceptionClear(env);
+ _AwtComponent=0;
+ }
+ exc=0;
+
if(ret==JNI_TRUE) {
if (canvas == 0)
{
@@ -327,7 +337,8 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
fprintf(stderr,"\nGL4Java ERROR: canvas == NULL !\n");
fflush(stderr);
} else {
- if( (*env)->IsInstanceOf(env, canvas, AwtComponent)==JNI_FALSE )
+ if( _AwtComponent!=0 &&
+ (*env)->IsInstanceOf(env, canvas, _AwtComponent)==JNI_FALSE)
{
fprintf(stderr,"\nGL4Java ERROR: canvas is not instanceof java/awt/Component !\n");
fflush(stderr);
@@ -391,6 +402,14 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
}
}
+ /*
+ if(ret==JNI_TRUE)
+ XSetErrorHandler(x11gl_myErrorHandler);
+
+ if(ret==JNI_TRUE)
+ XSetIOErrorHandler(x11gl_myIOErrorHandler);
+ */
+
if(JNI_TRUE==ret && JNI_TRUE==verbose)
{
if(joffScreenRenderer==JNI_TRUE)
@@ -416,6 +435,7 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
fprintf(stdout, "GLX by %s Version %s\n",
glXGetClientString(display, GLX_VENDOR),
glXGetClientString(display, GLX_VERSION));
+ fflush(stdout);
}
}
}
@@ -430,18 +450,21 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
vgc = findVisualGlX( display, rootwini, &theWindow,
(int)jcreatewinw, (int)jcreatewinh,
- jdoubleBuffer, jstereoView, jrgba,
- jstencilBits, jaccumSize,
+ &glCaps,
&jownwind, jshareWith,
joffScreenRenderer, &pix, verbose);
- if(vgc.success == 0 && jrgba==JNI_TRUE)
+ if(vgc.success == 0 && glCaps.color==COLOR_RGBA)
{
- jrgba=JNI_FALSE;
+ if (JNI_TRUE==verbose) {
+ fprintf(stdout, "GL4Java switching color:=COLOR_INDEX\n");
+ fflush(stdout);
+ }
+ glCaps.color=COLOR_INDEX;
+
vgc = findVisualGlX( display, rootwini, &theWindow,
(int)jcreatewinw, (int)jcreatewinh,
- jdoubleBuffer, jstereoView, jrgba,
- jstencilBits, jaccumSize,
+ &glCaps,
&jownwind, jshareWith,
joffScreenRenderer, &pix, verbose);
}
@@ -465,104 +488,18 @@ Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
pData->dsi_win_created=1;
}
- if(glXGetConfig( display, vgc.visual,
- GLX_DOUBLEBUFFER, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"doubleBuffer: %d\n", iValue);
- fflush(stdout);
- }
- jdoubleBuffer=iValue?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && fdoubleBuffer!=0) {
- (*env)->SetBooleanField(env, obj, fdoubleBuffer,
- jdoubleBuffer);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching doubleBuffer state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,
- GLX_STEREO, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"stereoView: %d\n", iValue);
- fflush(stdout);
- }
- jstereoView=iValue?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && fstereoView!=0) {
- (*env)->SetBooleanField(env, obj, fstereoView,
- jstereoView);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching stereoView state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,
- GLX_RGBA, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"rgba: %d\n", iValue);
- fflush(stdout);
- }
- jrgba=iValue?JNI_TRUE:JNI_FALSE;
- if(ret==JNI_TRUE && frgba!=0) {
- (*env)->SetBooleanField(env, obj, frgba,
- jrgba);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching rgba state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,
- GLX_STENCIL_SIZE, &iValue)==0)
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"stencilBits: %d\n", iValue);
- fflush(stdout);
- }
- jstencilBits=iValue;
- if(ret==JNI_TRUE && fstencilBits!=0) {
- (*env)->SetIntField(env, obj,
- fstencilBits, (jint)jstencilBits);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching stencilBits state failed\n");
- fflush(stderr);
- }
- if(glXGetConfig( display, vgc.visual,GLX_ACCUM_RED_SIZE, &iValue)==0 &&
- glXGetConfig( display, vgc.visual,GLX_ACCUM_GREEN_SIZE, &iValue1)==0 &&
- glXGetConfig( display, vgc.visual,GLX_ACCUM_BLUE_SIZE, &iValue2)==0 &&
- glXGetConfig( display, vgc.visual,GLX_ACCUM_ALPHA_SIZE, &iValue3)==0 )
- {
- if (JNI_TRUE==verbose) {
- fprintf(stdout,"accumSize(red): %d\n", iValue);
- fprintf(stdout,"accumSize(green): %d\n", iValue1);
- fprintf(stdout,"accumSize(blue): %d\n", iValue2);
- fprintf(stdout,"accumSize(alpha): %d\n", iValue3);
- fflush(stdout);
- }
- jaccumSize=iValue+iValue1+iValue2+iValue3;
- if(ret==JNI_TRUE && faccumSize!=0) {
- (*env)->SetIntField(env, obj,
- faccumSize, (jint)jaccumSize);
- }
-
- } else {
- fprintf(stderr,"GL4Java: fetching accumSize(red) state failed\n");
- fflush(stderr);
- }
if(JNI_TRUE==verbose)
{
- fprintf(stderr,"\nGL4Java: (using visuals: doubleBuffer=%d, stereoView=%d, rgba=%d, stencilBits=%d, accumSize=%d, ownWindow=%d)\n)\n",
- (int)jdoubleBuffer, (int)jstereoView, (int)jrgba,
- (int)jstencilBits, (int)jaccumSize, (int)jownwind);
- fflush(stderr);
+ fprintf(stdout,"\nGL4Java: writing capabilities to GLContext's java object\n");
+ fflush(stdout);
}
+ (void) nativeGLCapabilities2JavaGLCapabilities
+ (env, jglCaps, &glCaps);
+
+ if(ret==JNI_TRUE && fglCaps) {
+ (*env)->SetObjectField(env, obj, fglCaps, jglCaps);
+ }
}
}
@@ -699,7 +636,6 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj,
GET_USED_WINDOW(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);
jawt_close_unlock(env, pData, JNI_FALSE);
@@ -960,3 +896,4 @@ Java_gl4java_GLContext_gljSwapNative( JNIEnv *env, jobject obj,
return JNI_TRUE;
}
+
diff --git a/CNativeCode/OpenGL_misc.c b/CNativeCode/OpenGL_misc.c
index 5f9d502..201a048 100644
--- a/CNativeCode/OpenGL_misc.c
+++ b/CNativeCode/OpenGL_misc.c
@@ -31,6 +31,250 @@ static const char * _lib_version_= __LIB_VERSION__ ;
#define CALLBACK
#endif
+
+#ifdef J_GET_INT_FIELD
+ #undef J_GET_INT_FIELD
+#endif
+#define J_GET_INT_FIELD(ATTRIBUTE_NAME, ATTRIBUTE_NAME_STR) if(ok==JNI_TRUE) { f ## ATTRIBUTE_NAME = (*env)->GetFieldID(env, cls, ATTRIBUTE_NAME_STR, "I"); if ( f ## ATTRIBUTE_NAME == 0) ok= JNI_FALSE; }
+
+#ifdef J_GET_INT_FIELD_VAL
+ #undef J_GET_INT_FIELD_VAL
+#endif
+#define J_GET_INT_FIELD_VAL(ATTRIBUTE_NAME, ATTRIBUTE_NAME_STR) if(ok==JNI_TRUE) { f ## ATTRIBUTE_NAME = (*env)->GetFieldID(env, cls, ATTRIBUTE_NAME_STR, "I"); if ( f ## ATTRIBUTE_NAME == 0) ok= JNI_FALSE; else glCaps-> ## ATTRIBUTE_NAME = (int) ((*env)->GetIntField(env, capsObj, f ## ATTRIBUTE_NAME)); }
+
+#ifdef J_SET_INT_FIELD_VAL
+ #undef J_SET_INT_FIELD_VAL
+#endif
+#define J_SET_INT_FIELD_VAL(ATTRIBUTE_NAME) if(ok==JNI_TRUE && f ## ATTRIBUTE_NAME!=0) { (*env)->SetIntField(env, capsObj, f ## ATTRIBUTE_NAME, (jint) glCaps-> ## ATTRIBUTE_NAME); }
+
+#ifdef J_GET_LONG_FIELD
+ #undef J_GET_LONG_FIELD
+#endif
+#define J_GET_LONG_FIELD(ATTRIBUTE_NAME, ATTRIBUTE_NAME_STR) if(ok==JNI_TRUE) { f ## ATTRIBUTE_NAME = (*env)->GetFieldID(env, cls, ATTRIBUTE_NAME_STR, "J"); if ( f ## ATTRIBUTE_NAME == 0) ok= JNI_FALSE; }
+
+
+#ifdef J_GET_LONG_FIELD_VAL
+ #undef J_GET_LONG_FIELD_VAL
+#endif
+#define J_GET_LONG_FIELD_VAL(ATTRIBUTE_NAME, ATTRIBUTE_NAME_STR) if(ok==JNI_TRUE) { f ## ATTRIBUTE_NAME = (*env)->GetFieldID(env, cls, ATTRIBUTE_NAME_STR, "J"); if ( f ## ATTRIBUTE_NAME == 0) ok= JNI_FALSE; else glCaps-> ## ATTRIBUTE_NAME = (long) ((*env)->GetLongField(env, capsObj, f ## ATTRIBUTE_NAME)); }
+
+#ifdef J_SET_LONG_FIELD_VAL
+ #undef J_SET_LONG_FIELD_VAL
+#endif
+#define J_SET_LONG_FIELD_VAL(ATTRIBUTE_NAME) if(ok==JNI_TRUE && f ## ATTRIBUTE_NAME!=0) { (*env)->SetLongField(env, capsObj, f ## ATTRIBUTE_NAME, (jlong) glCaps-> ## ATTRIBUTE_NAME); }
+
+jboolean LIBAPIENTRY javaGLCapabilities2NativeGLCapabilities
+ ( JNIEnv *env,
+ jobject capsObj,
+ GLCapabilities *glCaps )
+{
+ jfieldID fbuffer=0;
+ jfieldID fcolor=0;
+ jfieldID fstereo=0;
+ jfieldID fdepthBits=0;
+ jfieldID fstencilBits=0;
+ jfieldID fredBits=0;
+ jfieldID fgreenBits=0;
+ jfieldID fblueBits=0;
+ jfieldID falphaBits=0;
+ jfieldID faccumRedBits=0;
+ jfieldID faccumGreenBits=0;
+ jfieldID faccumBlueBits=0;
+ jfieldID faccumAlphaBits=0;
+ jfieldID fnativeVisualID=0;
+
+ jclass cls = 0;
+
+ jboolean ok = JNI_TRUE;
+
+ /**
+ *
+ jthrowable exc;
+ jclass _GLCapabilities= 0;
+
+ _GLCapabilities= (*env)->FindClass(env, "Lgl4java/GLCapabilities;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ fprintf(stderr, "GL4Java: glcaps java2native FindClass gl4java/GLCapabilities failed, cannot check glCaps object\n");
+ (*env)->ExceptionClear(env);
+ fflush(stderr);
+ _GLCapabilities=0;
+ }
+ exc=0;
+
+
+ if(_GLCapabilities!=0 &&
+ (*env)->IsInstanceOf(env, capsObj, _GLCapabilities)==JNI_FALSE )
+ {
+ fprintf(stderr,"\nGL4Java glcaps java2native ERROR: capsObj is not instanceof gl4java/GLCapabilities !\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+ */
+
+ cls = (*env)->GetObjectClass(env, capsObj);
+ if(cls==0)
+ {
+ fprintf(stderr,"GL4Java ERROR: clazz not accessible\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ if(glCaps==0)
+ {
+ fprintf(stderr,"GL4Java ERROR: native argument GLCapabilities not given\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ J_GET_INT_FIELD_VAL(buffer, "buffer")
+ J_GET_INT_FIELD_VAL(color, "color")
+ J_GET_INT_FIELD_VAL(stereo, "stereo")
+ J_GET_INT_FIELD_VAL(depthBits, "depthBits")
+ J_GET_INT_FIELD_VAL(stencilBits, "stencilBits")
+ J_GET_INT_FIELD_VAL(redBits, "redBits")
+ J_GET_INT_FIELD_VAL(greenBits, "greenBits")
+ J_GET_INT_FIELD_VAL(blueBits, "blueBits")
+ J_GET_INT_FIELD_VAL(alphaBits, "alphaBits")
+ J_GET_INT_FIELD_VAL(accumRedBits, "accumRedBits")
+ J_GET_INT_FIELD_VAL(accumGreenBits, "accumGreenBits")
+ J_GET_INT_FIELD_VAL(accumBlueBits, "accumBlueBits")
+ J_GET_INT_FIELD_VAL(accumAlphaBits, "accumAlphaBits")
+ J_GET_LONG_FIELD_VAL(nativeVisualID, "nativeVisualID")
+
+ if(JNI_TRUE!=ok)
+ {
+ fprintf(stderr,"GL4Java ERROR: gl4java/GLCapabilities fields not accessible\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ return JNI_TRUE;
+}
+
+jboolean LIBAPIENTRY nativeGLCapabilities2JavaGLCapabilities
+ ( JNIEnv *env,
+ jobject capsObj,
+ GLCapabilities *glCaps )
+{
+ jfieldID fbuffer=0;
+ jfieldID fcolor=0;
+ jfieldID fstereo=0;
+ jfieldID fdepthBits=0;
+ jfieldID fstencilBits=0;
+ jfieldID fredBits=0;
+ jfieldID fgreenBits=0;
+ jfieldID fblueBits=0;
+ jfieldID falphaBits=0;
+ jfieldID faccumRedBits=0;
+ jfieldID faccumGreenBits=0;
+ jfieldID faccumBlueBits=0;
+ jfieldID faccumAlphaBits=0;
+ jfieldID fnativeVisualID=0;
+
+ jclass cls = 0;
+
+ jboolean ok = JNI_TRUE;
+
+ /**
+ jthrowable exc;
+ jclass _GLCapabilities= 0;
+
+ _GLCapabilities= (*env)->FindClass(env, "Lgl4java/GLCapabilities;");
+ exc = (*env)->ExceptionOccurred(env);
+ if(exc) {
+ fprintf(stderr, "GL4Java: glcaps native2java FindClass gl4java/GLCapabilities failed, cannot check glCaps object\n");
+ (*env)->ExceptionClear(env);
+ fflush(stderr);
+ _GLCapabilities=0;
+ }
+ exc=0;
+
+
+ if(_GLCapabilities!=0 &&
+ (*env)->IsInstanceOf(env, capsObj, _GLCapabilities)==JNI_FALSE )
+ {
+ fprintf(stderr,"\nGL4Java glcaps native2java ERROR: capsObj is not instanceof gl4java/GLCapabilities !\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+ */
+
+ cls = (*env)->GetObjectClass(env, capsObj);
+ if(cls==0)
+ {
+ fprintf(stderr,"GL4Java ERROR: clazz not accessible\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ J_GET_INT_FIELD(buffer, "buffer")
+ J_GET_INT_FIELD(color, "color")
+ J_GET_INT_FIELD(stereo, "stereo")
+ J_GET_INT_FIELD(depthBits, "depthBits")
+ J_GET_INT_FIELD(stencilBits, "stencilBits")
+ J_GET_INT_FIELD(redBits, "redBits")
+ J_GET_INT_FIELD(greenBits, "greenBits")
+ J_GET_INT_FIELD(blueBits, "blueBits")
+ J_GET_INT_FIELD(alphaBits, "alphaBits")
+ J_GET_INT_FIELD(accumRedBits, "accumRedBits")
+ J_GET_INT_FIELD(accumGreenBits, "accumGreenBits")
+ J_GET_INT_FIELD(accumBlueBits, "accumBlueBits")
+ J_GET_INT_FIELD(accumAlphaBits, "accumAlphaBits")
+ J_GET_LONG_FIELD(nativeVisualID, "nativeVisualID")
+
+ if(JNI_TRUE!=ok)
+ {
+ fprintf(stderr,"GL4Java ERROR: gl4java/GLCapabilities fields not accessible\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ J_SET_INT_FIELD_VAL(buffer);
+ J_SET_INT_FIELD_VAL(color);
+ J_SET_INT_FIELD_VAL(stereo);
+ J_SET_INT_FIELD_VAL(depthBits);
+ J_SET_INT_FIELD_VAL(stencilBits);
+ J_SET_INT_FIELD_VAL(redBits);
+ J_SET_INT_FIELD_VAL(greenBits);
+ J_SET_INT_FIELD_VAL(blueBits);
+ J_SET_INT_FIELD_VAL(alphaBits);
+ J_SET_INT_FIELD_VAL(accumRedBits);
+ J_SET_INT_FIELD_VAL(accumGreenBits);
+ J_SET_INT_FIELD_VAL(accumBlueBits);
+ J_SET_INT_FIELD_VAL(accumAlphaBits);
+ J_GET_LONG_FIELD_VAL(nativeVisualID, "nativeVisualID")
+
+ if(JNI_TRUE!=ok)
+ {
+ fprintf(stderr,"GL4Java ERROR: gl4java/GLCapabilities fields not writable\n");
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ return JNI_TRUE;
+}
+
+void LIBAPIENTRY printGLCapabilities ( GLCapabilities *glCaps )
+{
+ fprintf(stdout, "\t doubleBuff: %d, ", (int)glCaps->buffer);
+ fprintf(stdout, " rgba: %d, ", (int)glCaps->color);
+ fprintf(stdout, " stereo: %d, ", (int)glCaps->stereo);
+ fprintf(stdout, " depthSize: %d, ", (int)glCaps->depthBits);
+ fprintf(stdout, " stencilSize: %d !\n", (int)glCaps->stencilBits);
+ fprintf(stdout, "\t red: %d, ", (int)glCaps->redBits);
+ fprintf(stdout, " green: %d, ", (int)glCaps->greenBits);
+ fprintf(stdout, " blue: %d, ", (int)glCaps->blueBits);
+ fprintf(stdout, " alpha: %d !\n", (int)glCaps->alphaBits);
+ fprintf(stdout, "\t red accum: %d, ", (int)glCaps->accumRedBits);
+ fprintf(stdout, " green accum: %d, ", (int)glCaps->accumGreenBits);
+ fprintf(stdout, " blue accum: %d, ", (int)glCaps->accumBlueBits);
+ fprintf(stdout, " alpha accum: %d !\n", (int)glCaps->accumAlphaBits);
+ fprintf(stdout, "\t nativeVisualID: %ld !\n", (long)glCaps->nativeVisualID);
+
+ fflush(stdout);
+}
+
jboolean LIBAPIENTRY testJavaGLTypes(jboolean verbose)
{
jboolean ret=JNI_TRUE;
diff --git a/CNativeCode/OpenGL_misc.h b/CNativeCode/OpenGL_misc.h
index 368e2f7..1438877 100644
--- a/CNativeCode/OpenGL_misc.h
+++ b/CNativeCode/OpenGL_misc.h
@@ -28,6 +28,60 @@
typedef long PointerHolder;
#endif
+ /* to match the GLCapabilities values .. */
+
+ #define BUFFER_SINGLE 0
+ #define BUFFER_DOUBLE 1
+
+ #define COLOR_INDEX 0
+ #define COLOR_RGBA 1
+
+ #define STEREO_OFF 0
+ #define STEREO_ON 1
+
+ typedef struct {
+ jint buffer;
+ jint color;
+ jint stereo;
+ jint depthBits;
+ jint stencilBits;
+
+ jint redBits;
+ jint greenBits;
+ jint blueBits;
+ jint alphaBits;
+ jint accumRedBits;
+ jint accumGreenBits;
+ jint accumBlueBits;
+ jint accumAlphaBits;
+
+ jlong nativeVisualID;
+ } GLCapabilities;
+
+ /**
+ * gets the capabilities outta java's GLCapabilities object 'capsObj'
+ * and puts those values to the C-Struct GLCapabilities !
+ */
+ LIBAPI jboolean LIBAPIENTRY javaGLCapabilities2NativeGLCapabilities
+ ( JNIEnv *env,
+ jobject capsObj,
+ GLCapabilities *glCaps );
+
+ /**
+ * gets the capabilities outta the C-Struct GLCapabilities
+ * and puts those values to java's GLCapabilities object 'capsObj'
+ */
+ LIBAPI jboolean LIBAPIENTRY nativeGLCapabilities2JavaGLCapabilities
+ ( JNIEnv *env,
+ jobject capsObj,
+ GLCapabilities *glCaps );
+
+
+ /**
+ * prints the contents of the GLCapabilities to stdout !
+ */
+ LIBAPI void LIBAPIENTRY printGLCapabilities ( GLCapabilities *glCaps );
+
/* testJavaGLTypes does important implementation plattformspecific checks:
*
* o do fit the JNI <-> GL Variables-Type Mapping
diff --git a/CNativeCode/jawt_misc.c b/CNativeCode/jawt_misc.c
index 4696773..d884406 100644
--- a/CNativeCode/jawt_misc.c
+++ b/CNativeCode/jawt_misc.c
@@ -338,12 +338,12 @@ jawt_unlock (JNIEnv *env, JAWTDataHolder *pJData, jboolean verbose)
}
pJData->dsi=0;
- // Unlock the drawing surface
- if ( (pJData->lock & JAWT_LOCK_ERROR) == 0 )
+ // Unlock the drawing surface
+ if ( (pJData->lock & JAWT_LOCK_ERROR) == 0 )
{
pJData->ds->Unlock(pJData->ds);
exc = (*env)->ExceptionOccurred(env);
- if(exc)
+ if(exc)
{
if(verbose)
{
@@ -355,11 +355,9 @@ jawt_unlock (JNIEnv *env, JAWTDataHolder *pJData, jboolean verbose)
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
return pJData->result;
- }
- pJData->lock = 0;
+ }
+ pJData->lock = 0;
}
return JNI_TRUE;
}
-
-
diff --git a/Installer/makeMSIESignedCab.sh b/Installer/makeMSIESignedCab.sh
index dc6b205..8338132 100755
--- a/Installer/makeMSIESignedCab.sh
+++ b/Installer/makeMSIESignedCab.sh
@@ -15,5 +15,5 @@ rm -f *.class GL4JInst.cab
//D/MSJAVASDK/Bin/cabarc N GL4JInst.cab *.class
# signcode -j javasign.dll -jp low -spc GL4JInst.spc -k GL4JInst GL4JInst.cab
-//D/MSJAVASDK/Bin/signcode -j javasign.dll -jp low -spc GL4JInst205.spc -v GL4JInst205.pvk GL4JInst.cab
+//D/MSJAVASDK/Bin/signcode -j javasign.dll -jp low -spc GL4JInst206.spc -v GL4JInst206.pvk GL4JInst.cab
rm *.class
diff --git a/Installer/makeMScert.sh b/Installer/makeMScert.sh
index daf8858..e652f0b 100755
--- a/Installer/makeMScert.sh
+++ b/Installer/makeMScert.sh
@@ -1,7 +1,7 @@
#! /bin/sh
# The Microsft signing keys were created using the Microsoft makecert and
-//D/MSJAVASDK/Bin/makecert -nscp -r -n CN=GL4JInst205 GL4JInst205.cer -sv GL4JInst205.pvk
+//D/MSJAVASDK/Bin/makecert -nscp -r -n CN=GL4JInst206 GL4JInst206.cer -sv GL4JInst206.pvk
# (when prompted for a password, click "None")
-//D/MSJAVASDK/Bin/cert2spc GL4JInst205.cer GL4JInst205.spc
+//D/MSJAVASDK/Bin/cert2spc GL4JInst206.cer GL4JInst206.spc
diff --git a/Installer/makeNetscapeSignedJar-Unix.sh b/Installer/makeNetscapeSignedJar-Unix.sh
index e59193b..2a1f385 100755
--- a/Installer/makeNetscapeSignedJar-Unix.sh
+++ b/Installer/makeNetscapeSignedJar-Unix.sh
@@ -27,7 +27,7 @@ javac -classpath ".:../capsapi_classes.zip" *.java
. versionundef.sh
rm -rf META-INF
-signtool -d . -e .class -k GL4JInst206a -Z GL4JInst_ns.jar -c9 --norecurse .
+signtool -d . -e .class -k GL4JInst206b -Z GL4JInst_ns.jar -c9 --norecurse .
rm -rf META-INF
rm -f key3.db cert7.db *.class
diff --git a/Installer/versiondef.sh b/Installer/versiondef.sh
index 413c39c..79a6461 100644
--- a/Installer/versiondef.sh
+++ b/Installer/versiondef.sh
@@ -1,6 +1,6 @@
MAJV=2
-MINV=5
-BUGV=2
+MINV=6
+BUGV=0
RELV=0
echo creating installer for version $MAJV.$MINV.$BUGV.$RELV !
diff --git a/Win32VC6/GL4JavaJauGLJNI/GL4JavaJauGLJNI.plg b/Win32VC6/GL4JavaJauGLJNI/GL4JavaJauGLJNI.plg
index ee41548..fc6c36b 100755
--- a/Win32VC6/GL4JavaJauGLJNI/GL4JavaJauGLJNI.plg
+++ b/Win32VC6/GL4JavaJauGLJNI/GL4JavaJauGLJNI.plg
@@ -6,19 +6,19 @@
--------------------Konfiguration: GL4JavaJauGLJNI - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP37.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1F3.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNI_dynfuncs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP37.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP38.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1F3.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1F4.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNI.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNI.dll" /implib:"../libs/GL4JavaJauGLJNI.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNI_dynfuncs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP38.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1F4.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGL_JauJNI_dynfuncs.c
diff --git a/Win32VC6/GL4JavaJauGLJNI12/GL4JavaJauGLJNI12.plg b/Win32VC6/GL4JavaJauGLJNI12/GL4JavaJauGLJNI12.plg
index f3409a6..1d40006 100755
--- a/Win32VC6/GL4JavaJauGLJNI12/GL4JavaJauGLJNI12.plg
+++ b/Win32VC6/GL4JavaJauGLJNI12/GL4JavaJauGLJNI12.plg
@@ -6,19 +6,19 @@
--------------------Konfiguration: GL4JavaJauGLJNI12 - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP3C.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1EE.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNI12_dynfuncs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP3C.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP3D.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1EE.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1EF.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNI12.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNI12.dll" /implib:"../libs/GL4JavaJauGLJNI12.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNI12_dynfuncs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP3D.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1EF.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGL_JauJNI12_dynfuncs.c
diff --git a/Win32VC6/GL4JavaJauGLJNI12tst/GL4JavaJauGLJNI12tst.plg b/Win32VC6/GL4JavaJauGLJNI12tst/GL4JavaJauGLJNI12tst.plg
index 5e12f4c..b922f3b 100755
--- a/Win32VC6/GL4JavaJauGLJNI12tst/GL4JavaJauGLJNI12tst.plg
+++ b/Win32VC6/GL4JavaJauGLJNI12tst/GL4JavaJauGLJNI12tst.plg
@@ -6,19 +6,19 @@
--------------------Konfiguration: GL4JavaJauGLJNI12tst - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP41.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1E9.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNI12tst_dynfuncs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP41.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP42.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1E9.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1EA.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNI12tst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNI12tst.dll" /implib:"../libs/GL4JavaJauGLJNI12tst.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNI12tst_dynfuncs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP42.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1EA.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGL_JauJNI12tst_dynfuncs.c
diff --git a/Win32VC6/GL4JavaJauGLJNInf/GL4JavaJauGLJNInf.plg b/Win32VC6/GL4JavaJauGLJNInf/GL4JavaJauGLJNInf.plg
index eba5d24..3642464 100755
--- a/Win32VC6/GL4JavaJauGLJNInf/GL4JavaJauGLJNInf.plg
+++ b/Win32VC6/GL4JavaJauGLJNInf/GL4JavaJauGLJNInf.plg
@@ -6,19 +6,19 @@
--------------------Konfiguration: GL4JavaJauGLJNInf - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP46.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1E4.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNInf_dynfuncs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP46.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP47.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1E4.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1E5.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNInf.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNInf.dll" /implib:"../libs/GL4JavaJauGLJNInf.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNInf_dynfuncs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP47.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1E5.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGL_JauJNInf_dynfuncs.c
diff --git a/Win32VC6/GL4JavaJauGLJNItst/GL4JavaJauGLJNItst.plg b/Win32VC6/GL4JavaJauGLJNItst/GL4JavaJauGLJNItst.plg
index 51f5fed..99088a5 100755
--- a/Win32VC6/GL4JavaJauGLJNItst/GL4JavaJauGLJNItst.plg
+++ b/Win32VC6/GL4JavaJauGLJNItst/GL4JavaJauGLJNItst.plg
@@ -6,19 +6,19 @@
--------------------Konfiguration: GL4JavaJauGLJNItst - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP4B.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1DF.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNItst_dynfuncs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP4B.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP4C.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1DF.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1E0.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNItst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNItst.dll" /implib:"../libs/GL4JavaJauGLJNItst.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNItst_dynfuncs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP4C.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1E0.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGL_JauJNItst_dynfuncs.c
diff --git a/Win32VC6/GL4JavaJauGLUJNI/GL4JavaJauGLUJNI.plg b/Win32VC6/GL4JavaJauGLUJNI/GL4JavaJauGLUJNI.plg
index 8f37e76..79ef140 100755
--- a/Win32VC6/GL4JavaJauGLUJNI/GL4JavaJauGLUJNI.plg
+++ b/Win32VC6/GL4JavaJauGLUJNI/GL4JavaJauGLUJNI.plg
@@ -6,26 +6,23 @@
--------------------Konfiguration: GL4JavaJauGLUJNI - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP50.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1DA.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLUCallbackJNI.c"
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNI_funcs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP50.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP51.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1DA.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1DB.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNI.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNI.dll" /implib:"../libs/GL4JavaJauGLUJNI.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNI_funcs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP51.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1DB.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
-GLUCallbackJNI.c
OpenGLU_JauJNI_funcs.c
-Generieren von Code...
Linker-Vorgang l�uft...
Bibliothek ../libs/GL4JavaJauGLUJNI.lib und Objekt ../libs/GL4JavaJauGLUJNI.exp wird erstellt
diff --git a/Win32VC6/GL4JavaJauGLUJNI12/GL4JavaJauGLUJNI12.plg b/Win32VC6/GL4JavaJauGLUJNI12/GL4JavaJauGLUJNI12.plg
index 689206e..c97e870 100755
--- a/Win32VC6/GL4JavaJauGLUJNI12/GL4JavaJauGLUJNI12.plg
+++ b/Win32VC6/GL4JavaJauGLUJNI12/GL4JavaJauGLUJNI12.plg
@@ -6,20 +6,20 @@
--------------------Konfiguration: GL4JavaJauGLUJNI12 - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP55.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1D5.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNI12_funcs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP55.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP56.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1D5.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1D6.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNI12.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNI12.dll" /implib:"../libs/GL4JavaJauGLUJNI12.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNI12_funcs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP56.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1D6.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGLU_JauJNI12_funcs.c
diff --git a/Win32VC6/GL4JavaJauGLUJNI12tst/GL4JavaJauGLUJNI12tst.plg b/Win32VC6/GL4JavaJauGLUJNI12tst/GL4JavaJauGLUJNI12tst.plg
index 81dd3d0..2981923 100755
--- a/Win32VC6/GL4JavaJauGLUJNI12tst/GL4JavaJauGLUJNI12tst.plg
+++ b/Win32VC6/GL4JavaJauGLUJNI12tst/GL4JavaJauGLUJNI12tst.plg
@@ -6,20 +6,20 @@
--------------------Konfiguration: GL4JavaJauGLUJNI12tst - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP5A.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1D0.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNI12tst_funcs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP5A.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP5B.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1D0.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1D1.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNI12tst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNI12tst.dll" /implib:"../libs/GL4JavaJauGLUJNI12tst.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNI12tst_funcs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP5B.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1D1.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGLU_JauJNI12tst_funcs.c
diff --git a/Win32VC6/GL4JavaJauGLUJNInf/GL4JavaJauGLUJNI.plg b/Win32VC6/GL4JavaJauGLUJNInf/GL4JavaJauGLUJNI.plg
index 37c8a7d..4aadec1 100755
--- a/Win32VC6/GL4JavaJauGLUJNInf/GL4JavaJauGLUJNI.plg
+++ b/Win32VC6/GL4JavaJauGLUJNInf/GL4JavaJauGLUJNI.plg
@@ -6,20 +6,20 @@
--------------------Konfiguration: GL4JavaJauGLUJNInf - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP5F.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1CB.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNInf_funcs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP5F.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP60.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1CB.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1CC.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNInf.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNInf.dll" /implib:"../libs/GL4JavaJauGLUJNInf.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNInf_funcs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP60.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1CC.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGLU_JauJNInf_funcs.c
diff --git a/Win32VC6/GL4JavaJauGLUJNItst/GL4JavaJauGLUJNItst.plg b/Win32VC6/GL4JavaJauGLUJNItst/GL4JavaJauGLUJNItst.plg
index cfdc04c..86f9aa6 100755
--- a/Win32VC6/GL4JavaJauGLUJNItst/GL4JavaJauGLUJNItst.plg
+++ b/Win32VC6/GL4JavaJauGLUJNItst/GL4JavaJauGLUJNItst.plg
@@ -6,20 +6,20 @@
--------------------Konfiguration: GL4JavaJauGLUJNItst - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP64.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C6.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNItst_funcs.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP64.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP65.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1C6.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C7.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNItst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNItst.dll" /implib:"../libs/GL4JavaJauGLUJNItst.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNItst_funcs.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP65.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1C7.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGLU_JauJNItst_funcs.c
diff --git a/Win32VC6/GL4JavaJauGljJNI/GL4JavaJauGljJNI.plg b/Win32VC6/GL4JavaJauGljJNI/GL4JavaJauGljJNI.plg
index 8319ab4..9c51157 100755
--- a/Win32VC6/GL4JavaJauGljJNI/GL4JavaJauGljJNI.plg
+++ b/Win32VC6/GL4JavaJauGljJNI/GL4JavaJauGljJNI.plg
@@ -6,17 +6,13 @@
--------------------Konfiguration: GL4JavaJauGljJNI - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP7.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C3.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "NO_VSNPRINTF" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLCallbackHelperJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\jnitools.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_misc.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32.c"
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32_common.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP7.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP8.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1C3.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C4.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGljJNI.pdb" /machine:I386 /out:"../libs/GL4JavaJauGljJNI.dll" /implib:"../libs/GL4JavaJauGljJNI.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLCallbackHelperJNI.obj
@@ -25,410 +21,17 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_common.obj
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP8.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1C4.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
-GLCallbackHelperJNI.c
-jnitools.c
-OpenGL_misc.c
-OpenGL_Win32.c
OpenGL_Win32_common.c
-Generieren von Code...
Linker-Vorgang l�uft...
Bibliothek ../libs/GL4JavaJauGljJNI.lib und Objekt ../libs/GL4JavaJauGljJNI.exp wird erstellt
-<h3>
---------------------Konfiguration: GL4JavaJauGLJNI - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSPC.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNI_dynfuncs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSPC.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSPD.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNI.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNI.dll" /implib:"../libs/GL4JavaJauGLJNI.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNI_dynfuncs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSPD.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_JauJNI_dynfuncs.c
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLJNI.lib und Objekt ../libs/GL4JavaJauGLJNI.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLJNI.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGljJNI12 - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP11.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "NO_VSNPRINTF" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLCallbackHelperJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\jni12tools.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_misc.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32_common.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP11.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP12.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGljJNI12.pdb" /machine:I386 /out:"../libs/GL4JavaJauGljJNI12.dll" /implib:"../libs/GL4JavaJauGljJNI12.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLCallbackHelperJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\jni12tools.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_misc.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_common.obj
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP12.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLCallbackHelperJNI.c
-jni12tools.c
-OpenGL_misc.c
-OpenGL_Win32.c
-OpenGL_Win32_common.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGljJNI12.lib und Objekt ../libs/GL4JavaJauGljJNI12.exp wird erstellt
-<h3>
---------------------Konfiguration: GL4JavaJauGLJNI12 - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP16.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNI12_dynfuncs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP16.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP17.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNI12.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNI12.dll" /implib:"../libs/GL4JavaJauGLJNI12.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNI12_dynfuncs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP17.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_JauJNI12_dynfuncs.c
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLJNI12.lib und Objekt ../libs/GL4JavaJauGLJNI12.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLJNI12.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLJNI12tst - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP1B.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNI12tst_dynfuncs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP1B.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP1C.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNI12tst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNI12tst.dll" /implib:"../libs/GL4JavaJauGLJNI12tst.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNI12tst_dynfuncs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1C.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_JauJNI12tst_dynfuncs.c
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLJNI12tst.lib und Objekt ../libs/GL4JavaJauGLJNI12tst.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLJNI12tst.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLJNInf - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP20.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNInf_dynfuncs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP20.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP21.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNInf.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNInf.dll" /implib:"../libs/GL4JavaJauGLJNInf.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNInf_dynfuncs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP21.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_JauJNInf_dynfuncs.c
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLJNInf.lib und Objekt ../libs/GL4JavaJauGLJNInf.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLJNInf.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLJNItst - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP25.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_JauJNItst_dynfuncs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP25.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP26.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLJNItst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLJNItst.dll" /implib:"../libs/GL4JavaJauGLJNItst.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_JauJNItst_dynfuncs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP26.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_JauJNItst_dynfuncs.c
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLJNItst.lib und Objekt ../libs/GL4JavaJauGLJNItst.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLJNItst.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLUJNI - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP2A.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLUCallbackJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNI_funcs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP2A.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP2B.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNI.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNI.dll" /implib:"../libs/GL4JavaJauGLUJNI.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNI_funcs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP2B.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLUCallbackJNI.c
-OpenGLU_JauJNI_funcs.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLUJNI.lib und Objekt ../libs/GL4JavaJauGLUJNI.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLUJNI.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLUJNI12 - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP2F.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLUCallbackJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNI12_funcs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP2F.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP30.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNI12.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNI12.dll" /implib:"../libs/GL4JavaJauGLUJNI12.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNI12_funcs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP30.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLUCallbackJNI.c
-OpenGLU_JauJNI12_funcs.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLUJNI12.lib und Objekt ../libs/GL4JavaJauGLUJNI12.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLUJNI12.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLUJNI12tst - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP34.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLUCallbackJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNI12tst_funcs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP34.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP35.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI12.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNI12tst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNI12tst.dll" /implib:"../libs/GL4JavaJauGLUJNI12tst.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNI12tst_funcs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI12.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP35.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLUCallbackJNI.c
-OpenGLU_JauJNI12tst_funcs.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLUJNI12tst.lib und Objekt ../libs/GL4JavaJauGLUJNI12tst.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLUJNI12tst.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLUJNInf - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP39.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLUCallbackJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNInf_funcs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP39.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP3A.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNInf.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNInf.dll" /implib:"../libs/GL4JavaJauGLUJNInf.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNInf_funcs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP3A.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLUCallbackJNI.c
-OpenGLU_JauJNInf_funcs.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLUJNInf.lib und Objekt ../libs/GL4JavaJauGLUJNInf.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLUJNInf.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGLUJNItst - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP3E.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLUCallbackJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGLU_JauJNItst_funcs.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP3E.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP3F.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGLUJNItst.pdb" /machine:I386 /out:"../libs/GL4JavaJauGLUJNItst.dll" /implib:"../libs/GL4JavaJauGLUJNItst.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLUCallbackJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGLU_JauJNItst_funcs.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP3F.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLUCallbackJNI.c
-OpenGLU_JauJNItst_funcs.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGLUJNItst.lib und Objekt ../libs/GL4JavaJauGLUJNItst.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGLUJNItst.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaJauGljJNI13 - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP43.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "NO_VSNPRINTF" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\GLCallbackHelperJNI.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\jawt_misc.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\jni12tools.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_misc.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32_common.c"
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32_jawt.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP43.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP44.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib jawt.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGljJNI13.pdb" /machine:I386 /out:"../libs/GL4JavaJauGljJNI13.dll" /implib:"../libs/GL4JavaJauGljJNI13.lib" /libpath:"d:\java2\lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\GLCallbackHelperJNI.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\jawt_misc.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\jni12tools.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_misc.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_common.obj
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_jawt.obj
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP44.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-GLCallbackHelperJNI.c
-jawt_misc.c
-jni12tools.c
-OpenGL_misc.c
-OpenGL_Win32_common.c
-OpenGL_Win32_jawt.c
-Generieren von Code...
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaJauGljJNI13.lib und Objekt ../libs/GL4JavaJauGljJNI13.exp wird erstellt
-
-
-
-<h3>Ergebnisse</h3>
-GL4JavaJauGljJNI13.dll - 0 Fehler, 0 Warnung(en)
-<h3>
---------------------Konfiguration: GL4JavaMSJDirect - Win32 Release--------------------
-</h3>
-<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP48.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "NO_VSNPRINTF" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32_JDirect.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSP48.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP49.tmp" mit Inhalten
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaGljMSJDirect.pdb" /machine:I386 /out:"../libs/GL4JavaGljMSJDirect.dll" /implib:"../libs/GL4JavaGljMSJDirect.lib"
-\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_JDirect.obj
-\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
-]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP49.tmp"
-<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_Win32_JDirect.c
-Linker-Vorgang l�uft...
- Bibliothek ../libs/GL4JavaGljMSJDirect.lib und Objekt ../libs/GL4JavaGljMSJDirect.exp wird erstellt
<h3>Ergebnisse</h3>
-GL4JavaGljMSJDirect.dll - 0 Fehler, 0 Warnung(en)
+GL4JavaJauGljJNI.dll - 0 Fehler, 0 Warnung(en)
</pre>
</body>
</html>
diff --git a/Win32VC6/GL4JavaJauGljJNI12/GL4JavaJauGljJNI12.plg b/Win32VC6/GL4JavaJauGljJNI12/GL4JavaJauGljJNI12.plg
index 3389844..aa9ee60 100755
--- a/Win32VC6/GL4JavaJauGljJNI12/GL4JavaJauGljJNI12.plg
+++ b/Win32VC6/GL4JavaJauGljJNI12/GL4JavaJauGljJNI12.plg
@@ -6,13 +6,7 @@
--------------------Konfiguration: GL4JavaJauGljJNI12 - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSPEB.tmp" mit Inhalten
-[
-/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "NO_VSNPRINTF" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
-"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32.c"
-]
-Creating command line "cl.exe @D:\TEMP\RSPEB.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSPEC.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C8.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaJauGljJNI12.pdb" /machine:I386 /out:"../libs/GL4JavaJauGljJNI12.dll" /implib:"../libs/GL4JavaJauGljJNI12.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\GLCallbackHelperJNI.obj
@@ -21,10 +15,8 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32.obj
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_common.obj
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSPEC.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1C8.tmp"
<h3>Ausgabefenster</h3>
-Kompilierung l�uft...
-OpenGL_Win32.c
Linker-Vorgang l�uft...
Bibliothek ../libs/GL4JavaJauGljJNI12.lib und Objekt ../libs/GL4JavaJauGljJNI12.exp wird erstellt
diff --git a/Win32VC6/GL4JavaJauGljJNI13/GL4JavaJauGljJNI13.dsp b/Win32VC6/GL4JavaJauGljJNI13/GL4JavaJauGljJNI13.dsp
index 74f8ced..5569e4a 100755
--- a/Win32VC6/GL4JavaJauGljJNI13/GL4JavaJauGljJNI13.dsp
+++ b/Win32VC6/GL4JavaJauGljJNI13/GL4JavaJauGljJNI13.dsp
@@ -60,6 +60,10 @@ SOURCE=..\..\CNativeCode\GLCallbackHelperJNI.c
# End Source File
# Begin Source File
+SOURCE=..\..\CNativeCode\GLDrawableFactory_Win32_SunJDK13.c
+# End Source File
+# Begin Source File
+
SOURCE=..\..\CNativeCode\jawt_misc.c
# End Source File
# Begin Source File
diff --git a/Win32VC6/GL4JavaMSJDirect/GL4JavaMSJDirect.plg b/Win32VC6/GL4JavaMSJDirect/GL4JavaMSJDirect.plg
index d7671cc..dd390ef 100755
--- a/Win32VC6/GL4JavaMSJDirect/GL4JavaMSJDirect.plg
+++ b/Win32VC6/GL4JavaMSJDirect/GL4JavaMSJDirect.plg
@@ -6,19 +6,19 @@
--------------------Konfiguration: GL4JavaMSJDirect - Win32 Release--------------------
</h3>
<h3>Befehlszeilen</h3>
-Erstellen der tempor�ren Datei "D:\TEMP\RSP69.tmp" mit Inhalten
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C1.tmp" mit Inhalten
[
/nologo /MT /W3 /GX /O2 /I "d:\java2\include" /I "d:\java2\include\win32" /I "..\..\CCLassHeaders" /I "..\..\CNativeCode" /D "NO_VSNPRINTF" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32_" /D "_MSVC_" /D "_MT" /D "_GL_DYNAMIC_BINDING_" /Fo"../temp/" /Fd"../temp/" /FD /c
"P:\java\GL4Java\GL4Java\CNativeCode\OpenGL_Win32_JDirect.c"
]
-Creating command line "cl.exe @D:\TEMP\RSP69.tmp"
-Erstellen der tempor�ren Datei "D:\TEMP\RSP6A.tmp" mit Inhalten
+Creating command line "cl.exe @D:\TEMP\RSP1C1.tmp"
+Erstellen der tempor�ren Datei "D:\TEMP\RSP1C2.tmp" mit Inhalten
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib ../libs/GL4JavaJauGljJNI.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"../libs/GL4JavaGljMSJDirect.pdb" /machine:I386 /out:"../libs/GL4JavaGljMSJDirect.dll" /implib:"../libs/GL4JavaGljMSJDirect.lib"
\java\GL4Java\GL4Java\Win32VC6\temp\OpenGL_Win32_JDirect.obj
\java\GL4Java\GL4Java\Win32VC6\libs\GL4JavaJauGljJNI.lib
]
-Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP6A.tmp"
+Erstellen der Befehlzeile "link.exe @D:\TEMP\RSP1C2.tmp"
<h3>Ausgabefenster</h3>
Kompilierung l�uft...
OpenGL_Win32_JDirect.c
diff --git a/demos/HodglimsNeHe/Lesson18.java b/demos/HodglimsNeHe/Lesson18.java
index 98bc1cc..79c1393 100644
--- a/demos/HodglimsNeHe/Lesson18.java
+++ b/demos/HodglimsNeHe/Lesson18.java
@@ -458,6 +458,9 @@ public class Lesson18 extends Applet
}
}
public static void main(String as[]) {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = true;
Frame f=new Frame("Lesson18");
Lesson18 a=new Lesson18();
a.init();
diff --git a/demos/HodglimsNeHe/Lesson8.java b/demos/HodglimsNeHe/Lesson8.java
index f0dc1cc..f374f99 100644
--- a/demos/HodglimsNeHe/Lesson8.java
+++ b/demos/HodglimsNeHe/Lesson8.java
@@ -16,8 +16,9 @@ import java.awt.*;
import java.awt.event.*;
//GL4Java classes
-import gl4java.GLContext;
-import gl4java.awt.GLAnimCanvas;
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.drawable.*;
import gl4java.utils.textures.*;
@@ -27,6 +28,7 @@ public class Lesson8 extends Applet
//We are using GLAnimCanvas because we want the canvas
//to be constantly redrawn
renderCanvas canvas = null;
+ public static boolean isAnApplet = true;
/**
@@ -39,8 +41,23 @@ public class Lesson8 extends Applet
//We will use BorderLayout to layout the applet components
setLayout(new BorderLayout());
+ Dimension d = getSize();
+ GLCapabilities glCaps = new GLCapabilities();
+ glCaps.setAlphaBits(8);
+
+ gl4java.drawable.GLDrawableFactory df =
+ gl4java.drawable.GLDrawableFactory.getFactory();
+
//Create our canvas and add it to the center of the applet
- canvas = new renderCanvas(getSize().width, getSize().height);
+ if(df instanceof gl4java.drawable.SunJDK13GLDrawableFactory)
+ {
+ gl4java.drawable.SunJDK13GLDrawableFactory sdf =
+ (gl4java.drawable.SunJDK13GLDrawableFactory)df;
+ canvas = new renderCanvas
+ (sdf.getGraphicsConfiguration(glCaps), glCaps, d.width, d.height);
+ } else {
+ canvas = new renderCanvas(glCaps, d.width, d.height);
+ }
canvas.requestFocus();
add("Center", canvas);
}
@@ -84,6 +101,46 @@ public class Lesson8 extends Applet
}
+ public static void main( String args[] ) {
+ isAnApplet = false;
+ Lesson8 applet =
+ new Lesson8();
+
+ Frame f = new Frame("Lesson8");
+
+ GLContext.gljNativeDebug = true;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = true;
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ f.setVisible(true);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
private class renderCanvas extends GLAnimCanvas
implements KeyListener, MouseListener
@@ -115,35 +172,23 @@ public class Lesson8 extends Applet
int[] texture = new int[3]; //Storage for 3 textures
- /**
- * renderCanvas(int w, int h)
- *
- * Constructor.
- */
- public renderCanvas(int w, int h)
+ public renderCanvas(GraphicsConfiguration g, GLCapabilities glCaps,
+ int w, int h)
{
- super(w, h);
-
+ super(g, glCaps, w, h);
//Registers this canvas to process keyboard events
addKeyListener(this);
addMouseListener(this);
}
-
- /**
- * void preInit()
- *
- * Called just BEFORE the GL-Context is created.
- */
- public void preInit()
+ public renderCanvas(GLCapabilities glCaps, int w, int h)
{
- //We want double buffering
- doubleBuffer = true;
- //But we dont want stereo view
- stereoView = false;
+ super(glCaps, w, h);
+ //Registers this canvas to process keyboard events
+ addKeyListener(this);
+ addMouseListener(this);
}
-
/**
* void LoadGLTextures()
*
@@ -152,7 +197,10 @@ public class Lesson8 extends Applet
public void LoadGLTextures()
{
PngTextureLoader texLoader = new PngTextureLoader(gl, glu);
- texLoader.readTexture(getCodeBase(), "data/glass.png");
+ if(isAnApplet)
+ texLoader.readTexture(getCodeBase(), "data/glass.png");
+ else
+ texLoader.readTexture("data/glass.png");
//Full Brightness, 50% Alpha
gl.glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
diff --git a/demos/MiscDemos/TriangleRotate.java b/demos/MiscDemos/TriangleRotate.java
index 25bccdd..1775b68 100755
--- a/demos/MiscDemos/TriangleRotate.java
+++ b/demos/MiscDemos/TriangleRotate.java
@@ -12,18 +12,32 @@ import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.*;
-import gl4java.GLContext;
-import gl4java.awt.GLAnimCanvas;
-import gl4java.applet.SimpleGLAnimApplet1;
+
+import gl4java.*;
+import gl4java.drawable.*;
+import gl4java.awt.*;
+import gl4java.applet.*;
public class TriangleRotate extends SimpleGLAnimApplet1
{
public void init()
{
+ GLContext.gljNativeDebug = true;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = true;
+
super.init();
Dimension d = getSize();
- canvas = new gldemo(d.width, d.height);
+ System.out.println("applet size: "+d);
+ GLCapabilities caps = new GLCapabilities();
+
+ canvas =
+ GLDrawableFactory.getFactory().createGLAnimCanvas(caps, d.width, d.height);
+
+ gldemo demo = new gldemo();
+ canvas.addGLEventListener(demo);
+
add("Center", canvas);
}
@@ -65,7 +79,8 @@ public class TriangleRotate extends SimpleGLAnimApplet1
f.setVisible(true);
}
- private class gldemo extends GLAnimCanvas
+ private class gldemo
+ implements GLEventListener
{
float rotate;
@@ -73,24 +88,25 @@ public class TriangleRotate extends SimpleGLAnimApplet1
float LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 0.9f};
float LightSpecular[] = { 0.8f, 0.8f, 0.8f, 1.0f};
- public gldemo(int w, int h)
- {
- super(w, h);
- GLContext.gljNativeDebug = false;
- GLContext.gljClassDebug = false;
- setAnimateFps(30.0);
- }
-
- public void preInit()
+ private GLFunc gl;
+ private GLUFunc glu;
+ private GLContext glj;
+
+ public gldemo()
{
- doubleBuffer = true;
- stereoView = false;
- createOwnWindow = true;
}
- public void init()
+ public void cleanup(GLDrawable drawable)
+ {
+ }
+
+ public void init(GLDrawable drawable)
{
- reshape(getSize().width, getSize().height);
+ gl = drawable.getGL();
+ glu = drawable.getGLU();
+ glj = drawable.getGLContext();
+
+ //drawable.reshape(getSize().width, getSize().height);
gl.glEnable(GL_LIGHT0);
gl.glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
@@ -100,7 +116,7 @@ public class TriangleRotate extends SimpleGLAnimApplet1
glj.gljCheckGL();
}
- public void reshape(int width, int height)
+ public void reshape(gl4java.drawable.GLDrawable d,int width,int height)
{
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
@@ -110,10 +126,8 @@ public class TriangleRotate extends SimpleGLAnimApplet1
gl.glViewport(0,0,width,height);
}
- public void display()
+ public void display(GLDrawable drawable)
{
- if (glj.gljMakeCurrent() == false) return;
-
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL_MODELVIEW);
@@ -132,9 +146,15 @@ public class TriangleRotate extends SimpleGLAnimApplet1
gl.glVertex3f( 1, -1, 0);
gl.glEnd();
- glj.gljSwap();
glj.gljCheckGL();
- glj.gljFree();
}
+
+ public void preDisplay(GLDrawable drawable)
+ {
+ }
+
+ public void postDisplay(GLDrawable drawable)
+ {
+ }
}
}
diff --git a/demos/MiscDemos/alpha3D.java b/demos/MiscDemos/alpha3D.java
index 5bd72ef..efbf433 100644
--- a/demos/MiscDemos/alpha3D.java
+++ b/demos/MiscDemos/alpha3D.java
@@ -15,9 +15,9 @@ import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.*;
-import gl4java.GLContext;
-import gl4java.awt.GLCanvas;
-import gl4java.awt.GLAnimCanvas;
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.drawable.*;
import gl4java.applet.SimpleGLAnimApplet1;
import gl4java.utils.glut.*;
@@ -35,7 +35,23 @@ public class alpha3D extends SimpleGLAnimApplet1
{
super.init();
Dimension d = getSize();
- canvas = new alpha3DCanvas(d.width, d.height);
+ GLCapabilities glCaps = new GLCapabilities();
+ glCaps.setAlphaBits(8);
+ glCaps.setAccumAlphaBits(8);
+
+ gl4java.drawable.GLDrawableFactory df =
+ gl4java.drawable.GLDrawableFactory.getFactory();
+
+ if(df instanceof gl4java.drawable.SunJDK13GLDrawableFactory)
+ {
+ gl4java.drawable.SunJDK13GLDrawableFactory sdf =
+ (gl4java.drawable.SunJDK13GLDrawableFactory)df;
+ canvas = new alpha3DCanvas
+ (sdf.getGraphicsConfiguration(glCaps), glCaps, d.width, d.height);
+ } else {
+ canvas = new alpha3DCanvas(glCaps, d.width, d.height);
+ }
+
add("Center", canvas);
}
@@ -46,6 +62,10 @@ public class alpha3D extends SimpleGLAnimApplet1
Frame f = new Frame("alpha3D");
+ GLContext.gljNativeDebug = true;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = true;
+
f.addWindowListener( new WindowAdapter()
{
public void windowClosed(WindowEvent e)
@@ -93,21 +113,19 @@ public class alpha3D extends SimpleGLAnimApplet1
float transparentZ = MINZ;
int sphereList, cubeList;
- public alpha3DCanvas(int w, int h)
+ public alpha3DCanvas(GraphicsConfiguration g, GLCapabilities glCaps,
+ int w, int h)
{
- super(w, h);
- GLContext.gljNativeDebug = false;
- GLContext.gljClassDebug = false;
+ super(g, glCaps, w, h);
setAnimateFps(30.0);
}
- public void preInit()
+ public alpha3DCanvas(GLCapabilities glCaps, int w, int h)
{
- doubleBuffer = true;
- stereoView = false;
+ super(glCaps, w, h);
+ setAnimateFps(30.0);
}
-
public void init()
{
glut = new GLUTFuncLightImpl(gl, glu);
diff --git a/demos/MiscDemos/gears.java b/demos/MiscDemos/gears.java
index e544a08..8775c6e 100644
--- a/demos/MiscDemos/gears.java
+++ b/demos/MiscDemos/gears.java
@@ -12,8 +12,8 @@ import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.*;
-import gl4java.GLContext;
-import gl4java.GLEnum;
+import gl4java.*;
+import gl4java.drawable.*;
import gl4java.awt.GLAnimCanvas;
import gl4java.applet.SimpleGLAnimApplet1;
@@ -22,18 +22,8 @@ public class gears extends SimpleGLAnimApplet1
{
/* Initialize the applet */
- static {
- GLContext.gljNativeDebug = true;
- GLContext.gljThreadDebug = false;
- GLContext.gljClassDebug = true;
- }
-
-
public void init()
{
- GLContext.gljNativeDebug = true;
- GLContext.gljThreadDebug = false;
- GLContext.gljClassDebug = true;
init(false);
}
@@ -41,12 +31,19 @@ public class gears extends SimpleGLAnimApplet1
{
super.init();
Dimension d = getSize();
- canvas = new gearsCanvas(showGL, d.width, d.height);
+
+ GLCapabilities caps = new GLCapabilities();
+
+ canvas =
+ GLDrawableFactory.getFactory().createGLAnimCanvas(caps, d.width, d.height);
+
+ gearRenderer gear = new gearRenderer(showGL);
+ canvas.addGLEventListener(gear);
+
add("Center", canvas);
- addMouseListener(this);
+ addMouseListener(this);
}
-
public static void main( String args[] )
{
int i = 0;
@@ -110,6 +107,9 @@ public class gears extends SimpleGLAnimApplet1
);
gears applet = new gears();
+ mainFrame.add(applet);
+ applet.setSize(400,500);
+ applet.init();
if(perftest)
{
@@ -124,10 +124,8 @@ public class gears extends SimpleGLAnimApplet1
applet.canvas.getUseFpsSleep());
}
- mainFrame.add(applet);
- applet.setSize(400,500);
- applet.init();
applet.start();
+
Dimension ps = applet.getPreferredSize();
mainFrame.setBounds(-100,-100,99,99);
mainFrame.setVisible(true);
@@ -188,7 +186,7 @@ public class gears extends SimpleGLAnimApplet1
/* Local GLAnimCanvas extension class */
- public class gearsCanvas extends GLAnimCanvas implements MouseListener, MouseMotionListener
+ public class gearRenderer implements GLEventListener, MouseListener, MouseMotionListener
{
private static final float M_PI = 3.14159265f;
@@ -204,28 +202,20 @@ public class gears extends SimpleGLAnimApplet1
private boolean showGL = false;
- public gearsCanvas(int w, int h)
- {
- this(false, w, h);
- }
-
- public gearsCanvas(boolean showGL, int w, int h)
- {
- super(w, h);
- setAnimateFps(30.0);
+ private GLFunc gl;
+ private GLUFunc glu;
+ private GLContext glj;
- this.showGL=showGL;
- }
-
- public void preInit()
+ public gearRenderer(boolean showGL)
{
- doubleBuffer = true;
- stereoView = false;
+ this.showGL=showGL;
}
- public void init()
+ public void init(GLDrawable drawable)
{
- reshape(getSize().width, getSize().height);
+ gl = drawable.getGL();
+ glu = drawable.getGLU();
+ glj = drawable.getGLContext();
float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
float red[] = { 0.8f, 0.1f, 0.0f, 1.0f };
@@ -261,21 +251,21 @@ public class gears extends SimpleGLAnimApplet1
glj.gljCheckGL();
- addMouseListener(this);
- addMouseMotionListener(this);
+ drawable.addMouseListener(this);
+ drawable.addMouseMotionListener(this);
T0=System.currentTimeMillis();
System.out.println("init ..");
}
- public void doCleanup()
+ public void cleanup(GLDrawable drawable)
{
System.out.println("destroy(): " + this);
removeMouseListener(this);
removeMouseMotionListener(this);
}
- public void reshape(int width, int height)
+ public void reshape(gl4java.drawable.GLDrawable gld,int width,int height)
{
float h = (float)height / (float)width;
@@ -288,10 +278,8 @@ public class gears extends SimpleGLAnimApplet1
gl.glTranslatef(0.0f, 0.0f, -40.0f);
}
- public void display()
+ public void display(GLDrawable drawable)
{
- if (glj.gljMakeCurrent() == false) return;
-
if(showGL)
{
showGL=false;
@@ -329,12 +317,15 @@ public class gears extends SimpleGLAnimApplet1
gl.glPopMatrix();
- glj.gljSwap();
- glj.gljCheckGL();
- glj.gljFree();
-
Frames++;
+ }
+ public void preDisplay(GLDrawable drawable)
+ {
+ }
+
+ public void postDisplay(GLDrawable drawable)
+ {
long t=System.currentTimeMillis();
if(t - T0 >= 5000)
{
diff --git a/demos/MiscDemos/stencil.java b/demos/MiscDemos/stencil.java
index b5f7fe7..09a2092 100644
--- a/demos/MiscDemos/stencil.java
+++ b/demos/MiscDemos/stencil.java
@@ -57,14 +57,12 @@ import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.*;
-import gl4java.GLContext;
+import gl4java.*;
+import gl4java.drawable.*;
import gl4java.awt.GLCanvas;
public class stencil extends Applet
{
- stencilCanvas canvas1 = null;
- stencilCanvas canvas2 = null;
-
Panel cvs = null;
/* Initialize the applet */
@@ -75,10 +73,29 @@ public class stencil extends Applet
Dimension d = getSize();
setLayout(new BorderLayout());
- canvas1 = new stencilCanvas(d.width, d.height, 0, false);
- System.out.println("the left canvas has 0 stencil-bits, self-window");
- canvas2 = new stencilCanvas(d.width, d.height, 8, true);
- System.out.println("the right canvas should have 8 stencil-bits, ownWindow");
+ GLCapabilities caps1 = new GLCapabilities();
+ caps1.setStencilBits(0);
+
+ System.out.println("the left canvas has 0 stencil-bits");
+ System.out.println("caps1: "+caps1);
+
+ GLCanvas canvas1 =
+ GLDrawableFactory.getFactory().createGLCanvas(caps1, d.width, d.height);
+
+ stencilDemo demo1 = new stencilDemo(d.width, d.height);
+ canvas1.addGLEventListener(demo1);
+
+ GLCapabilities caps2 = new GLCapabilities();
+ caps2.setStencilBits(8);
+
+ System.out.println("the right canvas should have >=8 stencil-bits");
+ System.out.println("caps2: "+caps2);
+
+ GLCanvas canvas2 =
+ GLDrawableFactory.getFactory().createGLCanvas(caps2, d.width, d.height);
+
+ stencilDemo demo2 = new stencilDemo(d.width, d.height);
+ canvas2.addGLEventListener(demo2);
cvs = new Panel();
cvs.setLayout(new GridLayout(1,2));
@@ -131,37 +148,39 @@ public class stencil extends Applet
/* Local GLCanvas extension class */
- private class stencilCanvas extends GLCanvas
+ private class stencilDemo
+ implements GLEventListener
{
private static final float M_PI = 3.14159265359f;
private static final int YELLOWMAT = 1, BLUEMAT = 2;
private boolean initdone = false;
- public stencilCanvas(int w, int h,
- int _stencilBits,
- boolean _createOwnWindow)
- {
- super(w, h);
- stencilBits = _stencilBits;
- createOwnWindow = _createOwnWindow;
- }
-
- public void preInit()
+ private GLFunc gl;
+ private GLUFunc glu;
+ private GLContext glj;
+
+
+ public stencilDemo(int w, int h)
{
- doubleBuffer = true;
- stereoView = false;
}
- public void init()
+ public void cleanup(GLDrawable drawable)
+ {
+ }
+
+ public void init(GLDrawable drawable)
{
+ gl = drawable.getGL();
+ glu = drawable.getGLU();
+ glj = drawable.getGLContext();
+
// Examine some OpenGL properties
int [] res=new int[6];
gl.glGetIntegerv(GL_STENCIL_BITS,res);
System.out.println("init(): " + this + "\n\t" +
- "Stencil bits are "+res[0] +"\n\t" +
- "IsOwnCreatedWindow: "+createOwnWindow);
+ "Stencil bits are "+res[0] +"\n\t");
float yellow_diffuse[] = { 0.7f, 0.7f, 0.0f, 1.0f };
float yellow_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
@@ -195,16 +214,9 @@ public class stencil extends Applet
glj.gljCheckGL();
initdone = true;
- reshape(getSize().width, getSize().height);
}
- public void cvsDispose()
- {
- System.out.println("destroy(): " + this);
- super.cvsDispose();
- }
-
- public void reshape(int width, int height)
+ public void reshape(gl4java.drawable.GLDrawable d,int width,int height)
{
gl.glViewport(0,0,width,height);
@@ -247,10 +259,8 @@ public class stencil extends Applet
gl.glTranslatef(0.0f, 0.0f, -5.0f);
}
- public void display()
+ public void display(GLDrawable drawable)
{
- if (glj.gljMakeCurrent() == false) return;
-
/* Draw a sphere in a diamond-shaped section in the
* middle of a window with 2 torii.
*/
@@ -281,11 +291,17 @@ public class stencil extends Applet
gl.glPopMatrix();
gl.glPopMatrix();
- glj.gljSwap();
glj.gljCheckGL();
- glj.gljFree();
}
+ public void preDisplay(GLDrawable drawable)
+ {
+ }
+
+ public void postDisplay(GLDrawable drawable)
+ {
+ }
+
// Imported from glut.
private void glutSolidTorus
(float innerRadius,
diff --git a/demos/RonsDemos/dinoshade.java b/demos/RonsDemos/dinoshade.java
index 570ea12..f9ab381 100755
--- a/demos/RonsDemos/dinoshade.java
+++ b/demos/RonsDemos/dinoshade.java
@@ -1,328 +1,347 @@
-/**
- * @(#) dinoshade.java
- * @(#) author: Mark J. Kilgard (converted to Java by Ron Cemer)
- */
-
-/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
-
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-/* Example for PC game developers to show how to *combine* texturing,
- reflections, and projected shadows all in real-time with OpenGL.
- Robust reflections use stenciling. Robust projected shadows
- use both stenciling and polygon offset. PC game programmers
- should realize that neither stenciling nor polygon offset are
- supported by Direct3D, so these real-time rendering algorithms
- are only really viable with OpenGL.
-
- The program has modes for disabling the stenciling and polygon
- offset uses. It is worth running this example with these features
- toggled off so you can see the sort of artifacts that result.
-
- Notice that the floor texturing, reflections, and shadowing
- all co-exist properly. */
-
-/* When you run this program: Left mouse button controls the
- view. Middle mouse button controls light position (left &
- right rotates light around dino; up & down moves light
- position up and down). Right mouse button pops up menu. */
-
-/* Check out the comments in the "redraw" routine to see how the
- reflection blending and surface stenciling is done. You can
- also see in "redraw" how the projected shadows are rendered,
- including the use of stenciling and polygon offset. */
-
-import java.applet.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.lang.*;
-import java.util.*;
-import java.io.*;
-import java.util.*;
-import gl4java.GLContext;
-import gl4java.awt.GLAnimCanvas;
-import gl4java.applet.SimpleGLAnimApplet1;
-
-public class dinoshade extends SimpleGLAnimApplet1
-{
- static final float[][] bodyVerts =
- {
- { 0.0f, 3.0f, 0.0f},
- { 1.0f, 1.0f, 0.0f},
- { 5.0f, 1.0f, 0.0f},
- { 8.0f, 4.0f, 0.0f},
- { 10.0f, 4.0f, 0.0f},
- { 11.0f, 5.0f, 0.0f},
- { 11.0f, 11.5f, 0.0f},
- { 13.0f, 12.0f, 0.0f},
- { 13.0f, 13.0f, 0.0f},
- { 10.0f, 13.5f, 0.0f},
- { 13.0f, 14.0f, 0.0f},
- { 13.0f, 15.0f, 0.0f},
- { 11.0f, 16.0f, 0.0f},
- { 8.0f, 16.0f, 0.0f},
- { 7.0f, 15.0f, 0.0f},
- { 7.0f, 13.0f, 0.0f},
- { 8.0f, 12.0f, 0.0f},
- { 7.0f, 11.0f, 0.0f},
- { 6.0f, 6.0f, 0.0f},
- { 4.0f, 3.0f, 0.0f},
- { 3.0f, 2.0f, 0.0f},
- { 1.0f, 2.0f, 0.0f},
- };
-
- static final int[][] bodyTris =
- {
- { 1, 0, 21 },
- { 1, 21, 2 },
- { 21, 20, 2 },
- { 20, 19, 2 },
- { 19, 3, 2 },
- { 19, 18, 3 },
- { 18, 4, 3 },
- { 18, 5, 4 },
- { 18, 6, 5 },
- { 18, 17, 6 },
- { 17, 16, 6 },
- { 16, 7, 6 },
- { 16, 8, 7 },
- { 16, 15, 8 },
- { 15, 9, 8 },
- { 15, 14, 9 },
- { 14, 13, 9 },
- { 9, 13, 12 },
- { 9, 12, 11 },
- { 11, 10, 9 },
- };
-
- static final float[][] armVerts =
- {
- { 8.0f, 10.0f, 0.0f},
- { 9.0f, 9.0f, 0.0f},
- { 10.0f, 9.0f, 0.0f},
- { 13.0f, 8.0f, 0.0f},
- { 14.0f, 9.0f, 0.0f},
- { 16.0f, 9.0f, 0.0f},
- { 15.0f, 9.5f, 0.0f},
- { 16.0f, 10.0f, 0.0f},
- { 15.0f, 10.0f, 0.0f},
- { 15.5f, 11.0f, 0.0f},
- { 14.5f, 10.0f, 0.0f},
- { 14.0f, 11.0f, 0.0f},
- { 14.0f, 10.0f, 0.0f},
- { 13.0f, 9.0f, 0.0f},
- { 11.0f, 11.0f, 0.0f},
- { 9.0f, 11.0f, 0.0f},
- };
-
- static final int[][] armTris =
- {
- { 0, 15, 1 },
- { 15, 2, 1 },
- { 15, 14, 2 },
- { 14, 13, 2 },
- { 13, 3, 2 },
- { 13, 4, 3 },
- { 13, 12, 4 },
- { 12, 11, 10 },
- { 12, 10, 4 },
- { 10, 6, 4 },
- { 6, 5, 4 },
- { 8, 7, 6 },
- { 10, 8, 6 },
- { 10, 9, 8 },
- };
-
- static final float[][] legVerts =
- {
- { 8.0f, 6.0f, 0.0f},
- { 8.0f, 4.0f, 0.0f},
- { 9.0f, 3.0f, 0.0f},
- { 9.0f, 2.0f, 0.0f},
- { 8.0f, 1.0f, 0.0f},
- { 8.0f, 0.5f, 0.0f},
- { 9.0f, 0.0f, 0.0f},
- { 12.0f, 0.0f, 0.0f},
- { 10.0f, 1.0f, 0.0f},
- { 10.0f, 2.0f, 0.0f},
- { 12.0f, 4.0f, 0.0f},
- { 11.0f, 6.0f, 0.0f},
- { 10.0f, 7.0f, 0.0f},
- { 9.0f, 7.0f, 0.0f},
- };
-
- static final int[][] legTris =
- {
- { 6, 5, 7 },
- { 5, 8, 7 },
- { 5, 4, 8 },
- { 4, 3, 8 },
- { 3, 9, 8 },
- { 3, 2, 9 },
- { 2, 10, 9 },
- { 2, 1, 10 },
- { 1, 0, 10 },
- { 0, 11, 10 },
- { 0, 12, 11 },
- { 0, 13, 12 },
- };
-
- static final float[][] eyeVerts =
- {
- { 8.75f, 15.0f, 0.0f},
- { 9.0f, 14.7f, 0.0f},
- { 9.6f, 14.7f, 0.0f},
- { 10.1f, 15.0f, 0.0f},
- { 9.6f, 15.25f, 0.0f},
- { 9.0f, 15.25f, 0.0f},
- };
-
- static final int[][] eyeTris =
- {
- { 1, 0, 2 },
- { 0, 5, 2 },
- { 5, 4, 2 },
- { 4, 3, 2 },
- };
-
- static final float floorVertices[][] =
- {
- { -20.0f, 0.0f, 20.0f },
- { 20.0f, 0.0f, 20.0f },
- { 20.0f, 0.0f, -20.0f },
- { -20.0f, 0.0f, -20.0f },
- };
-
-
- /* Initialize the applet */
-
-
- public void init()
- {
- super.init();
- Dimension d = getSize();
- canvas = new dinoshadeCanvas(d.width, d.height);
- add("Center", canvas);
- }
-
-
- public static void main( String args[] ) {
- dinoshade applet =
- new dinoshade();
-
- Frame f = new Frame("dinoshade");
-
- f.addWindowListener( new WindowAdapter()
- {
- public void windowClosed(WindowEvent e)
- {
- System.exit(0);
- }
- public void windowClosing(WindowEvent e)
- {
- windowClosed(e);
- }
- }
- );
-
- f.setLayout(new BorderLayout());
- f.add("Center", applet);
- applet.setSize(500,300);
+/**
+ * @(#) dinoshade.java
+ * @(#) author: Mark J. Kilgard (converted to Java by Ron Cemer)
+ */
+
+/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
+
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
+ implied. This program is -not- in the public domain. */
+
+/* Example for PC game developers to show how to *combine* texturing,
+ reflections, and projected shadows all in real-time with OpenGL.
+ Robust reflections use stenciling. Robust projected shadows
+ use both stenciling and polygon offset. PC game programmers
+ should realize that neither stenciling nor polygon offset are
+ supported by Direct3D, so these real-time rendering algorithms
+ are only really viable with OpenGL.
+
+ The program has modes for disabling the stenciling and polygon
+ offset uses. It is worth running this example with these features
+ toggled off so you can see the sort of artifacts that result.
+
+ Notice that the floor texturing, reflections, and shadowing
+ all co-exist properly. */
+
+/* When you run this program: Left mouse button controls the
+ view. Middle mouse button controls light position (left &
+ right rotates light around dino; up & down moves light
+ position up and down). Right mouse button pops up menu. */
+
+/* Check out the comments in the "redraw" routine to see how the
+ reflection blending and surface stenciling is done. You can
+ also see in "redraw" how the projected shadows are rendered,
+ including the use of stenciling and polygon offset. */
+
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.*;
+import java.util.*;
+import java.io.*;
+import java.util.*;
+
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.drawable.*;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class dinoshade extends SimpleGLAnimApplet1
+{
+ static final float[][] bodyVerts =
+ {
+ { 0.0f, 3.0f, 0.0f},
+ { 1.0f, 1.0f, 0.0f},
+ { 5.0f, 1.0f, 0.0f},
+ { 8.0f, 4.0f, 0.0f},
+ { 10.0f, 4.0f, 0.0f},
+ { 11.0f, 5.0f, 0.0f},
+ { 11.0f, 11.5f, 0.0f},
+ { 13.0f, 12.0f, 0.0f},
+ { 13.0f, 13.0f, 0.0f},
+ { 10.0f, 13.5f, 0.0f},
+ { 13.0f, 14.0f, 0.0f},
+ { 13.0f, 15.0f, 0.0f},
+ { 11.0f, 16.0f, 0.0f},
+ { 8.0f, 16.0f, 0.0f},
+ { 7.0f, 15.0f, 0.0f},
+ { 7.0f, 13.0f, 0.0f},
+ { 8.0f, 12.0f, 0.0f},
+ { 7.0f, 11.0f, 0.0f},
+ { 6.0f, 6.0f, 0.0f},
+ { 4.0f, 3.0f, 0.0f},
+ { 3.0f, 2.0f, 0.0f},
+ { 1.0f, 2.0f, 0.0f},
+ };
+
+ static final int[][] bodyTris =
+ {
+ { 1, 0, 21 },
+ { 1, 21, 2 },
+ { 21, 20, 2 },
+ { 20, 19, 2 },
+ { 19, 3, 2 },
+ { 19, 18, 3 },
+ { 18, 4, 3 },
+ { 18, 5, 4 },
+ { 18, 6, 5 },
+ { 18, 17, 6 },
+ { 17, 16, 6 },
+ { 16, 7, 6 },
+ { 16, 8, 7 },
+ { 16, 15, 8 },
+ { 15, 9, 8 },
+ { 15, 14, 9 },
+ { 14, 13, 9 },
+ { 9, 13, 12 },
+ { 9, 12, 11 },
+ { 11, 10, 9 },
+ };
+
+ static final float[][] armVerts =
+ {
+ { 8.0f, 10.0f, 0.0f},
+ { 9.0f, 9.0f, 0.0f},
+ { 10.0f, 9.0f, 0.0f},
+ { 13.0f, 8.0f, 0.0f},
+ { 14.0f, 9.0f, 0.0f},
+ { 16.0f, 9.0f, 0.0f},
+ { 15.0f, 9.5f, 0.0f},
+ { 16.0f, 10.0f, 0.0f},
+ { 15.0f, 10.0f, 0.0f},
+ { 15.5f, 11.0f, 0.0f},
+ { 14.5f, 10.0f, 0.0f},
+ { 14.0f, 11.0f, 0.0f},
+ { 14.0f, 10.0f, 0.0f},
+ { 13.0f, 9.0f, 0.0f},
+ { 11.0f, 11.0f, 0.0f},
+ { 9.0f, 11.0f, 0.0f},
+ };
+
+ static final int[][] armTris =
+ {
+ { 0, 15, 1 },
+ { 15, 2, 1 },
+ { 15, 14, 2 },
+ { 14, 13, 2 },
+ { 13, 3, 2 },
+ { 13, 4, 3 },
+ { 13, 12, 4 },
+ { 12, 11, 10 },
+ { 12, 10, 4 },
+ { 10, 6, 4 },
+ { 6, 5, 4 },
+ { 8, 7, 6 },
+ { 10, 8, 6 },
+ { 10, 9, 8 },
+ };
+
+ static final float[][] legVerts =
+ {
+ { 8.0f, 6.0f, 0.0f},
+ { 8.0f, 4.0f, 0.0f},
+ { 9.0f, 3.0f, 0.0f},
+ { 9.0f, 2.0f, 0.0f},
+ { 8.0f, 1.0f, 0.0f},
+ { 8.0f, 0.5f, 0.0f},
+ { 9.0f, 0.0f, 0.0f},
+ { 12.0f, 0.0f, 0.0f},
+ { 10.0f, 1.0f, 0.0f},
+ { 10.0f, 2.0f, 0.0f},
+ { 12.0f, 4.0f, 0.0f},
+ { 11.0f, 6.0f, 0.0f},
+ { 10.0f, 7.0f, 0.0f},
+ { 9.0f, 7.0f, 0.0f},
+ };
+
+ static final int[][] legTris =
+ {
+ { 6, 5, 7 },
+ { 5, 8, 7 },
+ { 5, 4, 8 },
+ { 4, 3, 8 },
+ { 3, 9, 8 },
+ { 3, 2, 9 },
+ { 2, 10, 9 },
+ { 2, 1, 10 },
+ { 1, 0, 10 },
+ { 0, 11, 10 },
+ { 0, 12, 11 },
+ { 0, 13, 12 },
+ };
+
+ static final float[][] eyeVerts =
+ {
+ { 8.75f, 15.0f, 0.0f},
+ { 9.0f, 14.7f, 0.0f},
+ { 9.6f, 14.7f, 0.0f},
+ { 10.1f, 15.0f, 0.0f},
+ { 9.6f, 15.25f, 0.0f},
+ { 9.0f, 15.25f, 0.0f},
+ };
+
+ static final int[][] eyeTris =
+ {
+ { 1, 0, 2 },
+ { 0, 5, 2 },
+ { 5, 4, 2 },
+ { 4, 3, 2 },
+ };
+
+ static final float floorVertices[][] =
+ {
+ { -20.0f, 0.0f, 20.0f },
+ { 20.0f, 0.0f, 20.0f },
+ { 20.0f, 0.0f, -20.0f },
+ { -20.0f, 0.0f, -20.0f },
+ };
+
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+
+ GLCapabilities glCaps = new GLCapabilities();
+ glCaps.setStencilBits(16);
+
+ gl4java.drawable.GLDrawableFactory df =
+ gl4java.drawable.GLDrawableFactory.getFactory();
+
+ if(df instanceof gl4java.drawable.SunJDK13GLDrawableFactory)
+ {
+ gl4java.drawable.SunJDK13GLDrawableFactory sdf =
+ (gl4java.drawable.SunJDK13GLDrawableFactory)df;
+ canvas = new dinoshadeCanvas
+ (sdf.getGraphicsConfiguration(glCaps), glCaps, d.width, d.height);
+ } else {
+ canvas = new dinoshadeCanvas(glCaps, d.width, d.height);
+ }
+
+ add("Center", canvas);
+ }
+
+
+ public static void main( String args[] ) {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = true;
+
+ dinoshade applet =
+ new dinoshade();
+
+ Frame f = new Frame("dinoshade");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
applet.init();
- applet.start();
- Dimension ps = applet.getPreferredSize();
- f.setBounds(-100,-100,99,99);
- f.setVisible(true);
- f.setVisible(false);
- Insets i = f.getInsets();
- f.setBounds(0,0,
- ps.width+i.left+i.right,
- ps.height+i.top+i.bottom);
- f.setVisible(true);
- }
-
- /* Local GLAnimCanvas extension class */
-
-
- private class dinoshadeCanvas extends GLAnimCanvas
- implements MouseListener, MouseMotionListener, ActionListener
- {
- private static final double M_PI = 3.14159265;
-
- // Menu options:
- private static final String M_NONE = "-----------------------";
- private static final String M_MOTION = "Toggle motion";
- private static final String M_LIGHT = "Toggle light";
- private static final String M_TEXTURE = "Toggle texture";
- private static final String M_SHADOWS = "Toggle shadows";
- private static final String M_REFLECTION = "Toggle reflection";
- private static final String M_DINOSAUR = "Toggle dinosaur";
- private static final String M_STENCIL_REFLECTION = "Toggle reflection stenciling";
- private static final String M_STENCIL_SHADOW = "Toggle shadow stenciling";
- private static final String M_OFFSET_SHADOW = "Toggle shadow offset";
- private static final String M_POSITIONAL = "Positional light";
- private static final String M_DIRECTIONAL = "Directional light";
-
- private PopupMenu menu = null;
- private boolean menu_showing = false;
- private boolean save_suspended = false;
-
- /* Variables controlling various rendering modes. */
- private boolean stencilReflection = true, stencilShadow = true, offsetShadow = true;
- private boolean renderShadow = true, renderDinosaur = true, renderReflection = true;
- private boolean linearFiltering = false, useTexture = true;
-// private boolean useMipmaps = false;
- private boolean lightSwitch = true;
- private boolean directionalLight = true;
-
- /* Time varying or user-controled variables. */
- private float jump = 0.0f;
- private float lightAngle = 0.0f, lightHeight = 20.0f;
- private float angle = -150.0f; /* in degrees */
- private float angle2 = 30.0f; /* in degrees */
-
- private boolean moving = false;
- private int startx, starty;
- private boolean lightMoving = false;
- private int lightStartX, lightStartY;
-
- private final float bodyWidth = 3.0f;
-
- private final float[] lightPosition = new float[4];
- private final float lightColor[] = {0.8f, 1.0f, 0.8f, 1.0f}; /* green-tinted */
- private final float skinColor[] = {0.1f, 1.0f, 0.1f, 1.0f};
- private final float eyeColor[] = {1.0f, 0.2f, 0.2f, 1.0f};
- private final int X = 0, Y = 1, Z = 2, W = 3;
- private final int A = 0, B = 1, C = 2, D = 3;
-
- /* Enumerants for refering to display lists. */
- private static final int
- BODY_SIDE = 1, BODY_EDGE = 2, BODY_WHOLE = 3,
- ARM_SIDE = 4, ARM_EDGE = 5, ARM_WHOLE = 6,
- LEG_SIDE = 7, LEG_EDGE = 8, LEG_WHOLE = 9,
- EYE_SIDE = 10, EYE_EDGE = 11, EYE_WHOLE = 12;
- private float floorPlane[] = new float[4];
- private float floorShadow[] = new float[16];
-
- public dinoshadeCanvas(int w, int h)
- {
- super(w, h);
- GLContext.gljNativeDebug = false;
- GLContext.gljClassDebug = false;
- setAnimateFps(30.0);
- }
-
- public void preInit()
- {
- doubleBuffer = true;
- stereoView = false;
- stencilBits = 3;
- }
-
- public void init()
- {
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ f.setVisible(true);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+
+ /* Local GLAnimCanvas extension class */
+
+
+ private class dinoshadeCanvas extends GLAnimCanvas
+ implements MouseListener, MouseMotionListener, ActionListener
+ {
+ private static final double M_PI = 3.14159265;
+
+ // Menu options:
+ private static final String M_NONE = "-----------------------";
+ private static final String M_MOTION = "Toggle motion";
+ private static final String M_LIGHT = "Toggle light";
+ private static final String M_TEXTURE = "Toggle texture";
+ private static final String M_SHADOWS = "Toggle shadows";
+ private static final String M_REFLECTION = "Toggle reflection";
+ private static final String M_DINOSAUR = "Toggle dinosaur";
+ private static final String M_STENCIL_REFLECTION = "Toggle reflection stenciling";
+ private static final String M_STENCIL_SHADOW = "Toggle shadow stenciling";
+ private static final String M_OFFSET_SHADOW = "Toggle shadow offset";
+ private static final String M_POSITIONAL = "Positional light";
+ private static final String M_DIRECTIONAL = "Directional light";
+
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+ private boolean save_suspended = false;
+
+ /* Variables controlling various rendering modes. */
+ private boolean stencilReflection = true, stencilShadow = true, offsetShadow = true;
+ private boolean renderShadow = true, renderDinosaur = true, renderReflection = true;
+ private boolean linearFiltering = false, useTexture = true;
+// private boolean useMipmaps = false;
+ private boolean lightSwitch = true;
+ private boolean directionalLight = true;
+
+ /* Time varying or user-controled variables. */
+ private float jump = 0.0f;
+ private float lightAngle = 0.0f, lightHeight = 20.0f;
+ private float angle = -150.0f; /* in degrees */
+ private float angle2 = 30.0f; /* in degrees */
+
+ private boolean moving = false;
+ private int startx, starty;
+ private boolean lightMoving = false;
+ private int lightStartX, lightStartY;
+
+ private final float bodyWidth = 3.0f;
+
+ private final float[] lightPosition = new float[4];
+ private final float lightColor[] = {0.8f, 1.0f, 0.8f, 1.0f}; /* green-tinted */
+ private final float skinColor[] = {0.1f, 1.0f, 0.1f, 1.0f};
+ private final float eyeColor[] = {1.0f, 0.2f, 0.2f, 1.0f};
+ private final int X = 0, Y = 1, Z = 2, W = 3;
+ private final int A = 0, B = 1, C = 2, D = 3;
+
+ /* Enumerants for refering to display lists. */
+ private static final int
+ BODY_SIDE = 1, BODY_EDGE = 2, BODY_WHOLE = 3,
+ ARM_SIDE = 4, ARM_EDGE = 5, ARM_WHOLE = 6,
+ LEG_SIDE = 7, LEG_EDGE = 8, LEG_WHOLE = 9,
+ EYE_SIDE = 10, EYE_EDGE = 11, EYE_WHOLE = 12;
+ private float floorPlane[] = new float[4];
+ private float floorShadow[] = new float[16];
+
+ public dinoshadeCanvas(GraphicsConfiguration g, GLCapabilities glCaps,
+ int w, int h)
+ {
+ super(g, glCaps, w, h);
+ }
+
+ public dinoshadeCanvas(GLCapabilities glCaps, int w, int h)
+ {
+ super(glCaps, w, h);
+ }
+
+ public void init()
+ {
int [] res=new int[6];
gl.glGetIntegerv(GL_STENCIL_BITS,res);
@@ -331,774 +350,774 @@ public class dinoshade extends SimpleGLAnimApplet1
"Stencil bits are "+res[0] +"\n\t" +
"IsOwnCreatedWindow: "+createOwnWindow);
- reshape(getSize().width, getSize().height);
-
- makeDinosaur();
-
- gl.glPolygonOffset(-2.0f, -1.0f);
-
- gl.glEnable(GL_CULL_FACE);
- gl.glEnable(GL_DEPTH_TEST);
- gl.glEnable(GL_TEXTURE_2D);
- gl.glLineWidth(3.0f);
-
- gl.glMatrixMode(GL_PROJECTION);
- glu.gluPerspective
- ( /* field of view in degree */ 40.0f,
- /* aspect ratio */ 1.0f,
- /* Z near */ 20.0f,
- /* Z far */ 100.0f);
- gl.glMatrixMode(GL_MODELVIEW);
- glu.gluLookAt
- (0.0f, 8.0f, 60.0f, /* eye is at (0,8,60) */
- 0.0f, 8.0f, 0.0f, /* center is at (0,8,0) */
- 0.0f, 1.0f, 0.0f); /* up is in postivie Y direction */
-
- gl.glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
- gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
- gl.glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1f);
- gl.glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05f);
- gl.glEnable(GL_LIGHT0);
- gl.glEnable(GL_LIGHTING);
-
- makeFloorTexture();
-
- /* Setup floor plane for projected shadow calculations. */
- findPlane
- (floorPlane,
- floorVertices[1],
- floorVertices[2],
- floorVertices[3]);
-
- glj.gljCheckGL();
-
- menu = new PopupMenu("Options");
- menu.add(M_MOTION);
- menu.add(M_NONE);
- menu.add(M_LIGHT);
- menu.add(M_TEXTURE);
- menu.add(M_SHADOWS);
- menu.add(M_REFLECTION);
- menu.add(M_DINOSAUR);
- menu.add(M_NONE);
- menu.add(M_STENCIL_REFLECTION);
- menu.add(M_STENCIL_SHADOW);
- menu.add(M_OFFSET_SHADOW);
- menu.add(M_NONE);
- menu.add(M_POSITIONAL);
- menu.add(M_DIRECTIONAL);
- menu.addActionListener(this);
- add(menu);
-
- addMouseListener(this);
- addMouseMotionListener(this);
- }
-
- public void doCleanup()
- {
- removeMouseListener(this);
- removeMouseMotionListener(this);
- menu.removeActionListener(this);
- }
-
- public void reshape(int width, int height)
- {
- gl.glViewport(0,0,width,height);
- }
-
- public void display()
- {
- if (glj.gljMakeCurrent() == false) return;
-
- if (!isSuspended())
- {
- long ltime =
- System.currentTimeMillis() % 3142L; //approximate 2*PI*500
- float time = (float)(((double)ltime)/500.0);
- jump = 4.0f * (float)Math.abs(Math.sin(time)*0.5);
- if (!lightMoving) lightAngle += 0.0f;
- }
-
- /* Clear; default stencil clears to zero. */
- if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow))
- gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- else
- /* Avoid clearing stencil when not using it. */
- gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- /* Reposition the light source. */
- lightPosition[0] = 12*(float)Math.cos(lightAngle);
- lightPosition[1] = lightHeight;
- lightPosition[2] = 12*(float)Math.sin(lightAngle);
- if (directionalLight)
- lightPosition[3] = 0.0f;
- else
- lightPosition[3] = 1.0f;
-
- shadowMatrix(floorShadow, floorPlane, lightPosition);
-
- gl.glPushMatrix();
-
- /* Perform scene rotations based on user mouse input. */
- gl.glRotatef(angle2, 1.0f, 0.0f, 0.0f);
- gl.glRotatef(angle, 0.0f, 1.0f, 0.0f);
-
- /* Tell GL new light source position. */
- gl.glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-
- if (renderReflection)
- {
- if (stencilReflection)
- {
- /* We can eliminate the visual "artifact" of seeing the "flipped"
- dinosaur underneath the floor by using stencil. The idea is
- draw the floor without color or depth update but so that
- a stencil value of one is where the floor will be. Later when
- rendering the dinosaur reflection, we will only update pixels
- with a stencil value of 1 to make sure the reflection only
- lives on the floor, not below the floor. */
-
- /* Don't update color or depth. */
- gl.glDisable(GL_DEPTH_TEST);
- gl.glColorMask(false, false, false, false);
-
- /* Draw 1 into the stencil buffer. */
- gl.glEnable(GL_STENCIL_TEST);
- gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
- gl.glStencilFunc(GL_ALWAYS, 1, 0xffffffff);
-
- /* Now render floor; floor pixels just get their stencil set to 1. */
- drawFloor();
-
- /* Re-enable update of color and depth. */
- gl.glColorMask(true, true, true, true);
- gl.glEnable(GL_DEPTH_TEST);
-
- /* Now, only render where stencil is set to 1. */
- gl.glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */
- gl.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- }
-
- gl.glPushMatrix();
-
- /* The critical reflection step: Reflect dinosaur through the floor
- (the Y=0 plane) to make a relection. */
-
- gl.glScalef(1.0f, -1.0f, 1.0f);
-
- /* Reflect the light position. */
- gl.glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-
- /* To avoid our normals getting reversed and hence botched lighting
- on the reflection, turn on normalize. */
- gl.glEnable(GL_NORMALIZE);
- gl.glCullFace(GL_FRONT);
-
- /* Draw the reflected dinosaur. */
- drawDinosaur();
-
- /* Disable noramlize again and re-enable back face culling. */
- gl.glDisable(GL_NORMALIZE);
- gl.glCullFace(GL_BACK);
-
- gl.glPopMatrix();
-
- /* Switch back to the unreflected light position. */
- gl.glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-
- if (stencilReflection) gl.glDisable(GL_STENCIL_TEST);
- }
-
- /* Back face culling will get used to only draw either the top or the
- bottom floor. This let's us get a floor with two distinct
- appearances. The top floor surface is reflective and kind of red.
- The bottom floor surface is not reflective and blue. */
-
- /* Draw "bottom" of floor in blue. */
- gl.glFrontFace(GL_CW); /* Switch face orientation. */
- gl.glColor4f(0.1f, 0.1f, 0.7f, 1.0f);
- drawFloor();
- gl.glFrontFace(GL_CCW);
-
- if (renderShadow)
- {
- if (stencilShadow)
- {
- /* Draw the floor with stencil value 3. This helps us only
- draw the shadow once per floor pixel (and only on the
- floor pixels). */
- gl.glEnable(GL_STENCIL_TEST);
- gl.glStencilFunc(GL_ALWAYS, 3, 0xffffffff);
- gl.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
- }
- }
-
- /* Draw "top" of floor. Use blending to blend in reflection. */
- gl.glEnable(GL_BLEND);
- gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- gl.glColor4f(0.7f, 0.0f, 0.0f, 0.3f);
- gl.glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
- drawFloor();
- gl.glDisable(GL_BLEND);
-
- /* Draw "actual" dinosaur, not its reflection. */
- if (renderDinosaur) drawDinosaur();
-
- if (renderShadow)
- {
- /* Render the projected shadow. */
- if (stencilShadow)
- {
- /* Now, only render where stencil is set above 2 (ie, 3 where
- the top floor is). Update stencil with 2 where the shadow
- gets drawn so we don't redraw (and accidently reblend) the
- shadow). */
- gl.glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */
- gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
- }
- /* To eliminate depth buffer artifacts, we use polygon offset
- to raise the depth of the projected shadow slightly so
- that it does not depth buffer alias with the floor. */
- if (offsetShadow) gl.glEnable(GL_POLYGON_OFFSET_FILL);
-
- /* Render 50% black shadow color on top of whatever the
- floor appareance is. */
- gl.glEnable(GL_BLEND);
- gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- gl.glDisable(GL_LIGHTING); /* Force the 50% black. */
- gl.glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
-
- gl.glPushMatrix();
- /* Project the shadow. */
- gl.glMultMatrixf(floorShadow);
- drawDinosaur();
- gl.glPopMatrix();
-
- gl.glDisable(GL_BLEND);
- gl.glEnable(GL_LIGHTING);
-
- if (offsetShadow) gl.glDisable(GL_POLYGON_OFFSET_FILL);
- if (stencilShadow) gl.glDisable(GL_STENCIL_TEST);
- }
-
- gl.glPushMatrix();
- gl.glDisable(GL_LIGHTING);
- gl.glColor3f(1.0f, 1.0f, 0.0f);
- if (directionalLight)
- {
- /* Draw an arrowhead. */
- gl.glDisable(GL_CULL_FACE);
- gl.glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
- gl.glRotatef(lightAngle * (float)(-180.0 / M_PI), 0, 1, 0);
- gl.glRotatef((float)Math.atan(lightHeight/12) * (float)(180.0 / M_PI), 0, 0, 1);
- gl.glBegin(GL_TRIANGLE_FAN);
- gl.glVertex3f(0, 0, 0);
- gl.glVertex3f(2, 1, 1);
- gl.glVertex3f(2, -1, 1);
- gl.glVertex3f(2, -1, -1);
- gl.glVertex3f(2, 1, -1);
- gl.glVertex3f(2, 1, 1);
- gl.glEnd();
- /* Draw a white line from light direction. */
- gl.glColor3f(1.0f, 1.0f, 1.0f);
- gl.glBegin(GL_LINES);
- gl.glVertex3f(0, 0, 0);
- gl.glVertex3f(5, 0, 0);
- gl.glEnd();
- gl.glEnable(GL_CULL_FACE);
- }
- else
- {
- /* Draw a yellow ball at the light source. */
- gl.glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
- long qobj = glu.gluNewQuadric();
- glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
- glu.gluQuadricNormals(qobj,GLU_SMOOTH);
- glu.gluQuadricTexture(qobj,false);
- glu.gluSphere(qobj,1.0f,5,5);
- glu.gluDeleteQuadric(qobj);
- }
- gl.glEnable(GL_LIGHTING);
- gl.glPopMatrix();
-
- gl.glPopMatrix();
-
- glj.gljSwap();
- glj.gljCheckGL();
- glj.gljFree();
-
- // if (!isSuspended()) repaint(); // Animate at full speed.
- }
-
- private void makeDinosaur()
- {
- extrudeSolidFromPolygon
- (bodyVerts,
- bodyTris,
- bodyWidth,
- BODY_SIDE,
- BODY_EDGE,
- BODY_WHOLE);
- extrudeSolidFromPolygon
- (armVerts,
- armTris,
- bodyWidth/4,
- ARM_SIDE,
- ARM_EDGE,
- ARM_WHOLE);
- extrudeSolidFromPolygon
- (legVerts,
- legTris,
- bodyWidth/2,
- LEG_SIDE,
- LEG_EDGE,
- LEG_WHOLE);
- extrudeSolidFromPolygon
- (eyeVerts,
- eyeTris,
- bodyWidth+0.2f,
- EYE_SIDE,
- EYE_EDGE,
- EYE_WHOLE);
- }
-
- private void drawDinosaur()
- {
- gl.glPushMatrix();
- /* Translate the dinosaur to be at (0,8,0). */
- gl.glTranslatef(-8, 0, -bodyWidth / 2);
- gl.glTranslatef(0.0f, jump, 0.0f);
- gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor);
- gl.glCallList(BODY_WHOLE);
- gl.glTranslatef(0.0f, 0.0f, bodyWidth);
- gl.glCallList(ARM_WHOLE);
- gl.glCallList(LEG_WHOLE);
- gl.glTranslatef(0.0f, 0.0f, -bodyWidth - bodyWidth / 4);
- gl.glCallList(ARM_WHOLE);
- gl.glTranslatef(0.0f, 0.0f, -bodyWidth / 4);
- gl.glCallList(LEG_WHOLE);
- gl.glTranslatef(0.0f, 0.0f, bodyWidth / 2 - 0.1f);
- gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor);
- gl.glCallList(EYE_WHOLE);
- gl.glPopMatrix();
- }
-
- private void makeFloorTexture()
- {
- /* Nice floor texture tiling pattern. */
- String circles[] =
- {
- "....xxxx........",
- "..xxxxxxxx......",
- ".xxxxxxxxxx.....",
- ".xxx....xxx.....",
- "xxx......xxx....",
- "xxx......xxx....",
- "xxx......xxx....",
- "xxx......xxx....",
- ".xxx....xxx.....",
- ".xxxxxxxxxx.....",
- "..xxxxxxxx......",
- "....xxxx........",
- "................",
- "................",
- "................",
- "................"
- };
- byte floorTexture[] = new byte[16*16*3];
-
- /* Setup RGB image for the texture. */
- int idx = 0;
- for (int t = 0; t < 16; t++)
- {
- for (int s = 0; s < 16; s++)
- {
- if (circles[t].charAt(s) == 'x')
- {
- /* Nice blue. */
- floorTexture[idx++] = (byte)0x1f;
- floorTexture[idx++] = (byte)0x1f;
- floorTexture[idx++] = (byte)0x8f;
- }
- else
- {
- /* Light gray. */
- floorTexture[idx++] = (byte)0xca;
- floorTexture[idx++] = (byte)0xca;
- floorTexture[idx++] = (byte)0xca;
- }
- }
- }
-
- gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
-// if (useMipmaps)
-// {
-// gl.glTexParameteri
-// (GL_TEXTURE_2D,
-// GL_TEXTURE_MIN_FILTER,
-// GL_LINEAR_MIPMAP_LINEAR);
-// glu.gluBuild2DMipmaps
-// (GL_TEXTURE_2D,3,16,16,GL_RGB,GL_UNSIGNED_BYTE,floorTexture);
-// }
-// else
- {
- if (linearFiltering)
- {
- gl.glTexParameteri
- (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gl.glTexParameteri
- (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else
- {
- gl.glTexParameteri
- (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- gl.glTexParameteri
- (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- gl.glTexImage2D
- (GL_TEXTURE_2D,0,3,16,16,0,GL_RGB,GL_UNSIGNED_BYTE,floorTexture);
- }
- }
-
- /* Draw a floor (possibly textured). */
- private void drawFloor()
- {
- gl.glDisable(GL_LIGHTING);
- if (useTexture) gl.glEnable(GL_TEXTURE_2D);
- gl.glBegin(GL_QUADS);
- gl.glTexCoord2f(0.0f, 0.0f);
- gl.glVertex3fv(floorVertices[0]);
- gl.glTexCoord2f(0.0f, 16.0f);
- gl.glVertex3fv(floorVertices[1]);
- gl.glTexCoord2f(16.0f, 16.0f);
- gl.glVertex3fv(floorVertices[2]);
- gl.glTexCoord2f(16.0f, 0.0f);
- gl.glVertex3fv(floorVertices[3]);
- gl.glEnd();
- if (useTexture) gl.glDisable(GL_TEXTURE_2D);
- gl.glEnable(GL_LIGHTING);
- }
-
- /* create a matrix that will project the desired shadow */
- void shadowMatrix(float shadowMat[], float groundplane[], float lightpos[])
- {
- float dot;
-
- /* find dot product between light position vector
- and ground plane normal */
- dot =
- groundplane[0] * lightpos[0] +
- groundplane[1] * lightpos[1] +
- groundplane[2] * lightpos[2] +
- groundplane[3] * lightpos[3];
-
- shadowMat[0] = dot - lightpos[0] * groundplane[0];
- shadowMat[4] = -lightpos[0] * groundplane[1];
- shadowMat[8] = -lightpos[0] * groundplane[2];
- shadowMat[12] = -lightpos[0] * groundplane[3];
-
- shadowMat[1] = -lightpos[1] * groundplane[0];
- shadowMat[5] = dot - lightpos[1] * groundplane[1];
- shadowMat[9] = -lightpos[1] * groundplane[2];
- shadowMat[13] = -lightpos[1] * groundplane[3];
-
- shadowMat[2] = -lightpos[2] * groundplane[0];
- shadowMat[6] = -lightpos[2] * groundplane[1];
- shadowMat[10] = dot - lightpos[2] * groundplane[2];
- shadowMat[14] = -lightpos[2] * groundplane[3];
-
- shadowMat[3] = -lightpos[3] * groundplane[0];
- shadowMat[7] = -lightpos[3] * groundplane[1];
- shadowMat[11] = -lightpos[3] * groundplane[2];
- shadowMat[15] = dot - lightpos[3] * groundplane[3];
- }
-
- /* find the plane equation given 3 points */
- void findPlane(float plane[], float v0[], float v1[], float v2[])
- {
- float vec0[] = new float[3], vec1[] = new float[3];
-
- /* need 2 vectors to find cross product */
- vec0[X] = v1[X] - v0[X];
- vec0[Y] = v1[Y] - v0[Y];
- vec0[Z] = v1[Z] - v0[Z];
-
- vec1[X] = v2[X] - v0[X];
- vec1[Y] = v2[Y] - v0[Y];
- vec1[Z] = v2[Z] - v0[Z];
-
- /* find cross product to get A, B, and C of plane equation */
- plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y];
- plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]);
- plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X];
- plane[D] = -(plane[A]*v0[X] + plane[B]*v0[Y] + plane[C]*v0[Z]);
- }
-
- /* Mark Kilgard's tessellation code from the "dino" demos.
- Bug fixes and re-write without GLU tesselator
- by Ronald B. Cemer */
- private void extrudeSolidFromPolygon
- (float data[][],
- int outlineTriIndices[][],
- float thickness,
- int side,
- int edge,
- int whole)
- {
- double dx, dy, len;
- int i, j0, j1, j2;
- int min, max, range;
- float x0, y0, x1, y1;
- int count = data.length;
- int tricount = outlineTriIndices.length;
-
- gl.glNewList(side, GL_COMPILE);
- gl.glShadeModel(GL_SMOOTH);
- gl.glBegin(GL_TRIANGLES);
- for (i = 0; i < tricount; i++)
- {
-/* *+*+* Note that we use the triangle indices in reverse order here
- because they are specified in reverse order in the arrays. */
- j0 = outlineTriIndices[i][2];
- j1 = outlineTriIndices[i][1];
- j2 = outlineTriIndices[i][0];
- gl.glVertex3f(data[j0][0],data[j0][1],0.0f);
- gl.glVertex3f(data[j1][0],data[j1][1],0.0f);
- gl.glVertex3f(data[j2][0],data[j2][1],0.0f);
- }
- gl.glEnd();
- gl.glEndList();
-
- gl.glNewList(edge, GL_COMPILE);
- gl.glShadeModel(GL_FLAT); /* flat shade keeps angular hands
- from being "smoothed" */
- for (min = max = 0; min < count; min = max)
- {
- for (max = min+1; max < count; max++)
- if (data[max][2] != 0.0f) break;
- range = max-min;
- gl.glBegin(GL_QUAD_STRIP);
- for (i = min; i <= max; i++)
- {
- j0 = i;
- j1 = i+1;
- if (j0 >= max) j0 -= range;
- if (j1 >= max) j1 -= range;
- x0 = data[j0][0];
- y0 = data[j0][1];
- x1 = data[j1][0];
- y1 = data[j1][1];
- gl.glVertex3f(x0, y0, 0.0f);
- gl.glVertex3f(x0, y0, thickness);
- // Normals
- dx = y1 - y0;
- dy = x0 - x1;
- len = Math.sqrt(dx * dx + dy * dy);
- gl.glNormal3f((float)(dx / len), (float)(dy / len), 0.0f);
- }
- gl.glEnd();
- }
- gl.glEndList();
-
- gl.glNewList(whole, GL_COMPILE);
- gl.glFrontFace(GL_CW);
-
- gl.glCallList(edge);
-
- gl.glNormal3f(0.0f, 0.0f, -1.0f);
- gl.glCallList(side);
- gl.glPushMatrix();
- gl.glTranslatef(0.0f, 0.0f, thickness);
- gl.glFrontFace(GL_CCW);
- gl.glNormal3f(0.0f, 0.0f, 1.0f);
- gl.glCallList(side);
- gl.glPopMatrix();
-
- gl.glEndList();
- }
-
- // Methods required for the implementation of MouseListener
- public void mouseEntered(MouseEvent evt)
- {
- }
-
- public void mouseExited(MouseEvent evt)
- {
- }
-
- public void mousePressed(MouseEvent evt)
- {
- // Left button moves view.
- // Both buttons moves light.
- // Right button pops up menu.
- if (!menu_showing)
- {
- if ((evt.getModifiers() & evt.BUTTON3_MASK) == 0)
- {
- moving = true;
- startx = evt.getX();
- starty = evt.getY();
- }
- else if (moving)
- {
- moving = false;
- lightMoving = true;
- lightStartX = evt.getX();
- lightStartY = evt.getY();
- }
- else
- {
- // Must be right mouse button.
- menu_showing = true;
- save_suspended = isSuspended();
- if (!save_suspended)
- {
- setSuspended(true);
- repaint(100);
- try
- {
- Thread.currentThread().sleep(200);
- }
- catch (Exception e)
- { }
- }
- menu.show(this,evt.getX(),evt.getY());
- }
- }
- else
- {
- menu_showing = false;
- setSuspended(save_suspended);
- }
- }
-
- public void mouseReleased(MouseEvent evt)
- {
- lightMoving = false;
- if ((evt.getModifiers() & evt.BUTTON3_MASK) == 0)
- {
- // Must be left button.
- moving = false;
- }
- }
-
- public void mouseClicked(MouseEvent evt)
- {
- }
-
- // Methods required for the implementation of MouseMotionListener
- public void mouseDragged(MouseEvent evt)
- {
- int x = evt.getX(), y = evt.getY();
- if (moving)
- {
- angle += (x - startx);
- while (angle < 0.0f) angle += 360.0f;
- while (angle >= 360.0f) angle -= 360.0f;
- angle2 += (y - starty);
- if (angle2 < -180.0f)
- angle2 = -180.0f;
- else if (angle2 > 180.0f)
- angle2 = 180.0f;
- startx = x;
- starty = y;
- if (isSuspended()) repaint();
- }
- else if (lightMoving)
- {
- lightAngle += (lightStartX - x)/40.0f;
- while (lightAngle < 0.0f) lightAngle += 360.0f;
- while (lightAngle >= 360.0f) lightAngle -= 360.0f;
- lightHeight += (lightStartY - y)/20.0f;
- lightStartX = x;
- lightStartY = y;
- if (isSuspended()) repaint();
- }
- }
-
- public void mouseMoved(MouseEvent evt)
- {
- }
-
- // Method required for the implementation of ActionListener
- public void actionPerformed(ActionEvent evt)
- {
- if (glj.gljMakeCurrent() == false) return;
- boolean dorepaint = false;
- String c = evt.getActionCommand();
-
- if (c.equals(M_MOTION))
- {
- if (menu_showing)
- save_suspended = !save_suspended;
- else
- setSuspended(!isSuspended());
- dorepaint = true;
- }
- else if (c.equals(M_LIGHT))
- {
- lightSwitch = !lightSwitch;
- if (lightSwitch)
- gl.glEnable(GL_LIGHT0);
- else
- gl.glDisable(GL_LIGHT0);
- dorepaint = true;
- }
- else if (c.equals(M_TEXTURE))
- {
- useTexture = !useTexture;
- dorepaint = true;
- }
- else if (c.equals(M_SHADOWS))
- {
- renderShadow = !renderShadow;
- dorepaint = true;
- }
- else if (c.equals(M_REFLECTION))
- {
- renderReflection = !renderReflection;
- dorepaint = true;
- }
- else if (c.equals(M_DINOSAUR))
- {
- renderDinosaur = !renderDinosaur;
- dorepaint = true;
- }
- else if (c.equals(M_STENCIL_REFLECTION))
- {
- stencilReflection = !stencilReflection;
- dorepaint = true;
- }
- else if (c.equals(M_STENCIL_SHADOW))
- {
- stencilShadow = !stencilShadow;
- dorepaint = true;
- }
- else if (c.equals(M_OFFSET_SHADOW))
- {
- offsetShadow = !offsetShadow;
- dorepaint = true;
- }
- else if (c.equals(M_POSITIONAL))
- {
- directionalLight = false;
- dorepaint = true;
- }
- else if (c.equals(M_DIRECTIONAL))
- {
- directionalLight = true;
- dorepaint = true;
- }
-
- glj.gljFree();
- if (menu_showing)
- {
- menu_showing = false;
- setSuspended(save_suspended);
- }
- if ( (isSuspended()) && (dorepaint) ) repaint();
- }
- }
-}
+ reshape(getSize().width, getSize().height);
+
+ makeDinosaur();
+
+ gl.glPolygonOffset(-2.0f, -1.0f);
+
+ gl.glEnable(GL_CULL_FACE);
+ gl.glEnable(GL_DEPTH_TEST);
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glLineWidth(3.0f);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ glu.gluPerspective
+ ( /* field of view in degree */ 40.0f,
+ /* aspect ratio */ 1.0f,
+ /* Z near */ 20.0f,
+ /* Z far */ 100.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ glu.gluLookAt
+ (0.0f, 8.0f, 60.0f, /* eye is at (0,8,60) */
+ 0.0f, 8.0f, 0.0f, /* center is at (0,8,0) */
+ 0.0f, 1.0f, 0.0f); /* up is in postivie Y direction */
+
+ gl.glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
+ gl.glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1f);
+ gl.glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05f);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_LIGHTING);
+
+ makeFloorTexture();
+
+ /* Setup floor plane for projected shadow calculations. */
+ findPlane
+ (floorPlane,
+ floorVertices[1],
+ floorVertices[2],
+ floorVertices[3]);
+
+ glj.gljCheckGL();
+
+ menu = new PopupMenu("Options");
+ menu.add(M_MOTION);
+ menu.add(M_NONE);
+ menu.add(M_LIGHT);
+ menu.add(M_TEXTURE);
+ menu.add(M_SHADOWS);
+ menu.add(M_REFLECTION);
+ menu.add(M_DINOSAUR);
+ menu.add(M_NONE);
+ menu.add(M_STENCIL_REFLECTION);
+ menu.add(M_STENCIL_SHADOW);
+ menu.add(M_OFFSET_SHADOW);
+ menu.add(M_NONE);
+ menu.add(M_POSITIONAL);
+ menu.add(M_DIRECTIONAL);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ }
+
+ public void doCleanup()
+ {
+ removeMouseListener(this);
+ removeMouseMotionListener(this);
+ menu.removeActionListener(this);
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glViewport(0,0,width,height);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ if (!isSuspended())
+ {
+ long ltime =
+ System.currentTimeMillis() % 3142L; //approximate 2*PI*500
+ float time = (float)(((double)ltime)/500.0);
+ jump = 4.0f * (float)Math.abs(Math.sin(time)*0.5);
+ if (!lightMoving) lightAngle += 0.0f;
+ }
+
+ /* Clear; default stencil clears to zero. */
+ if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow))
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ else
+ /* Avoid clearing stencil when not using it. */
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ /* Reposition the light source. */
+ lightPosition[0] = 12*(float)Math.cos(lightAngle);
+ lightPosition[1] = lightHeight;
+ lightPosition[2] = 12*(float)Math.sin(lightAngle);
+ if (directionalLight)
+ lightPosition[3] = 0.0f;
+ else
+ lightPosition[3] = 1.0f;
+
+ shadowMatrix(floorShadow, floorPlane, lightPosition);
+
+ gl.glPushMatrix();
+
+ /* Perform scene rotations based on user mouse input. */
+ gl.glRotatef(angle2, 1.0f, 0.0f, 0.0f);
+ gl.glRotatef(angle, 0.0f, 1.0f, 0.0f);
+
+ /* Tell GL new light source position. */
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
+
+ if (renderReflection)
+ {
+ if (stencilReflection)
+ {
+ /* We can eliminate the visual "artifact" of seeing the "flipped"
+ dinosaur underneath the floor by using stencil. The idea is
+ draw the floor without color or depth update but so that
+ a stencil value of one is where the floor will be. Later when
+ rendering the dinosaur reflection, we will only update pixels
+ with a stencil value of 1 to make sure the reflection only
+ lives on the floor, not below the floor. */
+
+ /* Don't update color or depth. */
+ gl.glDisable(GL_DEPTH_TEST);
+ gl.glColorMask(false, false, false, false);
+
+ /* Draw 1 into the stencil buffer. */
+ gl.glEnable(GL_STENCIL_TEST);
+ gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ gl.glStencilFunc(GL_ALWAYS, 1, 0xffffffff);
+
+ /* Now render floor; floor pixels just get their stencil set to 1. */
+ drawFloor();
+
+ /* Re-enable update of color and depth. */
+ gl.glColorMask(true, true, true, true);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ /* Now, only render where stencil is set to 1. */
+ gl.glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */
+ gl.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ }
+
+ gl.glPushMatrix();
+
+ /* The critical reflection step: Reflect dinosaur through the floor
+ (the Y=0 plane) to make a relection. */
+
+ gl.glScalef(1.0f, -1.0f, 1.0f);
+
+ /* Reflect the light position. */
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
+
+ /* To avoid our normals getting reversed and hence botched lighting
+ on the reflection, turn on normalize. */
+ gl.glEnable(GL_NORMALIZE);
+ gl.glCullFace(GL_FRONT);
+
+ /* Draw the reflected dinosaur. */
+ drawDinosaur();
+
+ /* Disable noramlize again and re-enable back face culling. */
+ gl.glDisable(GL_NORMALIZE);
+ gl.glCullFace(GL_BACK);
+
+ gl.glPopMatrix();
+
+ /* Switch back to the unreflected light position. */
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
+
+ if (stencilReflection) gl.glDisable(GL_STENCIL_TEST);
+ }
+
+ /* Back face culling will get used to only draw either the top or the
+ bottom floor. This let's us get a floor with two distinct
+ appearances. The top floor surface is reflective and kind of red.
+ The bottom floor surface is not reflective and blue. */
+
+ /* Draw "bottom" of floor in blue. */
+ gl.glFrontFace(GL_CW); /* Switch face orientation. */
+ gl.glColor4f(0.1f, 0.1f, 0.7f, 1.0f);
+ drawFloor();
+ gl.glFrontFace(GL_CCW);
+
+ if (renderShadow)
+ {
+ if (stencilShadow)
+ {
+ /* Draw the floor with stencil value 3. This helps us only
+ draw the shadow once per floor pixel (and only on the
+ floor pixels). */
+ gl.glEnable(GL_STENCIL_TEST);
+ gl.glStencilFunc(GL_ALWAYS, 3, 0xffffffff);
+ gl.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ }
+ }
+
+ /* Draw "top" of floor. Use blending to blend in reflection. */
+ gl.glEnable(GL_BLEND);
+ gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gl.glColor4f(0.7f, 0.0f, 0.0f, 0.3f);
+ gl.glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
+ drawFloor();
+ gl.glDisable(GL_BLEND);
+
+ /* Draw "actual" dinosaur, not its reflection. */
+ if (renderDinosaur) drawDinosaur();
+
+ if (renderShadow)
+ {
+ /* Render the projected shadow. */
+ if (stencilShadow)
+ {
+ /* Now, only render where stencil is set above 2 (ie, 3 where
+ the top floor is). Update stencil with 2 where the shadow
+ gets drawn so we don't redraw (and accidently reblend) the
+ shadow). */
+ gl.glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */
+ gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ }
+ /* To eliminate depth buffer artifacts, we use polygon offset
+ to raise the depth of the projected shadow slightly so
+ that it does not depth buffer alias with the floor. */
+ if (offsetShadow) gl.glEnable(GL_POLYGON_OFFSET_FILL);
+
+ /* Render 50% black shadow color on top of whatever the
+ floor appareance is. */
+ gl.glEnable(GL_BLEND);
+ gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gl.glDisable(GL_LIGHTING); /* Force the 50% black. */
+ gl.glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
+
+ gl.glPushMatrix();
+ /* Project the shadow. */
+ gl.glMultMatrixf(floorShadow);
+ drawDinosaur();
+ gl.glPopMatrix();
+
+ gl.glDisable(GL_BLEND);
+ gl.glEnable(GL_LIGHTING);
+
+ if (offsetShadow) gl.glDisable(GL_POLYGON_OFFSET_FILL);
+ if (stencilShadow) gl.glDisable(GL_STENCIL_TEST);
+ }
+
+ gl.glPushMatrix();
+ gl.glDisable(GL_LIGHTING);
+ gl.glColor3f(1.0f, 1.0f, 0.0f);
+ if (directionalLight)
+ {
+ /* Draw an arrowhead. */
+ gl.glDisable(GL_CULL_FACE);
+ gl.glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
+ gl.glRotatef(lightAngle * (float)(-180.0 / M_PI), 0, 1, 0);
+ gl.glRotatef((float)Math.atan(lightHeight/12) * (float)(180.0 / M_PI), 0, 0, 1);
+ gl.glBegin(GL_TRIANGLE_FAN);
+ gl.glVertex3f(0, 0, 0);
+ gl.glVertex3f(2, 1, 1);
+ gl.glVertex3f(2, -1, 1);
+ gl.glVertex3f(2, -1, -1);
+ gl.glVertex3f(2, 1, -1);
+ gl.glVertex3f(2, 1, 1);
+ gl.glEnd();
+ /* Draw a white line from light direction. */
+ gl.glColor3f(1.0f, 1.0f, 1.0f);
+ gl.glBegin(GL_LINES);
+ gl.glVertex3f(0, 0, 0);
+ gl.glVertex3f(5, 0, 0);
+ gl.glEnd();
+ gl.glEnable(GL_CULL_FACE);
+ }
+ else
+ {
+ /* Draw a yellow ball at the light source. */
+ gl.glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
+ long qobj = glu.gluNewQuadric();
+ glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
+ glu.gluQuadricNormals(qobj,GLU_SMOOTH);
+ glu.gluQuadricTexture(qobj,false);
+ glu.gluSphere(qobj,1.0f,5,5);
+ glu.gluDeleteQuadric(qobj);
+ }
+ gl.glEnable(GL_LIGHTING);
+ gl.glPopMatrix();
+
+ gl.glPopMatrix();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ // if (!isSuspended()) repaint(); // Animate at full speed.
+ }
+
+ private void makeDinosaur()
+ {
+ extrudeSolidFromPolygon
+ (bodyVerts,
+ bodyTris,
+ bodyWidth,
+ BODY_SIDE,
+ BODY_EDGE,
+ BODY_WHOLE);
+ extrudeSolidFromPolygon
+ (armVerts,
+ armTris,
+ bodyWidth/4,
+ ARM_SIDE,
+ ARM_EDGE,
+ ARM_WHOLE);
+ extrudeSolidFromPolygon
+ (legVerts,
+ legTris,
+ bodyWidth/2,
+ LEG_SIDE,
+ LEG_EDGE,
+ LEG_WHOLE);
+ extrudeSolidFromPolygon
+ (eyeVerts,
+ eyeTris,
+ bodyWidth+0.2f,
+ EYE_SIDE,
+ EYE_EDGE,
+ EYE_WHOLE);
+ }
+
+ private void drawDinosaur()
+ {
+ gl.glPushMatrix();
+ /* Translate the dinosaur to be at (0,8,0). */
+ gl.glTranslatef(-8, 0, -bodyWidth / 2);
+ gl.glTranslatef(0.0f, jump, 0.0f);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor);
+ gl.glCallList(BODY_WHOLE);
+ gl.glTranslatef(0.0f, 0.0f, bodyWidth);
+ gl.glCallList(ARM_WHOLE);
+ gl.glCallList(LEG_WHOLE);
+ gl.glTranslatef(0.0f, 0.0f, -bodyWidth - bodyWidth / 4);
+ gl.glCallList(ARM_WHOLE);
+ gl.glTranslatef(0.0f, 0.0f, -bodyWidth / 4);
+ gl.glCallList(LEG_WHOLE);
+ gl.glTranslatef(0.0f, 0.0f, bodyWidth / 2 - 0.1f);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor);
+ gl.glCallList(EYE_WHOLE);
+ gl.glPopMatrix();
+ }
+
+ private void makeFloorTexture()
+ {
+ /* Nice floor texture tiling pattern. */
+ String circles[] =
+ {
+ "....xxxx........",
+ "..xxxxxxxx......",
+ ".xxxxxxxxxx.....",
+ ".xxx....xxx.....",
+ "xxx......xxx....",
+ "xxx......xxx....",
+ "xxx......xxx....",
+ "xxx......xxx....",
+ ".xxx....xxx.....",
+ ".xxxxxxxxxx.....",
+ "..xxxxxxxx......",
+ "....xxxx........",
+ "................",
+ "................",
+ "................",
+ "................"
+ };
+ byte floorTexture[] = new byte[16*16*3];
+
+ /* Setup RGB image for the texture. */
+ int idx = 0;
+ for (int t = 0; t < 16; t++)
+ {
+ for (int s = 0; s < 16; s++)
+ {
+ if (circles[t].charAt(s) == 'x')
+ {
+ /* Nice blue. */
+ floorTexture[idx++] = (byte)0x1f;
+ floorTexture[idx++] = (byte)0x1f;
+ floorTexture[idx++] = (byte)0x8f;
+ }
+ else
+ {
+ /* Light gray. */
+ floorTexture[idx++] = (byte)0xca;
+ floorTexture[idx++] = (byte)0xca;
+ floorTexture[idx++] = (byte)0xca;
+ }
+ }
+ }
+
+ gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+// if (useMipmaps)
+// {
+// gl.glTexParameteri
+// (GL_TEXTURE_2D,
+// GL_TEXTURE_MIN_FILTER,
+// GL_LINEAR_MIPMAP_LINEAR);
+// glu.gluBuild2DMipmaps
+// (GL_TEXTURE_2D,3,16,16,GL_RGB,GL_UNSIGNED_BYTE,floorTexture);
+// }
+// else
+ {
+ if (linearFiltering)
+ {
+ gl.glTexParameteri
+ (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gl.glTexParameteri
+ (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ }
+ else
+ {
+ gl.glTexParameteri
+ (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ gl.glTexParameteri
+ (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ }
+ gl.glTexImage2D
+ (GL_TEXTURE_2D,0,3,16,16,0,GL_RGB,GL_UNSIGNED_BYTE,floorTexture);
+ }
+ }
+
+ /* Draw a floor (possibly textured). */
+ private void drawFloor()
+ {
+ gl.glDisable(GL_LIGHTING);
+ if (useTexture) gl.glEnable(GL_TEXTURE_2D);
+ gl.glBegin(GL_QUADS);
+ gl.glTexCoord2f(0.0f, 0.0f);
+ gl.glVertex3fv(floorVertices[0]);
+ gl.glTexCoord2f(0.0f, 16.0f);
+ gl.glVertex3fv(floorVertices[1]);
+ gl.glTexCoord2f(16.0f, 16.0f);
+ gl.glVertex3fv(floorVertices[2]);
+ gl.glTexCoord2f(16.0f, 0.0f);
+ gl.glVertex3fv(floorVertices[3]);
+ gl.glEnd();
+ if (useTexture) gl.glDisable(GL_TEXTURE_2D);
+ gl.glEnable(GL_LIGHTING);
+ }
+
+ /* create a matrix that will project the desired shadow */
+ void shadowMatrix(float shadowMat[], float groundplane[], float lightpos[])
+ {
+ float dot;
+
+ /* find dot product between light position vector
+ and ground plane normal */
+ dot =
+ groundplane[0] * lightpos[0] +
+ groundplane[1] * lightpos[1] +
+ groundplane[2] * lightpos[2] +
+ groundplane[3] * lightpos[3];
+
+ shadowMat[0] = dot - lightpos[0] * groundplane[0];
+ shadowMat[4] = -lightpos[0] * groundplane[1];
+ shadowMat[8] = -lightpos[0] * groundplane[2];
+ shadowMat[12] = -lightpos[0] * groundplane[3];
+
+ shadowMat[1] = -lightpos[1] * groundplane[0];
+ shadowMat[5] = dot - lightpos[1] * groundplane[1];
+ shadowMat[9] = -lightpos[1] * groundplane[2];
+ shadowMat[13] = -lightpos[1] * groundplane[3];
+
+ shadowMat[2] = -lightpos[2] * groundplane[0];
+ shadowMat[6] = -lightpos[2] * groundplane[1];
+ shadowMat[10] = dot - lightpos[2] * groundplane[2];
+ shadowMat[14] = -lightpos[2] * groundplane[3];
+
+ shadowMat[3] = -lightpos[3] * groundplane[0];
+ shadowMat[7] = -lightpos[3] * groundplane[1];
+ shadowMat[11] = -lightpos[3] * groundplane[2];
+ shadowMat[15] = dot - lightpos[3] * groundplane[3];
+ }
+
+ /* find the plane equation given 3 points */
+ void findPlane(float plane[], float v0[], float v1[], float v2[])
+ {
+ float vec0[] = new float[3], vec1[] = new float[3];
+
+ /* need 2 vectors to find cross product */
+ vec0[X] = v1[X] - v0[X];
+ vec0[Y] = v1[Y] - v0[Y];
+ vec0[Z] = v1[Z] - v0[Z];
+
+ vec1[X] = v2[X] - v0[X];
+ vec1[Y] = v2[Y] - v0[Y];
+ vec1[Z] = v2[Z] - v0[Z];
+
+ /* find cross product to get A, B, and C of plane equation */
+ plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y];
+ plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]);
+ plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X];
+ plane[D] = -(plane[A]*v0[X] + plane[B]*v0[Y] + plane[C]*v0[Z]);
+ }
+
+ /* Mark Kilgard's tessellation code from the "dino" demos.
+ Bug fixes and re-write without GLU tesselator
+ by Ronald B. Cemer */
+ private void extrudeSolidFromPolygon
+ (float data[][],
+ int outlineTriIndices[][],
+ float thickness,
+ int side,
+ int edge,
+ int whole)
+ {
+ double dx, dy, len;
+ int i, j0, j1, j2;
+ int min, max, range;
+ float x0, y0, x1, y1;
+ int count = data.length;
+ int tricount = outlineTriIndices.length;
+
+ gl.glNewList(side, GL_COMPILE);
+ gl.glShadeModel(GL_SMOOTH);
+ gl.glBegin(GL_TRIANGLES);
+ for (i = 0; i < tricount; i++)
+ {
+/* *+*+* Note that we use the triangle indices in reverse order here
+ because they are specified in reverse order in the arrays. */
+ j0 = outlineTriIndices[i][2];
+ j1 = outlineTriIndices[i][1];
+ j2 = outlineTriIndices[i][0];
+ gl.glVertex3f(data[j0][0],data[j0][1],0.0f);
+ gl.glVertex3f(data[j1][0],data[j1][1],0.0f);
+ gl.glVertex3f(data[j2][0],data[j2][1],0.0f);
+ }
+ gl.glEnd();
+ gl.glEndList();
+
+ gl.glNewList(edge, GL_COMPILE);
+ gl.glShadeModel(GL_FLAT); /* flat shade keeps angular hands
+ from being "smoothed" */
+ for (min = max = 0; min < count; min = max)
+ {
+ for (max = min+1; max < count; max++)
+ if (data[max][2] != 0.0f) break;
+ range = max-min;
+ gl.glBegin(GL_QUAD_STRIP);
+ for (i = min; i <= max; i++)
+ {
+ j0 = i;
+ j1 = i+1;
+ if (j0 >= max) j0 -= range;
+ if (j1 >= max) j1 -= range;
+ x0 = data[j0][0];
+ y0 = data[j0][1];
+ x1 = data[j1][0];
+ y1 = data[j1][1];
+ gl.glVertex3f(x0, y0, 0.0f);
+ gl.glVertex3f(x0, y0, thickness);
+ // Normals
+ dx = y1 - y0;
+ dy = x0 - x1;
+ len = Math.sqrt(dx * dx + dy * dy);
+ gl.glNormal3f((float)(dx / len), (float)(dy / len), 0.0f);
+ }
+ gl.glEnd();
+ }
+ gl.glEndList();
+
+ gl.glNewList(whole, GL_COMPILE);
+ gl.glFrontFace(GL_CW);
+
+ gl.glCallList(edge);
+
+ gl.glNormal3f(0.0f, 0.0f, -1.0f);
+ gl.glCallList(side);
+ gl.glPushMatrix();
+ gl.glTranslatef(0.0f, 0.0f, thickness);
+ gl.glFrontFace(GL_CCW);
+ gl.glNormal3f(0.0f, 0.0f, 1.0f);
+ gl.glCallList(side);
+ gl.glPopMatrix();
+
+ gl.glEndList();
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ // Left button moves view.
+ // Both buttons moves light.
+ // Right button pops up menu.
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) == 0)
+ {
+ moving = true;
+ startx = evt.getX();
+ starty = evt.getY();
+ }
+ else if (moving)
+ {
+ moving = false;
+ lightMoving = true;
+ lightStartX = evt.getX();
+ lightStartY = evt.getY();
+ }
+ else
+ {
+ // Must be right mouse button.
+ menu_showing = true;
+ save_suspended = isSuspended();
+ if (!save_suspended)
+ {
+ setSuspended(true);
+ repaint(100);
+ try
+ {
+ Thread.currentThread().sleep(200);
+ }
+ catch (Exception e)
+ { }
+ }
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ lightMoving = false;
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) == 0)
+ {
+ // Must be left button.
+ moving = false;
+ }
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ // Methods required for the implementation of MouseMotionListener
+ public void mouseDragged(MouseEvent evt)
+ {
+ int x = evt.getX(), y = evt.getY();
+ if (moving)
+ {
+ angle += (x - startx);
+ while (angle < 0.0f) angle += 360.0f;
+ while (angle >= 360.0f) angle -= 360.0f;
+ angle2 += (y - starty);
+ if (angle2 < -180.0f)
+ angle2 = -180.0f;
+ else if (angle2 > 180.0f)
+ angle2 = 180.0f;
+ startx = x;
+ starty = y;
+ if (isSuspended()) repaint();
+ }
+ else if (lightMoving)
+ {
+ lightAngle += (lightStartX - x)/40.0f;
+ while (lightAngle < 0.0f) lightAngle += 360.0f;
+ while (lightAngle >= 360.0f) lightAngle -= 360.0f;
+ lightHeight += (lightStartY - y)/20.0f;
+ lightStartX = x;
+ lightStartY = y;
+ if (isSuspended()) repaint();
+ }
+ }
+
+ public void mouseMoved(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (glj.gljMakeCurrent() == false) return;
+ boolean dorepaint = false;
+ String c = evt.getActionCommand();
+
+ if (c.equals(M_MOTION))
+ {
+ if (menu_showing)
+ save_suspended = !save_suspended;
+ else
+ setSuspended(!isSuspended());
+ dorepaint = true;
+ }
+ else if (c.equals(M_LIGHT))
+ {
+ lightSwitch = !lightSwitch;
+ if (lightSwitch)
+ gl.glEnable(GL_LIGHT0);
+ else
+ gl.glDisable(GL_LIGHT0);
+ dorepaint = true;
+ }
+ else if (c.equals(M_TEXTURE))
+ {
+ useTexture = !useTexture;
+ dorepaint = true;
+ }
+ else if (c.equals(M_SHADOWS))
+ {
+ renderShadow = !renderShadow;
+ dorepaint = true;
+ }
+ else if (c.equals(M_REFLECTION))
+ {
+ renderReflection = !renderReflection;
+ dorepaint = true;
+ }
+ else if (c.equals(M_DINOSAUR))
+ {
+ renderDinosaur = !renderDinosaur;
+ dorepaint = true;
+ }
+ else if (c.equals(M_STENCIL_REFLECTION))
+ {
+ stencilReflection = !stencilReflection;
+ dorepaint = true;
+ }
+ else if (c.equals(M_STENCIL_SHADOW))
+ {
+ stencilShadow = !stencilShadow;
+ dorepaint = true;
+ }
+ else if (c.equals(M_OFFSET_SHADOW))
+ {
+ offsetShadow = !offsetShadow;
+ dorepaint = true;
+ }
+ else if (c.equals(M_POSITIONAL))
+ {
+ directionalLight = false;
+ dorepaint = true;
+ }
+ else if (c.equals(M_DIRECTIONAL))
+ {
+ directionalLight = true;
+ dorepaint = true;
+ }
+
+ glj.gljFree();
+ if (menu_showing)
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ if ( (isSuspended()) && (dorepaint) ) repaint();
+ }
+ }
+}
diff --git a/demos/RonsDemos/shadowvol.java b/demos/RonsDemos/shadowvol.java
index f25d6dc..0344cfa 100644
--- a/demos/RonsDemos/shadowvol.java
+++ b/demos/RonsDemos/shadowvol.java
@@ -13,8 +13,11 @@ import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.*;
-import gl4java.GLContext;
-import gl4java.awt.GLCanvas;
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.drawable.*;
+import gl4java.applet.SimpleGLAnimApplet1;
+
public class shadowvol extends Applet
{
@@ -28,12 +31,27 @@ public class shadowvol extends Applet
/* Initialize the applet */
-
public void init()
{
Dimension d = getSize();
setLayout(new BorderLayout());
- canvas = new shadowvolCanvas(d.width, d.height);
+
+ GLCapabilities glCaps = new GLCapabilities();
+ glCaps.setStencilBits(16);
+
+ gl4java.drawable.GLDrawableFactory df =
+ gl4java.drawable.GLDrawableFactory.getFactory();
+
+ if(df instanceof gl4java.drawable.SunJDK13GLDrawableFactory)
+ {
+ gl4java.drawable.SunJDK13GLDrawableFactory sdf =
+ (gl4java.drawable.SunJDK13GLDrawableFactory)df;
+ canvas = new shadowvolCanvas
+ (sdf.getGraphicsConfiguration(glCaps), glCaps, d.width, d.height);
+ } else {
+ canvas = new shadowvolCanvas(glCaps, d.width, d.height);
+ }
+
add("Center", canvas);
}
@@ -69,6 +87,27 @@ public class shadowvol extends Applet
int n;
}
+ public static void main( String args[] )
+ {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = true;
+
+ Frame mainFrame = new Frame("shadowvol");
+
+ shadowvol applet = new shadowvol();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+
/* Local GLCanvas extension class */
@@ -91,18 +130,15 @@ public class shadowvol extends Applet
private ShadObj shadower = new ShadObj();
private int rendermode = SHADOW;
- public shadowvolCanvas(int w, int h)
+ public shadowvolCanvas(GraphicsConfiguration g, GLCapabilities glCaps,
+ int w, int h)
{
- super(w, h);
- GLContext.gljNativeDebug = false;
- GLContext.gljClassDebug = false;
+ super(g, glCaps, w, h);
}
- public void preInit()
+ public shadowvolCanvas(GLCapabilities glCaps, int w, int h)
{
- doubleBuffer = true;
- stereoView = false;
- stencilBits = 3;
+ super(glCaps, w, h);
}
public void init()
@@ -121,6 +157,8 @@ public class shadowvol extends Applet
gl.glEnable(GL_LIGHT0);
gl.glEnable(GL_CULL_FACE);
+ gl.glClearColor(0.0f, 0.1f, 0.1f, 0.0f);
+
/* place light 0 in the right place */
gl.glLightfv(GL_LIGHT0, GL_POSITION, lightpos);
@@ -205,15 +243,15 @@ public class shadowvol extends Applet
public void display()
{
+ System.out.println("display ..");
if (glj.gljMakeCurrent() == false) return;
+ System.out.println("display .. doit ");
-
-
-
gl.glClear
(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT);
+ glj.gljCheckGL();
switch (rendermode)
{
case NONE:
@@ -256,6 +294,9 @@ public class shadowvol extends Applet
break;
}
+ System.out.println("display .. done ");
+
+ glj.gljCheckGL();
glj.gljSwap();
glj.gljCheckGL();
glj.gljFree();
@@ -274,6 +315,7 @@ public class shadowvol extends Applet
{
rendermode++;
if (rendermode > SHADOW) rendermode = NONE;
+ System.out.println("mouse .. render mode: "+rendermode+", -> repaint");
repaint();
}
@@ -367,6 +409,7 @@ public class shadowvol extends Applet
/* render while jittering the shadows */
private void render(ShadObj obj)
{
+ glj.gljCheckGL();
float shad_mat[] = {10.f, 0.1f, 0.1f, 1.0f};
float v[] = new float[3];
/* material properties for objects in scene */
@@ -384,6 +427,7 @@ public class shadowvol extends Applet
/* Since we want to turn texturing on for floor only, we have
to make floor a separate glBegin()/glEnd() sequence. You
can't turn texturing on and off between begin and end calls */
+ glj.gljCheckGL();
gl.glBegin(GL_QUADS);
gl.glNormal3f(0.0f, 1.0f, 0.0f);
gl.glTexCoord2i(0, 0);
@@ -431,6 +475,7 @@ public class shadowvol extends Applet
gl.glEnd();
+ glj.gljCheckGL();
cone();
sphere();
@@ -453,6 +498,7 @@ public class shadowvol extends Applet
gl.glVertex3fv(v);
}
gl.glEnd();
+ glj.gljCheckGL();
}
}
}
diff --git a/gl4java/GLContext.java.skel b/gl4java/GLContext.java.skel
index 56750cc..c011f94 100644
--- a/gl4java/GLContext.java.skel
+++ b/gl4java/GLContext.java.skel
@@ -319,60 +319,6 @@ public class GLContext extends Object
protected boolean offScreenRenderer = false;
/**
- * Do we use doubleBuffer - of course !
- * This is the default visual property ... !
- *
- * This is set via the constructor !
- *
- * @see gl4java.GLContext#isDoubleBuffer
- * @see gl4java.GLContext#GLContext
- */
- protected boolean doubleBuffer = true;
-
- /**
- * Visual pre-set for stencil-bit number, default: 0
- *
- * @see gl4java.GLContext#GLContext
- */
- protected int stencilBits = 0;
-
- /**
- * Visual pre-set for accumulator-size number, default: 0
- *
- * This value has a special behavior.
- * For input - within the contructor,
- * it is the value for each component !
- *
- * The output value, after the constructor returns,
- * it is the summary of all accumulation bits of all components !
- *
- * @see gl4java.GLContext#GLContext
- */
- protected int accumSize = 0;
-
- /**
- * Do we use stereoView - not yet ;-) !
- * This is the default visual property ... !
- *
- * This is set via the constructor !
- *
- * @see gl4java.GLContext#isStereoView
- * @see gl4java.GLContext#GLContext
- */
- protected boolean stereoView = false;
-
- /**
- * Do we use True-Color RGBA - of course ;-) !
- * This is the default visual property ... !
- *
- * This is set via the constructor !
- *
- * @see gl4java.GLContext#isRGBA
- * @see gl4java.GLContext#GLContext
- */
- protected boolean rgba = true;
-
- /**
* We normally do not have to create an own Window !
* This is the default visual property ... !
* But some machines, like SGI's Irix,
@@ -388,6 +334,15 @@ public class GLContext extends Object
protected boolean createOwnWindow = false;
/**
+ * The GLCapabilities ..
+ *
+ * This is set via the constructor !
+ *
+ * @see gl4java.GLContext#GLContext
+ */
+ protected GLCapabilities glCaps = null;
+
+ /**
* The resize flag, which indicates a resize for the next paint function !
* This flag will bes set in 'componentResized'
* and will be cleared after resize (glViewport) in sDisplay !!
@@ -475,56 +430,74 @@ public class GLContext extends Object
* @see gl4java.GLContext#OsX11
* @see gl4java.GLContext#OsMac
*/
- public final int getNativeOSType() { return osType; }
+ public static int getNativeOSType() { return osType; }
+
+ public static String getNativeOSName() { return osName; }
/**
* Query the visual property ... !
*
* After a GLContext is created, this property can be queried !
*
- * @see gl4java.GLContext#doubleBuffer
+ * @see gl4java.GLContext#glCaps
* @see gl4java.GLContext#GLContext
*/
- public final boolean isDoubleBuffer() { return doubleBuffer; }
+ public final GLCapabilities getGLCapabilities() { return glCaps; }
/**
* Query the visual property ... !
*
* After a GLContext is created, this property can be queried !
*
- * @see gl4java.GLContext#stereoView
+ * @see gl4java.GLContext#glCaps
* @see gl4java.GLContext#GLContext
*/
- public final int getStencilBitNumber() { return stencilBits; }
+ public final boolean isDoubleBuffer() { return glCaps.getDoubleBuffered(); }
/**
* Query the visual property ... !
*
* After a GLContext is created, this property can be queried !
*
+ * @see gl4java.GLContext#glCaps
* @see gl4java.GLContext#GLContext
*/
- public final int getAccumSize() { return accumSize; }
+ public final int getStencilBitNumber() { return glCaps.getStencilBits(); }
/**
* Query the visual property ... !
*
* After a GLContext is created, this property can be queried !
*
- * @see gl4java.GLContext#stereoView
+ * @see gl4java.GLContext#glCaps
* @see gl4java.GLContext#GLContext
*/
- public final boolean isStereoView() { return stereoView; }
+ public final int getAccumSize()
+ { return glCaps.getAccumRedBits()+
+ glCaps.getAccumGreenBits()+
+ glCaps.getAccumBlueBits()+
+ glCaps.getAccumAlphaBits();
+ }
/**
* Query the visual property ... !
*
* After a GLContext is created, this property can be queried !
*
- * @see gl4java.GLContext#rgba
+ * @see gl4java.GLContext#glCaps
* @see gl4java.GLContext#GLContext
*/
- public final boolean isRGBA() { return rgba; }
+ public final boolean isStereoView() { return glCaps.getStereo(); }
+
+ /**
+ * Query the visual property ... !
+ *
+ * After a GLContext is created, this property can be queried !
+ *
+ * @see gl4java.GLContext#glCaps
+ * @see gl4java.GLContext#GLContext
+ */
+ public final boolean isRGBA() { return glCaps.getTrueColor(); }
/**
* Query the visual property ... !
@@ -578,9 +551,10 @@ public class GLContext extends Object
String gluLibName
)
{
- System.out.println("GLContext.loadNativeLibraries ...");
if(libsLoaded) return true;
- System.out.println("GLContext.loadNativeLibraries will do it !");
+
+ if(gljClassDebug)
+ System.out.println("GLContext.loadNativeLibraries will do it !");
String libNames[] = null;
@@ -790,6 +764,7 @@ public class GLContext extends Object
String gluName = defGLUFuncClass;
boolean info=false;
boolean exitImmediatly=false;
+ boolean noFactory=false;
int i = 0;
boolean ok=true;
@@ -803,6 +778,7 @@ public class GLContext extends Object
System.out.println(" -gluclass <glu-class> \t choose a custom the gl4java-glu-class java GLUFunc implementation (default: GLUFuncJauJNI)");
System.out.println(" -info \t creates a GLContext and prints all avaiable information of GL/GLU and GL4Java");
System.out.println(" -infotxt \t like -info, but exits straight after -info !");
+ System.out.println(" -noFactory \t creates a GLContext without the new GLDrawableFactory API");
System.exit(0);
}
@@ -823,6 +799,8 @@ public class GLContext extends Object
} else if(args[i].equals("-infotxt")) {
info=true;
exitImmediatly=true;
+ } else if(args[i].equals("-noFactory")) {
+ noFactory=true;
} else {
System.out.println("illegal arg "+i+": "+args[i]);
ok=false;
@@ -860,7 +838,21 @@ public class GLContext extends Object
Frame f = new Frame("GL4Java Info");
f.setSize(10, 10);
- Canvas cvs = new Canvas();
+ Canvas cvs = null;
+ GLCapabilities glCaps = new GLCapabilities();
+ gl4java.drawable.GLDrawableFactory df =
+ gl4java.drawable.GLDrawableFactory.getFactory();
+
+ if(noFactory ||
+ !(df instanceof gl4java.drawable.SunJDK13GLDrawableFactory)
+ )
+ {
+ cvs = new Canvas();
+ } else {
+ gl4java.drawable.SunJDK13GLDrawableFactory sdf =
+ (gl4java.drawable.SunJDK13GLDrawableFactory)df;
+ cvs = new Canvas(sdf.getGraphicsConfiguration(glCaps));
+ }
cvs.setVisible(true);
cvs.setSize(50,50);
f.add("Center", cvs);
@@ -869,7 +861,7 @@ public class GLContext extends Object
// f.pack();
f.setVisible(true);
- GLContext glj = new GLContext(cvs, gl, glu);
+ GLContext glj = new GLContext( cvs, gl, glu, glCaps, null);
Frame fInfo = glj.gljShowVersions();
@@ -891,6 +883,8 @@ public class GLContext extends Object
}
}
+ public static int getJVMVersionMajor() { return jvmVersionMajor; }
+ public static int getJVMVersionMinor() { return jvmVersionMinor; }
public static String getJVMVendor() { return jvmVendor; }
public static boolean isNetscapeJVM() { return isNetscapeJvm; }
public static boolean isMicrosoftJVM() { return isMicrosoftJvm; }
@@ -923,23 +917,17 @@ public class GLContext extends Object
* @param glf the users selected GLUFunc implementation
* @param _createOwnWindow the flag for the visual property
* @param _offScreenRenderer the flag for the visual property
- * @param _doubleBuffer the flag for the visual property
- * @param _stereoView the flag for the visual property
- * @param _rgba the flag for the visual property
- * @param _stencilBits the flag for the visual property
- * @param _accumSize the flag for the visual property
- * @param _sharedGLContext the shared GLContext
* @param _offScrnSize the fixed offscreen pixmap size
+ * @param _glCaps the GLCapabilities
+ * @param _sharedGLContext the shared GLContext
*
*/
protected GLContext( Component comp, GLFunc glf, GLUFunc gluf,
- boolean _createOwnWindow, boolean _offScreenRenderer,
- boolean _doubleBuffer, boolean _stereoView,
- boolean _rgba,
- int _stencilBits,
- int _accumSize,
- GLContext _sharedGLContext,
- Dimension _offScrnSize
+ boolean _createOwnWindow,
+ boolean _offScreenRenderer,
+ Dimension _offScrnSize,
+ GLCapabilities _glCaps,
+ GLContext _sharedGLContext
)
{
super( );
@@ -949,13 +937,10 @@ public class GLContext extends Object
glu = gluf ;
createOwnWindow = _createOwnWindow;
offScreenRenderer = _offScreenRenderer;
- doubleBuffer=_doubleBuffer;
- stereoView=_stereoView;
- rgba=_rgba;
- stencilBits=_stencilBits;
- accumSize=_accumSize;
offScrnSize= _offScrnSize;
+ glCaps = _glCaps;
+
this.sharedGLContext = _sharedGLContext;
if(sharedGLContext != null)
sharedGLContextNative =
@@ -1009,6 +994,77 @@ public class GLContext extends Object
System.out.println("GLContext GLContext() failed");
}
}
+ /**
+ *
+ * Constructor
+ *
+ * This privat constructor is for all possible
+ * compinations and is called from the customized
+ * constructors.
+ *
+ * First the GLContext is fetched from the Component itself !
+ * To do so, the Component is set visible if it is not !
+ *
+ * If a GLContext is fetched, it is current !
+ *
+ * @param comp the users component for the gl-context
+ * @param glf the users selected GLFunc implementation
+ * @param glf the users selected GLUFunc implementation
+ * @param _createOwnWindow the flag for the visual property
+ * @param _offScreenRenderer the flag for the visual property
+ * @param _doubleBuffer the flag for the visual property
+ * @param _stereoView the flag for the visual property
+ * @param _rgba the flag for the visual property
+ * @param _stencilBits the flag for the visual property
+ * @param _accumSize the flag for the visual property
+ * @param _sharedGLContext the shared GLContext
+ * @param _offScrnSize the fixed offscreen pixmap size
+ *
+ */
+ protected GLContext( Component comp, GLFunc glf, GLUFunc gluf,
+ boolean _createOwnWindow, boolean _offScreenRenderer,
+ boolean _doubleBuffer, boolean _stereoView,
+ boolean _rgba,
+ int _stencilBits,
+ int _accumSize,
+ GLContext _sharedGLContext,
+ Dimension _offScrnSize
+ )
+ {
+ this( comp, glf, gluf, _createOwnWindow,
+ _offScreenRenderer, _offScrnSize,
+ new GLCapabilities(_doubleBuffer, _stereoView,
+ _rgba, _stencilBits,
+ _accumSize, _accumSize,
+ _accumSize, _accumSize),
+ _sharedGLContext);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * First the GLContext is fetched from the Component itself !
+ * To do so, the Component is set visible if it is not !
+ *
+ * If a GLContext is fetched, it is current !
+ *
+ * @param comp the users component for the gl-context
+ * @param glf the users selected GLFunc implementation
+ * @param glf the users selected GLUFunc implementation
+ * @param _glCaps the GLCapabilities
+ * @param _sharedGLContext the shared GLContext
+ *
+ */
+ public GLContext( Component comp, GLFunc glf, GLUFunc gluf,
+ GLCapabilities _glCaps,
+ GLContext _sharedGLContext
+ )
+ {
+ this( comp, glf, gluf, false,
+ false, null, _glCaps,
+ _sharedGLContext);
+ }
/**
*
@@ -1719,6 +1775,12 @@ public class GLContext extends Object
{
if( libsLoaded==false ) return ;
+ if(glCaps==null)
+ {
+ System.out.println("Internal error: glCaps not initialized !!");
+ throw new GL4JavaInitException ();
+ }
+
if(pData==0 && !offScreenRenderer && !useJAWT())
{
System.out.println("could not open a GL widget -- Win CONTEXT");
@@ -2252,7 +2314,7 @@ public class GLContext extends Object
return gljSwapNative( displayHandle,
windowHandle,
glContext,
- doubleBuffer);
+ glCaps.getDoubleBuffered());
}
private static final native boolean gljSwapNative( long disp,
@@ -2396,6 +2458,10 @@ public class GLContext extends Object
if(libsLoaded==false || gl==null || glu==null || !gljIsInit())
return null;
+ String jvmstr = "Java Virtual Machine: Version "+ getJVMVersionMajor()+
+ "." + getJVMVersionMinor() +", Vendor: "+
+ getJVMVendor() + "\n" ;
+
String info1= "GL4Java - LGPL-Version" + "\n" +
"-------------------------------------------------\n" +
"-------------------------------------------------\n" +
@@ -2420,6 +2486,8 @@ public class GLContext extends Object
" Version: "+glu.getNativeVersion() + "\n" +
" Vendor : "+glu.getNativeVendor() + "\n" +
"-------------------------------------------------\n" +
+ "\n"+
+ jvmstr +
"\n" ;
String glVen = gl.glGetString(GLFunc.GL_VENDOR);
diff --git a/gl4java/GLUFuncJauJNI.java b/gl4java/GLUFuncJauJNI.java
index 5ba2f08..d0a29ea 100644
--- a/gl4java/GLUFuncJauJNI.java
+++ b/gl4java/GLUFuncJauJNI.java
@@ -32,7 +32,7 @@ public final String getClassVendor ( )
{ return "Jausoft - Sven Goethel Software Development"; }
public final String getClassVersion ( )
-{ return "2.4.1.0"; }
+{ return "2.5.2.0"; }
/**
@@ -819,7 +819,7 @@ public final native long gluNewTess( );
) ;
/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */
-
-
-}
-
+
+
+}
+
diff --git a/gl4java/GLUFuncJauJNInf.java b/gl4java/GLUFuncJauJNInf.java
index f509fe4..046e6df 100644
--- a/gl4java/GLUFuncJauJNInf.java
+++ b/gl4java/GLUFuncJauJNInf.java
@@ -1,825 +1,825 @@
-/* WARNING ! WARNING *** THIS FILE IS GENERATED BY C2J !!!
-
- DO NOT MAKE ANY CHANGES *** MAKE CHANGES IN THE SKELETON FILES !!!
-*/
-
-
-/**
- * @(#) GLUFuncJauJNInf.java
- */
-
-
-package gl4java;
-
-/**
- * The default implementation class for GLU native function mapping
- *
- * @version 2.00, 21. April 1999
- * @author Sven Goethel
- */
-public class GLUFuncJauJNInf
- implements GLUFunc
-{
-
-
-public native String gluErrorString ( int errorCode ) ;
-public native String gluGetString ( int name ) ;
-
-public native String getNativeVendor ( ) ;
-public native String getNativeVersion ( ) ;
-
-public String getClassVendor ( )
-{ return "Jausoft - Sven Goethel Software Development"; }
-
-public String getClassVersion ( )
-{ return "2.4.1.0"; }
-
-
-/**
- * The Callback registry function.
- * To achieve the signature (internal argument signature)
- * you can use the "javap -s <classname>" toolkit of the JDK !
- *
- * @param qobj the quadratic id, fetch with gluNewQuadric
- * @param which the id for the callback type
- * @param methodClassInstance the class instance,
- * which implements the callback-method
- * @param methodName the name of the callback-method
- * @param signature the signature of the callback-method.
- *
- * @see GLUFunc#gluNewQuadric
- */
-public native void gluQuadricCallback(
- long qobj, int which,
- Object methodClassInstance,
- String methodName,
- String signature
- );
-
-/**
- * The Callback registry function.
- * To achieve the signature (internal argument signature)
- * you can use the "javap -s <classname>" toolkit of the JDK !
- *
- * @param nobj the nurbs id, fetch with gluNewNurbsRenderer
- * @param which the id for the callback type
- * @param methodClassInstance the class instance,
- * which implements the callback-method
- * @param methodName the name of the callback-method
- * @param signature the signature of the callback-method.
- *
- * @see GLUFunc#gluNewNurbsRenderer
- */
-public native void gluNurbsCallback(
- long nobj, int which,
- Object methodClassInstance,
- String methodName,
- String signature
- );
-
-
-/**
- * The Callback registry function.
- * To achieve the signature (internal argument signature)
- * you can use the "javap -s <classname>" toolkit of the JDK !
- *
- * @param tobj the tesselation id, fetch with gluNewTess
- * @param which the id for the callback type
- * @param methodClassInstance the class instance,
- * which implements the callback-method
- * @param methodName the name of the callback-method
- * @param signature the signature of the callback-method.
- * @param voidArrayLen1 the optional length of the 1st array
- * in the callback-methods argument-list
- * @param voidArrayLen2 the optional length of the 2nd array
- * in the callback-methods argument-list
- * @param voidArrayLen3 the optional length of the 3rd array
- * in the callback-methods argument-list
- * @param voidArrayLen4 the optional length of the 4th array
- * in the callback-methods argument-list
- * @param voidArrayLen5 the optional length of the 5th array
- * in the callback-methods argument-list
- *
- * @see GLUFunc#gluNewTess
- */
-public native void gluTessCallback(
- long tobj, int which,
- Object methodClassInstance,
- String methodName,
- String signature,
- int voidArrayLen1,
- int voidArrayLen2,
- int voidArrayLen3,
- int voidArrayLen4,
- int voidArrayLen5
- );
-
-/**
- * The Callback de-registry function.
- *
- * @param qobj the quadratic id, for which all callback-methods
- * should be de-registered
- */
-public native void gluDeleteQuadric( long qobj );
-
-/**
- * The Callback de-registry function.
- *
- * @param nobj the nurbs id, for which all callback-methods
- * should be de-registered
- */
-public native void gluDeleteNurbsRenderer( long nobj );
-
-/**
- * The Callback de-registry function.
- *
- * @param tobj the tesselation id, for which all callback-methods
- * should be de-registered
- */
-public native void gluDeleteTess( long tobj );
-
-public native long gluNewQuadric( );
-public native long gluNewNurbsRenderer( );
-public native long gluNewTess( );
-
-/**
- * C2J Parser Version 1.5 Beta
- * Jausoft - Sven Goethel Software Development
- * Reading from file: glu-proto-auto.orig.h . . .
- * Destination-Class: gl4java_GLUFuncJauJNInf !
- */
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluLookAt ( GLdouble eyex , GLdouble eyey , GLdouble eyez , GLdouble centerx , GLdouble centery , GLdouble centerz , GLdouble upx , GLdouble upy , GLdouble upz ) ;
- * </pre>
- */
- public native void gluLookAt (
- double eyex,
- double eyey,
- double eyez,
- double centerx,
- double centery,
- double centerz,
- double upx,
- double upy,
- double upz
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluOrtho2D ( GLdouble left , GLdouble right , GLdouble bottom , GLdouble top ) ;
- * </pre>
- */
- public native void gluOrtho2D (
- double left,
- double right,
- double bottom,
- double top
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPerspective ( GLdouble fovy , GLdouble aspect , GLdouble zNear , GLdouble zFar ) ;
- * </pre>
- */
- public native void gluPerspective (
- double fovy,
- double aspect,
- double zNear,
- double zFar
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPickMatrix ( GLdouble x , GLdouble y , GLdouble width , GLdouble height , GLint * viewport ) ;
- * </pre>
- */
- public native void gluPickMatrix (
- double x,
- double y,
- double width,
- double height,
- int[] viewport
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluProject ( GLdouble objx , GLdouble objy , GLdouble objz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * winx , GLdouble * winy , GLdouble * winz ) ;
- * </pre>
- */
- public native int gluProject (
- double objx,
- double objy,
- double objz,
- double[] modelMatrix,
- double[] projMatrix,
- int[] viewport,
- double[] winx,
- double[] winy,
- double[] winz
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluUnProject ( GLdouble winx , GLdouble winy , GLdouble winz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * objx , GLdouble * objy , GLdouble * objz ) ;
- * </pre>
- */
- public native int gluUnProject (
- double winx,
- double winy,
- double winz,
- double[] modelMatrix,
- double[] projMatrix,
- int[] viewport,
- double[] objx,
- double[] objy,
- double[] objz
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluScaleImage ( GLenum format , GLsizei widthin , GLsizei heightin , GLenum typein , const char * datain , GLsizei widthout , GLsizei heightout , GLenum typeout , char * dataout ) ;
- * </pre>
- */
- public native int gluScaleImage (
- int format,
- int widthin,
- int heightin,
- int typein,
- byte[] datain,
- int widthout,
- int heightout,
- int typeout,
- byte[] dataout
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluBuild1DMipmaps ( GLenum target , GLint components , GLint width , GLenum format , GLenum type , const void * data ) ;
- * </pre>
- */
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- byte[] data
- ) ;
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- short[] data
- ) ;
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- int[] data
- ) ;
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- float[] data
- ) ;
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- double[] data
- ) ;
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- boolean[] data
- ) ;
- public native int gluBuild1DMipmaps (
- int target,
- int components,
- int width,
- int format,
- int type,
- long[] data
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern GLint gluBuild2DMipmaps ( GLenum target , GLint components , GLint width , GLint height , GLenum format , GLenum type , const void * data ) ;
- * </pre>
- */
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- byte[] data
- ) ;
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- short[] data
- ) ;
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- int[] data
- ) ;
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- float[] data
- ) ;
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- double[] data
- ) ;
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- boolean[] data
- ) ;
- public native int gluBuild2DMipmaps (
- int target,
- int components,
- int width,
- int height,
- int format,
- int type,
- long[] data
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ;
- * </pre>
- */
- public native void gluQuadricDrawStyle (
- long quadObject,
- int drawStyle
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricOrientation ( GLUquadricObj * quadObject , GLenum orientation ) ;
- * </pre>
- */
- public native void gluQuadricOrientation (
- long quadObject,
- int orientation
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricNormals ( GLUquadricObj * quadObject , GLenum normals ) ;
- * </pre>
- */
- public native void gluQuadricNormals (
- long quadObject,
- int normals
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluQuadricTexture ( GLUquadricObj * quadObject , GLboolean textureCoords ) ;
- * </pre>
- */
- public native void gluQuadricTexture (
- long quadObject,
- boolean textureCoords
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluCylinder ( GLUquadricObj * qobj , GLdouble baseRadius , GLdouble topRadius , GLdouble height , GLint slices , GLint stacks ) ;
- * </pre>
- */
- public native void gluCylinder (
- long qobj,
- double baseRadius,
- double topRadius,
- double height,
- int slices,
- int stacks
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluSphere ( GLUquadricObj * qobj , GLdouble radius , GLint slices , GLint stacks ) ;
- * </pre>
- */
- public native void gluSphere (
- long qobj,
- double radius,
- int slices,
- int stacks
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops ) ;
- * </pre>
- */
- public native void gluDisk (
- long qobj,
- double innerRadius,
- double outerRadius,
- int slices,
- int loops
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPartialDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops , GLdouble startAngle , GLdouble sweepAngle ) ;
- * </pre>
- */
- public native void gluPartialDisk (
- long qobj,
- double innerRadius,
- double outerRadius,
- int slices,
- int loops,
- double startAngle,
- double sweepAngle
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ;
- * </pre>
- */
- public native void gluLoadSamplingMatrices (
- long nobj,
- float[] modelMatrix,
- float[] projMatrix,
- int[] viewport
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat value ) ;
- * </pre>
- */
- public native void gluNurbsProperty (
- long nobj,
- int property,
- float value
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluGetNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat * value ) ;
- * </pre>
- */
- public native void gluGetNurbsProperty (
- long nobj,
- int property,
- float[] value
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginCurve ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- public native void gluBeginCurve (
- long nobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndCurve ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- public native void gluEndCurve (
- long nobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNurbsCurve ( GLUnurbsObj * nobj , GLint nknots , GLfloat * knot , GLint stride , GLfloat * ctlarray , GLint order , GLenum type ) ;
- * </pre>
- */
- public native void gluNurbsCurve (
- long nobj,
- int nknots,
- float[] knot,
- int stride,
- float[] ctlarray,
- int order,
- int type
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginSurface ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- public native void gluBeginSurface (
- long nobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndSurface ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- public native void gluEndSurface (
- long nobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNurbsSurface ( GLUnurbsObj * nobj , GLint sknot_count , GLfloat * sknot , GLint tknot_count , GLfloat * tknot , GLint s_stride , GLint t_stride , GLfloat * ctlarray , GLint sorder , GLint torder , GLenum type ) ;
- * </pre>
- */
- public native void gluNurbsSurface (
- long nobj,
- int sknot_count,
- float[] sknot,
- int tknot_count,
- float[] tknot,
- int s_stride,
- int t_stride,
- float[] ctlarray,
- int sorder,
- int torder,
- int type
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginTrim ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- public native void gluBeginTrim (
- long nobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndTrim ( GLUnurbsObj * nobj ) ;
- * </pre>
- */
- public native void gluEndTrim (
- long nobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluPwlCurve ( GLUnurbsObj * nobj , GLint count , GLfloat * array , GLint stride , GLenum type ) ;
- * </pre>
- */
- public native void gluPwlCurve (
- long nobj,
- int count,
- float[] array,
- int stride,
- int type
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ;
- * </pre>
- */
- public native void gluTessBeginPolygon (
- long tobj,
- byte[] polygon_data
- ) ;
- public native void gluTessBeginPolygon (
- long tobj,
- short[] polygon_data
- ) ;
- public native void gluTessBeginPolygon (
- long tobj,
- int[] polygon_data
- ) ;
- public native void gluTessBeginPolygon (
- long tobj,
- float[] polygon_data
- ) ;
- public native void gluTessBeginPolygon (
- long tobj,
- double[] polygon_data
- ) ;
- public native void gluTessBeginPolygon (
- long tobj,
- boolean[] polygon_data
- ) ;
- public native void gluTessBeginPolygon (
- long tobj,
- long[] polygon_data
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessBeginContour ( GLUtesselator * tobj ) ;
- * </pre>
- */
- public native void gluTessBeginContour (
- long tobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessVertex ( GLUtesselator * tobj , GLdouble coords [ 3 ] , void * vertex_data ) ;
- * </pre>
- */
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- byte[] vertex_data
- ) ;
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- short[] vertex_data
- ) ;
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- int[] vertex_data
- ) ;
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- float[] vertex_data
- ) ;
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- double[] vertex_data
- ) ;
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- boolean[] vertex_data
- ) ;
- public native void gluTessVertex (
- long tobj,
- double[] coords,
- long[] vertex_data
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessEndContour ( GLUtesselator * tobj ) ;
- * </pre>
- */
- public native void gluTessEndContour (
- long tobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessEndPolygon ( GLUtesselator * tobj ) ;
- * </pre>
- */
- public native void gluTessEndPolygon (
- long tobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble value ) ;
- * </pre>
- */
- public native void gluTessProperty (
- long tobj,
- int which,
- double value
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluTessNormal ( GLUtesselator * tobj , GLdouble x , GLdouble y , GLdouble z ) ;
- * </pre>
- */
- public native void gluTessNormal (
- long tobj,
- double x,
- double y,
- double z
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluGetTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble * value ) ;
- * </pre>
- */
- public native void gluGetTessProperty (
- long tobj,
- int which,
- double[] value
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluBeginPolygon ( GLUtesselator * tobj ) ;
- * </pre>
- */
- public native void gluBeginPolygon (
- long tobj
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluNextContour ( GLUtesselator * tobj , GLenum type ) ;
- * </pre>
- */
- public native void gluNextContour (
- long tobj,
- int type
- ) ;
-
-/**
- * Original Function-Prototype :
- * <pre>
- extern void gluEndPolygon ( GLUtesselator * tobj ) ;
- * </pre>
- */
- public native void gluEndPolygon (
- long tobj
- ) ;
-
-/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */
-
-
-}
-
+/* WARNING ! WARNING *** THIS FILE IS GENERATED BY C2J !!!
+
+ DO NOT MAKE ANY CHANGES *** MAKE CHANGES IN THE SKELETON FILES !!!
+*/
+
+
+/**
+ * @(#) GLUFuncJauJNInf.java
+ */
+
+
+package gl4java;
+
+/**
+ * The default implementation class for GLU native function mapping
+ *
+ * @version 2.00, 21. April 1999
+ * @author Sven Goethel
+ */
+public class GLUFuncJauJNInf
+ implements GLUFunc
+{
+
+
+public native String gluErrorString ( int errorCode ) ;
+public native String gluGetString ( int name ) ;
+
+public native String getNativeVendor ( ) ;
+public native String getNativeVersion ( ) ;
+
+public String getClassVendor ( )
+{ return "Jausoft - Sven Goethel Software Development"; }
+
+public String getClassVersion ( )
+{ return "2.5.2.0"; }
+
+
+/**
+ * The Callback registry function.
+ * To achieve the signature (internal argument signature)
+ * you can use the "javap -s <classname>" toolkit of the JDK !
+ *
+ * @param qobj the quadratic id, fetch with gluNewQuadric
+ * @param which the id for the callback type
+ * @param methodClassInstance the class instance,
+ * which implements the callback-method
+ * @param methodName the name of the callback-method
+ * @param signature the signature of the callback-method.
+ *
+ * @see GLUFunc#gluNewQuadric
+ */
+public native void gluQuadricCallback(
+ long qobj, int which,
+ Object methodClassInstance,
+ String methodName,
+ String signature
+ );
+
+/**
+ * The Callback registry function.
+ * To achieve the signature (internal argument signature)
+ * you can use the "javap -s <classname>" toolkit of the JDK !
+ *
+ * @param nobj the nurbs id, fetch with gluNewNurbsRenderer
+ * @param which the id for the callback type
+ * @param methodClassInstance the class instance,
+ * which implements the callback-method
+ * @param methodName the name of the callback-method
+ * @param signature the signature of the callback-method.
+ *
+ * @see GLUFunc#gluNewNurbsRenderer
+ */
+public native void gluNurbsCallback(
+ long nobj, int which,
+ Object methodClassInstance,
+ String methodName,
+ String signature
+ );
+
+
+/**
+ * The Callback registry function.
+ * To achieve the signature (internal argument signature)
+ * you can use the "javap -s <classname>" toolkit of the JDK !
+ *
+ * @param tobj the tesselation id, fetch with gluNewTess
+ * @param which the id for the callback type
+ * @param methodClassInstance the class instance,
+ * which implements the callback-method
+ * @param methodName the name of the callback-method
+ * @param signature the signature of the callback-method.
+ * @param voidArrayLen1 the optional length of the 1st array
+ * in the callback-methods argument-list
+ * @param voidArrayLen2 the optional length of the 2nd array
+ * in the callback-methods argument-list
+ * @param voidArrayLen3 the optional length of the 3rd array
+ * in the callback-methods argument-list
+ * @param voidArrayLen4 the optional length of the 4th array
+ * in the callback-methods argument-list
+ * @param voidArrayLen5 the optional length of the 5th array
+ * in the callback-methods argument-list
+ *
+ * @see GLUFunc#gluNewTess
+ */
+public native void gluTessCallback(
+ long tobj, int which,
+ Object methodClassInstance,
+ String methodName,
+ String signature,
+ int voidArrayLen1,
+ int voidArrayLen2,
+ int voidArrayLen3,
+ int voidArrayLen4,
+ int voidArrayLen5
+ );
+
+/**
+ * The Callback de-registry function.
+ *
+ * @param qobj the quadratic id, for which all callback-methods
+ * should be de-registered
+ */
+public native void gluDeleteQuadric( long qobj );
+
+/**
+ * The Callback de-registry function.
+ *
+ * @param nobj the nurbs id, for which all callback-methods
+ * should be de-registered
+ */
+public native void gluDeleteNurbsRenderer( long nobj );
+
+/**
+ * The Callback de-registry function.
+ *
+ * @param tobj the tesselation id, for which all callback-methods
+ * should be de-registered
+ */
+public native void gluDeleteTess( long tobj );
+
+public native long gluNewQuadric( );
+public native long gluNewNurbsRenderer( );
+public native long gluNewTess( );
+
+/**
+ * C2J Parser Version 1.5 Beta
+ * Jausoft - Sven Goethel Software Development
+ * Reading from file: glu-proto-auto.orig.h . . .
+ * Destination-Class: gl4java_GLUFuncJauJNInf !
+ */
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluLookAt ( GLdouble eyex , GLdouble eyey , GLdouble eyez , GLdouble centerx , GLdouble centery , GLdouble centerz , GLdouble upx , GLdouble upy , GLdouble upz ) ;
+ * </pre>
+ */
+ public native void gluLookAt (
+ double eyex,
+ double eyey,
+ double eyez,
+ double centerx,
+ double centery,
+ double centerz,
+ double upx,
+ double upy,
+ double upz
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluOrtho2D ( GLdouble left , GLdouble right , GLdouble bottom , GLdouble top ) ;
+ * </pre>
+ */
+ public native void gluOrtho2D (
+ double left,
+ double right,
+ double bottom,
+ double top
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPerspective ( GLdouble fovy , GLdouble aspect , GLdouble zNear , GLdouble zFar ) ;
+ * </pre>
+ */
+ public native void gluPerspective (
+ double fovy,
+ double aspect,
+ double zNear,
+ double zFar
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPickMatrix ( GLdouble x , GLdouble y , GLdouble width , GLdouble height , GLint * viewport ) ;
+ * </pre>
+ */
+ public native void gluPickMatrix (
+ double x,
+ double y,
+ double width,
+ double height,
+ int[] viewport
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluProject ( GLdouble objx , GLdouble objy , GLdouble objz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * winx , GLdouble * winy , GLdouble * winz ) ;
+ * </pre>
+ */
+ public native int gluProject (
+ double objx,
+ double objy,
+ double objz,
+ double[] modelMatrix,
+ double[] projMatrix,
+ int[] viewport,
+ double[] winx,
+ double[] winy,
+ double[] winz
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluUnProject ( GLdouble winx , GLdouble winy , GLdouble winz , const GLdouble modelMatrix [ 16 ] , const GLdouble projMatrix [ 16 ] , const GLint viewport [ 4 ] , GLdouble * objx , GLdouble * objy , GLdouble * objz ) ;
+ * </pre>
+ */
+ public native int gluUnProject (
+ double winx,
+ double winy,
+ double winz,
+ double[] modelMatrix,
+ double[] projMatrix,
+ int[] viewport,
+ double[] objx,
+ double[] objy,
+ double[] objz
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluScaleImage ( GLenum format , GLsizei widthin , GLsizei heightin , GLenum typein , const char * datain , GLsizei widthout , GLsizei heightout , GLenum typeout , char * dataout ) ;
+ * </pre>
+ */
+ public native int gluScaleImage (
+ int format,
+ int widthin,
+ int heightin,
+ int typein,
+ byte[] datain,
+ int widthout,
+ int heightout,
+ int typeout,
+ byte[] dataout
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluBuild1DMipmaps ( GLenum target , GLint components , GLint width , GLenum format , GLenum type , const void * data ) ;
+ * </pre>
+ */
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ byte[] data
+ ) ;
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ short[] data
+ ) ;
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ int[] data
+ ) ;
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ float[] data
+ ) ;
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ double[] data
+ ) ;
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ boolean[] data
+ ) ;
+ public native int gluBuild1DMipmaps (
+ int target,
+ int components,
+ int width,
+ int format,
+ int type,
+ long[] data
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern GLint gluBuild2DMipmaps ( GLenum target , GLint components , GLint width , GLint height , GLenum format , GLenum type , const void * data ) ;
+ * </pre>
+ */
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ byte[] data
+ ) ;
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ short[] data
+ ) ;
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ int[] data
+ ) ;
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ float[] data
+ ) ;
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ double[] data
+ ) ;
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ boolean[] data
+ ) ;
+ public native int gluBuild2DMipmaps (
+ int target,
+ int components,
+ int width,
+ int height,
+ int format,
+ int type,
+ long[] data
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricDrawStyle ( GLUquadricObj * quadObject , GLenum drawStyle ) ;
+ * </pre>
+ */
+ public native void gluQuadricDrawStyle (
+ long quadObject,
+ int drawStyle
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricOrientation ( GLUquadricObj * quadObject , GLenum orientation ) ;
+ * </pre>
+ */
+ public native void gluQuadricOrientation (
+ long quadObject,
+ int orientation
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricNormals ( GLUquadricObj * quadObject , GLenum normals ) ;
+ * </pre>
+ */
+ public native void gluQuadricNormals (
+ long quadObject,
+ int normals
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluQuadricTexture ( GLUquadricObj * quadObject , GLboolean textureCoords ) ;
+ * </pre>
+ */
+ public native void gluQuadricTexture (
+ long quadObject,
+ boolean textureCoords
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluCylinder ( GLUquadricObj * qobj , GLdouble baseRadius , GLdouble topRadius , GLdouble height , GLint slices , GLint stacks ) ;
+ * </pre>
+ */
+ public native void gluCylinder (
+ long qobj,
+ double baseRadius,
+ double topRadius,
+ double height,
+ int slices,
+ int stacks
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluSphere ( GLUquadricObj * qobj , GLdouble radius , GLint slices , GLint stacks ) ;
+ * </pre>
+ */
+ public native void gluSphere (
+ long qobj,
+ double radius,
+ int slices,
+ int stacks
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops ) ;
+ * </pre>
+ */
+ public native void gluDisk (
+ long qobj,
+ double innerRadius,
+ double outerRadius,
+ int slices,
+ int loops
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPartialDisk ( GLUquadricObj * qobj , GLdouble innerRadius , GLdouble outerRadius , GLint slices , GLint loops , GLdouble startAngle , GLdouble sweepAngle ) ;
+ * </pre>
+ */
+ public native void gluPartialDisk (
+ long qobj,
+ double innerRadius,
+ double outerRadius,
+ int slices,
+ int loops,
+ double startAngle,
+ double sweepAngle
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluLoadSamplingMatrices ( GLUnurbsObj * nobj , const GLfloat modelMatrix [ 16 ] , const GLfloat projMatrix [ 16 ] , const GLint viewport [ 4 ] ) ;
+ * </pre>
+ */
+ public native void gluLoadSamplingMatrices (
+ long nobj,
+ float[] modelMatrix,
+ float[] projMatrix,
+ int[] viewport
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat value ) ;
+ * </pre>
+ */
+ public native void gluNurbsProperty (
+ long nobj,
+ int property,
+ float value
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluGetNurbsProperty ( GLUnurbsObj * nobj , GLenum property , GLfloat * value ) ;
+ * </pre>
+ */
+ public native void gluGetNurbsProperty (
+ long nobj,
+ int property,
+ float[] value
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginCurve ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ public native void gluBeginCurve (
+ long nobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndCurve ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ public native void gluEndCurve (
+ long nobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNurbsCurve ( GLUnurbsObj * nobj , GLint nknots , GLfloat * knot , GLint stride , GLfloat * ctlarray , GLint order , GLenum type ) ;
+ * </pre>
+ */
+ public native void gluNurbsCurve (
+ long nobj,
+ int nknots,
+ float[] knot,
+ int stride,
+ float[] ctlarray,
+ int order,
+ int type
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginSurface ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ public native void gluBeginSurface (
+ long nobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndSurface ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ public native void gluEndSurface (
+ long nobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNurbsSurface ( GLUnurbsObj * nobj , GLint sknot_count , GLfloat * sknot , GLint tknot_count , GLfloat * tknot , GLint s_stride , GLint t_stride , GLfloat * ctlarray , GLint sorder , GLint torder , GLenum type ) ;
+ * </pre>
+ */
+ public native void gluNurbsSurface (
+ long nobj,
+ int sknot_count,
+ float[] sknot,
+ int tknot_count,
+ float[] tknot,
+ int s_stride,
+ int t_stride,
+ float[] ctlarray,
+ int sorder,
+ int torder,
+ int type
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginTrim ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ public native void gluBeginTrim (
+ long nobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndTrim ( GLUnurbsObj * nobj ) ;
+ * </pre>
+ */
+ public native void gluEndTrim (
+ long nobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluPwlCurve ( GLUnurbsObj * nobj , GLint count , GLfloat * array , GLint stride , GLenum type ) ;
+ * </pre>
+ */
+ public native void gluPwlCurve (
+ long nobj,
+ int count,
+ float[] array,
+ int stride,
+ int type
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessBeginPolygon ( GLUtesselator * tobj , void * polygon_data ) ;
+ * </pre>
+ */
+ public native void gluTessBeginPolygon (
+ long tobj,
+ byte[] polygon_data
+ ) ;
+ public native void gluTessBeginPolygon (
+ long tobj,
+ short[] polygon_data
+ ) ;
+ public native void gluTessBeginPolygon (
+ long tobj,
+ int[] polygon_data
+ ) ;
+ public native void gluTessBeginPolygon (
+ long tobj,
+ float[] polygon_data
+ ) ;
+ public native void gluTessBeginPolygon (
+ long tobj,
+ double[] polygon_data
+ ) ;
+ public native void gluTessBeginPolygon (
+ long tobj,
+ boolean[] polygon_data
+ ) ;
+ public native void gluTessBeginPolygon (
+ long tobj,
+ long[] polygon_data
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessBeginContour ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ public native void gluTessBeginContour (
+ long tobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessVertex ( GLUtesselator * tobj , GLdouble coords [ 3 ] , void * vertex_data ) ;
+ * </pre>
+ */
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ byte[] vertex_data
+ ) ;
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ short[] vertex_data
+ ) ;
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ int[] vertex_data
+ ) ;
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ float[] vertex_data
+ ) ;
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ double[] vertex_data
+ ) ;
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ boolean[] vertex_data
+ ) ;
+ public native void gluTessVertex (
+ long tobj,
+ double[] coords,
+ long[] vertex_data
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessEndContour ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ public native void gluTessEndContour (
+ long tobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessEndPolygon ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ public native void gluTessEndPolygon (
+ long tobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble value ) ;
+ * </pre>
+ */
+ public native void gluTessProperty (
+ long tobj,
+ int which,
+ double value
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluTessNormal ( GLUtesselator * tobj , GLdouble x , GLdouble y , GLdouble z ) ;
+ * </pre>
+ */
+ public native void gluTessNormal (
+ long tobj,
+ double x,
+ double y,
+ double z
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluGetTessProperty ( GLUtesselator * tobj , GLenum which , GLdouble * value ) ;
+ * </pre>
+ */
+ public native void gluGetTessProperty (
+ long tobj,
+ int which,
+ double[] value
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluBeginPolygon ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ public native void gluBeginPolygon (
+ long tobj
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluNextContour ( GLUtesselator * tobj , GLenum type ) ;
+ * </pre>
+ */
+ public native void gluNextContour (
+ long tobj,
+ int type
+ ) ;
+
+/**
+ * Original Function-Prototype :
+ * <pre>
+ extern void gluEndPolygon ( GLUtesselator * tobj ) ;
+ * </pre>
+ */
+ public native void gluEndPolygon (
+ long tobj
+ ) ;
+
+/* C2J Parser Version 1.5 Beta: Java program parsed successfully. */
+
+
+}
+
diff --git a/gl4java/awt/GLAnimCanvas.java b/gl4java/awt/GLAnimCanvas.java
index 499b328..50aa78d 100644
--- a/gl4java/awt/GLAnimCanvas.java
+++ b/gl4java/awt/GLAnimCanvas.java
@@ -1,745 +1,744 @@
-/**
- * @(#) GLAnimCanvas.java
- */
-
-package gl4java.awt;
-
-import gl4java.GLContext;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.lang.Math;
-
-
-/**
- * This is meant as an base class writing
- * Animations. A clean usage of multi-threading compatible
- * with JAVA2 is implemented here !
- *
- * <p>
- *
- * If you are interessting in further Documentation and/or
- * the history of GL4Java follow the following link.
- *
- * <pre>
- <a href="../../GL4Java.html">The GL4Java Documentation</a>
- * </pre>
- * <p>
- *
- * This code uses repaint() to fire a sDisplay call by the AWT-Event thread !
- * and sleep to suspend for a given Frames per secounds value as default !!
- *
- * To switch this behavior for a better performance, and responsiveness
- * so that sDisplay is called by the animation thread itself
- * call:
- *
- * <pre>
- <a href="GLAnimCanvas.html#setUseRepaint(boolean)">setUseRepaint(false)</a>
- * </pre>
- * <p>
- *
- * This code sleep's for a given Frames per secounds after each frame
- * as default !!
- *
- * To switch this behavior for a better performance,
- * so that much frames are rendered as the machine can do !
- * call:
- *
- * <pre>
- <a href="GLAnimCanvas.html#setUseFpsSleep(boolean)">setUseFpsSleep(false)</a>
- * </pre>
- * <p>
- * But be sure, that the other threads may not have enough time or i
- * may not get the cpu power ...
- *
- * The following settings for setUseRepaint and setUseFpsSleep looks fine:
- *
- * <pre>
- <p>
- A JVM with operating system threads has: <b>native-threads</b>
- <p>
- A JVM where all JVM threads runs in one operating-system-thread
- has: <b>green-threads</b>
-
- <a name="table">
- <table border>
- <tr>
- <th><th>green-threads<th>native-threads
- <tr>
- <td align=center><a href="GLAnimCanvas.html#setUseRepaint(boolean)"><code>setUseRepaint</code></a>
- <td align=center><code>true</code>
- <td align=center><code> true & false </code>
- <tr>
- <td align=center><a href="GLAnimCanvas.html#setUseFpsSleep(boolean)"><code>setUseFpsSleep</code></a>
- <td align=center><code>true</code>
- <td align=center><code> true & false </code>
-
- </table>
- </a>
- * </pre>
- *
- * If you play with setUseRepaint or setUseFpsSleep,
- * be shure to have a Java VM with native-thread support,
- * because a GL-Context can be shared by many threads,
- * but one thread can have just one GL-Context !
- *
- * <p>
- *
- * Since GL4Java 2.5.2 and using a JVM >= 1.3
- * the multithreading support is stable !
- *
- * <p>
- *
- * (comments welcome)
- *
- * <p>
- * To use real fps settings, the following functions provides you to do so:
- * <pre>
- <a href="GLAnimCanvas.html#setAnimateFps(double)">setAnimateFps</a>
- <a href="GLAnimCanvas.html#getMaxFps()">getMaxFps</a>
- * </pre>
- * Like the first animation run, this class renders a view frames (default 10)
- * to subtract the render time from the sleep time !
- * <p>
- * You should overwrite the following methods for your needs:
- * <pre>
- <a href="GLCanvas.html#init()">preInit - initialisation before creating GLContext</a>
- <a href="GLAnimCanvas.html#init()">init - 1st initialisation</a>
- <a href="GLCanvas.html#doCleanup()">doCleanup - OGL cleanup prior to context deletion</a>
- <a href="GLAnimCanvas.html#display()">display - render one frame</a>
- <a href="GLCanvas.html#reshape(int, int)">reshape - to reshape (window resize)</a>
- <a href="GLAnimCanvas.html#ReInit()">ReInit - ReInitialisation after stop for setSuspended(false)</a>
- * </pre>
- *
- * @see gl4java.awt.GLCanvas
- * @version 2.0, 21. April 1999
- * @author Sven Goethel
- *
- */
-public class GLAnimCanvas extends GLCanvas
- implements Runnable
-{
- /**
- * To support frames per scounds,
- * instead of killing the machine :-)
- *
- * A little GUI is supported !
- *
- * @see gl4java.awt.GLAnimCanvas#run
- */
- protected double FramesPerSec=20;
- protected long mSecPerFrame=0;
-
- protected static int globalThreadNumber=0;
-
- public static int getGlobalThreadNumber()
- {
- return globalThreadNumber;
- }
-
- /**
- * the delays ..
- */
- protected long dFpsMilli = 0;
-
- /**
- * The thread for referencing Thread (Animation)
- *
- * @see gl4java.awt.GLAnimCanvas#stop
- * @see gl4java.awt.GLAnimCanvas#start
- * @see gl4java.awt.GLAnimCanvas#run
- */
- protected Thread killme = null;
-
- /**
- * Instead of using suspend (JAVA2)
- *
- * @see gl4java.awt.GLAnimCanvas#run
- */
- protected boolean threadSuspended = false;
-
- static {
- if(GLContext.loadNativeLibraries(null, null, null)==false)
- System.out.println("GLAnimCanvas could not load def. native libs.");
- }
-
- /**
- *
- * Constructor
- *
- * @see gl4java.awt.GLCanvas#GLCanvas
- *
- */
- public GLAnimCanvas( int width, int height,
- String gl_Name,
- String glu_Name
- )
- {
- super( width, height, gl_Name, glu_Name );
- setAnimateFps(FramesPerSec);
- }
-
- /**
- *
- * Constructor
- *
- * Uses the default GLFunc and GLUFunc implementation !
- *
- * @see gl4java.awt.GLCanvas#GLCanvas
- *
- */
- public GLAnimCanvas( int width, int height )
- {
- super( width, height);
- setAnimateFps(FramesPerSec);
- }
-
- /**
- * init should be overwritten by you,
- * to enter your initialisation code
- *
- */
- public void init()
- {
- /* here we should add and initialize our JAVA components */
-
- /* ... and furthet OpenGL init's - like you want to */
-
- glj.gljCheckGL();
-
- ReInit();
-
- /* and start our working thread ... */
- start();
- }
-
- /**
- *
- * This is the rendering-method called by sDisplay
- * (and sDisplay is called by paint, or by the thread directly !).
- * The derived-class (Your Subclass) will redefine this,
- * to draw it's own animation !
- *
- * <p>
- *
- * You MUST encapsulate your OpenGL call's within:
- * <pre>
- - glj.gljMakeCurrent()
- YOUR OpenGL commands here !
- - glj.gljFree()
- * </pre>
- * <p>
- *
- * You should set shallWeRender here,
- * to signalize the animation-loop 'run' to supsend
- * <p>
- * To restart the thread, just call setSuspended(false)
- *
- * @see gl4java.awt.GLAnimCanvas#shallWeRender
- * @see gl4java.awt.GLAnimCanvas#run
- * @see gl4java.awt.GLAnimCanvas#setSuspended
- * @see gl4java.awt.GLCanvas#sDisplay
- * @see gl4java.awt.GLCanvas#paint
- */
- public void display()
- {
- int i;
-
- /* Standard GL4Java Init */
- if( cvsIsInit()==false )
- {
- if(glj.gljClassDebug)
- System.out.println("GLAnimCanvas not initialized yet ...");
- return;
- }
-
- if( glj.gljMakeCurrent() == false )
- {
- if(glj.gljClassDebug)
- System.out.println("GLAnimCanvas problem in gljMakeCurrent() method");
- return;
- }
-
- // ... just render it
-
- /* For your animation dutys ;-) */
- glj.gljSwap();
- glj.gljCheckGL();
- glj.gljFree();
- }
-
- /**
- * ReInit should be overwritten by you,
- * to enter your re-initialisation within setSuspended(false)
- *
- * @see gl4java.awt.GLAnimCanvas#setSuspended
- */
- public void ReInit()
- {
- }
-
- protected boolean useRepaint = true;
-
- protected boolean useFpsSleep = true;
-
- /**
- * The normal behavior is to use 'repaint'
- * within the AWT-Event Thread to render.
- * <p>
- * If you have serious reasons, e.g. measuring performance,
- * you can change it while invoke this function with 'false'.
- * In this case, the thread itself calls the sDisplay method !
- *
- * On fast good multi-threading machines (native-thread-JVM),
- * this should increase the performance and the responsiveness !
- * <p>
- *
- * @param b if true, uses repaint (default), otherwise directly sDisplay
- * @see gl4java.awt.GLCanvas#sDisplay
- * @see gl4java.awt.GLAnimCanvas#setUseFpsSleep
- */
- public void setUseRepaint(boolean b)
- {
- useRepaint = b;
- }
-
- /**
- * The normal behavior is to use FpsSleep
- *
- * But you can overwrite this behavior and
- * drop the Frame Per Secound sleeps -
- * so that much frames are rendered as the machine can do !
- * <p>
- *
- * @param b if true, uses Fps sleeping, else not !
- * @see gl4java.awt.GLCanvas#sDisplay
- * @see gl4java.awt.GLAnimCanvas#setUseRepaint
- */
- public void setUseFpsSleep(boolean b)
- {
- useFpsSleep = b;
- }
-
- public boolean getUseRepaint()
- {
- return useRepaint;
- }
-
- public boolean getUseFpsSleep()
- {
- return useFpsSleep;
- }
-
- /**
- * HERE WE DO HAVE OUR RUNNING THREAD !
- * WE NEED STUFF LIKE THAT FOR ANIMATION ;-)
- */
- public void start()
- {
- if(killme == null)
- {
- killme = new Thread(this);
- killme.start();
-
- resetFpsCounter();
- }
- }
-
- public synchronized void stop()
- {
- killme = null;
- threadSuspended=false;
-
- notifyAll();
- }
-
- /**
- * You should call this before releasing/dispose this Window !
- * Also you can overwrite this class,
- * to dispose your own elements, e.g. a Frame etc. -
- * but be shure that you call
- * cvsDispose implementation call this one !
- *
- * This function calls gljDestroy of GLContext !
- *
- * @see gl4java.GLContext#gljDestroy
- * @see gl4java.awt.GLCanvas#cvsDispose
- * @see gl4java.awt.GLCanvas#doCleanup
- */
- public void cvsDispose()
- {
- stop();
- super.cvsDispose();
- }
-
- /**
- * Should be set in display,
- * whether to render or not while the animation loop
- * <p>
- * If shallWeRender is false,
- * this thread will suspend !
- *
- * @see gl4java.awt.GLAnimCanvas#display
- * @see gl4java.awt.GLAnimCanvas#run
- */
- protected boolean shallWeRender = true;
- protected boolean isRunning = false;
-
- private long _fDelay = 0;
- private long _fDelay_Frames = 10;
- private boolean _fDelaySync=true;
- private boolean _fDelayRun=false;
-
- /**
- * The running loop for animations
- * which initiates the call of display
- *
- * @see gl4java.awt.GLAnimCanvas#shallWeRender
- * @see gl4java.awt.GLAnimCanvas#display
- */
- public void run()
- {
- Thread thisThread = Thread.currentThread();
-
- isRunning = true;
-
- synchronized (this) {
- globalThreadNumber++;
- }
-
- while (killme==thisThread)
- {
- if(cvsIsInit())
- {
- /* DRAW THE TINGS .. */
- if (shallWeRender)
- {
- if(useRepaint)
- repaint();
- else
- sDisplay();
- } else {
- synchronized (this) {
- threadSuspended=true;
- }
- }
-
- if(fps_isCounting)
- fps_frames++;
-
- }
-
- try {
- if(useFpsSleep)
- {
- if(useRepaint)
- {
- if(mSecPerFrame<_f_dur)
- dFpsMilli=_f_dur;
- else
- dFpsMilli=mSecPerFrame;
- }
- else
- {
- dFpsMilli= mSecPerFrame - _f_dur;
- if (dFpsMilli<=0)
- dFpsMilli= 1;
- }
-
- Thread.currentThread().sleep(dFpsMilli, 0 );
- } else {
- Thread.yield();
- }
-
- if (threadSuspended) {
- stopFpsCounter();
- synchronized (this) {
- while (threadSuspended)
- wait();
- }
- }
- } catch (InterruptedException e)
- {}
- }
-
- if(glj!=null)
- glj.gljFree(); // just to be sure ..
-
- synchronized (this) {
- globalThreadNumber--;
- }
-
- isRunning = false;
- }
-
- /**
- * Here we can (re)start or suspend animation ...
- *
- * If the thread should be (re)started and is not alive -> killed,
- * or never be started, it will be started !
- *
- * @param suspend if true the thread will be suspended,
- * if false, the thread will be (re)started
- *
- * @see gl4java.awt.GLAnimCanvas#isAlive
- * @see gl4java.awt.GLAnimCanvas#start
- */
- public void setSuspended(boolean suspend)
- {
- setSuspended(suspend, false);
- }
-
- /**
- * Here we can (re)start or suspend animation ...
- *
- * If the thread should be (re)started and is not alive -> killed,
- * or never be started, it will be started !
- *
- * @param suspend if true the thread will be suspended,
- * if false, the thread will be (re)started
- *
- * @param reInit if true the ReInit will be called additionally,
- * where the user can set additional initialisations
- *
- * @see gl4java.awt.GLAnimCanvas#isAlive
- * @see gl4java.awt.GLAnimCanvas#start
- */
- public synchronized void setSuspended(boolean suspend, boolean reInit)
- {
- if(suspend) {
- shallWeRender=false;
- } else if(isAlive()==false) {
- start();
- } else {
- // the thread is alive, but suspended and should be
- // re-started
- shallWeRender=true;
- resetFpsCounter();
-
- if(reInit)
- ReInit();
-
- threadSuspended=false;
- notifyAll();
- }
- }
-
- /**
- * is the thread alive, means is started and not died ?
- *
- * @see gl4java.awt.GLAnimCanvas#run
- * @see gl4java.awt.GLAnimCanvas#setSuspended
- * @see gl4java.awt.GLAnimCanvas#start
- * @see gl4java.awt.GLAnimCanvas#stop
- */
- public boolean isAlive()
- {
- if(killme==null) return false;
- return killme.isAlive();
- }
-
- /**
- * is the thread suspended, means is started but waiting,
- * or not alive (ok :-| - but it is practical)
- *
- * @see gl4java.awt.GLAnimCanvas#run
- * @see gl4java.awt.GLAnimCanvas#setSuspended
- * @see gl4java.awt.GLAnimCanvas#start
- * @see gl4java.awt.GLAnimCanvas#stop
- */
- public boolean isSuspended()
- {
- if(killme==null) return true;
- return threadSuspended;
- }
-
- private double fps=0; // frame-per-sec
- private long fps_duration =0; // milli-secs
- private long fps_start=0; // milli-secs
- private long fps_frames =0; // number of frames
- private boolean fps_isCounting =true; // shall i count
- private boolean verboseFps =false; // shall i be verbose
-
- /**
- * resets the Fps Counter
- * <p>
- * this function is called automatically by
- * start and setSuspended
- *
- * @see gl4java.awt.GLAnimCanvas#start
- * @see gl4java.awt.GLAnimCanvas#setSuspended
- * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
- * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
- * @see gl4java.awt.GLAnimCanvas#getFps
- * @see gl4java.awt.GLAnimCanvas#getFpsDuration
- * @see gl4java.awt.GLAnimCanvas#getFpsFrames
- * @see gl4java.awt.GLAnimCanvas#setVerboseFps
- */
- public void resetFpsCounter()
- {
- fps=0; // frame-per-sec
- fps_duration =0; // milli-secs
- fps_frames =0; // number of frames
- fps_isCounting =true; // shall i count
- fps_start=System.currentTimeMillis();
- }
-
- /**
- * stops the Fps Counter and sets all values
- * fot the getFps* methods
- * <p>
- * this function is called automatically by
- * run, if the thread is suspended via shallWeRender
- * <p>
- * All data's are print out on System.out
- * if verboseFps is set !
- *
- * @see gl4java.awt.GLAnimCanvas#run
- * @see gl4java.awt.GLAnimCanvas#shallWeRender
- * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
- * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
- * @see gl4java.awt.GLAnimCanvas#getFps
- * @see gl4java.awt.GLAnimCanvas#getFpsDuration
- * @see gl4java.awt.GLAnimCanvas#getFpsFrames
- * @see gl4java.awt.GLAnimCanvas#setVerboseFps
- */
- public void stopFpsCounter()
- {
- if(fps_isCounting==true)
- {
- long fps_end=System.currentTimeMillis();
- fps_duration = fps_end-fps_start;
- double timed= ((double)fps_duration)/1000.0;
- if(timed==0) timed=1.0;
- fps = ((double)fps_frames)/timed ;
- fps_isCounting=false;
- }
- if(verboseFps)
- {
- System.out.println("\nfps = "+String.valueOf(fps));
- System.out.println("time = "+String.valueOf(fps_duration)+" ms");
- System.out.println("frames = "+String.valueOf(fps_frames));
- if(fps_frames==0) fps_frames=1;
- System.out.println("time/f = "+String.valueOf(fps_duration/fps_frames)+" ms");
- }
- }
-
- /**
- * sets if the Fps data shall be printed to System.out
- * while stopFpsCounter is called !
- * <p>
- * verboseFps is set to true by default !
- *
- * @see gl4java.awt.GLAnimCanvas#run
- * @see gl4java.awt.GLAnimCanvas#shallWeRender
- * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
- * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
- * @see gl4java.awt.GLAnimCanvas#getFps
- * @see gl4java.awt.GLAnimCanvas#getFpsDuration
- * @see gl4java.awt.GLAnimCanvas#getFpsFrames
- * @see gl4java.awt.GLAnimCanvas#setVerboseFps
- */
- public void setVerboseFps(boolean v)
- {
- verboseFps=v;
- }
-
- /**
- * returns the calculated frames per secounds
- * <p>
- * this data is avaiable after calling stopFpsCounter
- *
- * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
- * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
- * @see gl4java.awt.GLAnimCanvas#getFps
- * @see gl4java.awt.GLAnimCanvas#getFpsDuration
- * @see gl4java.awt.GLAnimCanvas#getFpsFrames
- * @see gl4java.awt.GLAnimCanvas#setVerboseFps
- */
- public double getFps()
- {
- return fps;
- }
-
- /**
- * returns the calculated duration in millisecs
- * <p>
- * this data is avaiable after calling stopFpsCounter
- *
- * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
- * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
- * @see gl4java.awt.GLAnimCanvas#getFps
- * @see gl4java.awt.GLAnimCanvas#getFpsDuration
- * @see gl4java.awt.GLAnimCanvas#getFpsFrames
- * @see gl4java.awt.GLAnimCanvas#setVerboseFps
- */
- public long getFpsDuration()
- {
- return fps_duration;
- }
-
- /**
- * returns the calculated frames number
- * <p>
- * this data is avaiable after calling stopFpsCounter
- *
- * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
- * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
- * @see gl4java.awt.GLAnimCanvas#getFps
- * @see gl4java.awt.GLAnimCanvas#getFpsDuration
- * @see gl4java.awt.GLAnimCanvas#getFpsFrames
- * @see gl4java.awt.GLAnimCanvas#setVerboseFps
- */
- public long getFpsFrames()
- {
- return fps_frames;
- }
-
- /**
- * Just set the FramePerSecounds for Animation
- *
- * @deprecated Now the frames per seconds are allways
- * calculated, no pre-sync needed.
- * @see #setAnimateFps(double)
- */
- public void setAnimateFps(double fps, int synFrames)
- {
- setAnimateFps(fps);
- }
-
- /**
- * Just set the FramePerSecounds for Animation
- *
- * @see gl4java.awt.GLAnimCanvas#getMaxFps
- */
- public void setAnimateFps(double fps)
- {
- FramesPerSec=fps;
- mSecPerFrame = (long) ( (1.0/FramesPerSec) * 1000.0 ) ;
- if(verboseFps)
- {
- System.out.println("\nset fps := "+
- String.valueOf(fps)+
- " -> "+String.valueOf(mSecPerFrame)+
- " [ms/frame]"
- );
- }
- resetFpsCounter();
- }
-
- /**
- * Just get the maximum number of Frames per secounds,
- * which is calculated with the time, one frame needs to render !
- *
- * this value is avaiable after the thread is started
- * and the first frames are rendered !
- *
- * @see gl4java.awt.GLAnimCanvas#setAnimateFps
- */
- public double getMaxFps()
- {
- return (1.0/(double)_f_dur)*1000.0;
- }
-
-}
-
+/**
+ * @(#) GLAnimCanvas.java
+ */
+
+package gl4java.awt;
+
+import gl4java.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.Math;
+
+
+/**
+ * This is meant as an base class writing
+ * Animations. A clean usage of multi-threading compatible
+ * with JAVA2 is implemented here !
+ *
+ * <p>
+ *
+ * If you are interessting in further Documentation and/or
+ * the history of GL4Java follow the following link.
+ *
+ * <pre>
+ <a href="../../GL4Java.html">The GL4Java Documentation</a>
+ * </pre>
+ *
+ * <p>
+ * There are two ways of using a GLAnimCanvas: the {@link
+ * gl4java.GLEventListener} model or the subclassing model. Earlier
+ * versions of OpenGL for Java only supported the subclassing model.
+ * The default implementations of {@link gl4java.awt.GLCanvas#init},
+ * {@link gl4java.awt.GLCanvas#display},
+ * {@link gl4java.awt.GLCanvas#reshape} and
+ # {@link gl4java.awt.GLCanvas#doCleanup}
+ * now send events to GLEventListeners; they can
+ * still be overridden as before to support the subclassing model.
+ *
+ * <p>
+ * If using the subclassing model, you should override the following
+ * methods for your needs:
+ * <pre>
+ <a href="GLCanvas.html#init()">preInit - initialisation before creating GLContext</a>
+ <a href="GLAnimCanvas.html#init()">init - 1st initialisation</a>
+ <a href="GLCanvas.html#doCleanup()">doCleanup - OGL cleanup prior to context deletion</a>
+ <a href="GLAnimCanvas.html#display()">display - render one frame</a>
+ <a href="GLCanvas.html#reshape(int, int)">reshape - to reshape (window resize)</a>
+ <a href="GLAnimCanvas.html#ReInit()">ReInit - ReInitialisation after stop for setSuspended(false)</a>
+ * </pre>
+ *
+ * <p>
+ *
+ * This code uses repaint() to fire a sDisplay call by the AWT-Event thread !
+ * and sleep to suspend for a given Frames per secounds value as default !!
+ *
+ * To switch this behavior for a better performance, and responsiveness
+ * so that sDisplay is called by the animation thread itself
+ * call:
+ *
+ * <pre>
+ <a href="GLAnimCanvas.html#setUseRepaint(boolean)">setUseRepaint(false)</a>
+ * </pre>
+ * <p>
+ *
+ * This code sleep's for a given Frames per secounds after each frame
+ * as default !!
+ *
+ * To switch this behavior for a better performance,
+ * so that much frames are rendered as the machine can do !
+ * call:
+ *
+ * <pre>
+ <a href="GLAnimCanvas.html#setUseFpsSleep(boolean)">setUseFpsSleep(false)</a>
+ * </pre>
+ * <p>
+ * But be sure, that the other threads may not have enough time or i
+ * may not get the cpu power ...
+ *
+ * The following settings for setUseRepaint and setUseFpsSleep looks fine:
+ *
+ * <pre>
+ <p>
+ A JVM with operating system threads has: <b>native-threads</b>
+ <p>
+ A JVM where all JVM threads runs in one operating-system-thread
+ has: <b>green-threads</b>
+
+ <a name="table">
+ <table border>
+ <tr>
+ <th><th>green-threads<th>native-threads
+ <tr>
+ <td align=center><a href="GLAnimCanvas.html#setUseRepaint(boolean)"><code>setUseRepaint</code></a>
+ <td align=center><code>true</code>
+ <td align=center><code> true & false </code>
+ <tr>
+ <td align=center><a href="GLAnimCanvas.html#setUseFpsSleep(boolean)"><code>setUseFpsSleep</code></a>
+ <td align=center><code>true</code>
+ <td align=center><code> true & false </code>
+
+ </table>
+ </a>
+ * </pre>
+ *
+ * If you play with setUseRepaint or setUseFpsSleep,
+ * be shure to have a Java VM with native-thread support,
+ * because a GL-Context can be shared by many threads,
+ * but one thread can have just one GL-Context !
+ *
+ * <p>
+ *
+ * Since GL4Java 2.5.2 and using a JVM >= 1.3
+ * the multithreading support is stable !
+ *
+ * <p>
+ *
+ * (comments welcome)
+ *
+ * <p>
+ * To use real fps settings, the following functions provides you to do so:
+ * <pre>
+ <a href="GLAnimCanvas.html#setAnimateFps(double)">setAnimateFps</a>
+ <a href="GLAnimCanvas.html#getMaxFps()">getMaxFps</a>
+ * </pre>
+ * Like the first animation run, this class renders a view frames (default 10)
+ * to subtract the render time from the sleep time !
+ *
+ * @see gl4java.awt.GLCanvas
+ * @version 2.0, 21. April 1999
+ * @author Sven Goethel
+ *
+ */
+public class GLAnimCanvas extends GLCanvas
+ implements Runnable
+{
+ /**
+ * To support frames per scounds,
+ * instead of killing the machine :-)
+ *
+ * A little GUI is supported !
+ *
+ * @see gl4java.awt.GLAnimCanvas#run
+ */
+ protected double FramesPerSec=20;
+ protected long mSecPerFrame=0;
+
+ protected static int globalThreadNumber=0;
+
+ public static int getGlobalThreadNumber()
+ {
+ return globalThreadNumber;
+ }
+
+ /**
+ * the delays ..
+ */
+ protected long dFpsMilli = 0;
+
+ /**
+ * The thread for referencing Thread (Animation)
+ *
+ * @see gl4java.awt.GLAnimCanvas#stop
+ * @see gl4java.awt.GLAnimCanvas#start
+ * @see gl4java.awt.GLAnimCanvas#run
+ */
+ protected Thread killme = null;
+
+ /**
+ * Instead of using suspend (JAVA2)
+ *
+ * @see gl4java.awt.GLAnimCanvas#run
+ */
+ protected boolean threadSuspended = false;
+
+ static {
+ if(GLContext.loadNativeLibraries(null, null, null)==false)
+ System.out.println("GLAnimCanvas could not load def. native libs.");
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @see gl4java.awt.GLCanvas#GLCanvas
+ *
+ */
+ public GLAnimCanvas( int width, int height,
+ String gl_Name,
+ String glu_Name
+ )
+ {
+ super( width, height, gl_Name, glu_Name );
+ setAnimateFps(FramesPerSec);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @see gl4java.awt.GLCanvas#GLCanvas
+ *
+ */
+ public GLAnimCanvas( int width, int height )
+ {
+ super( width, height);
+ setAnimateFps(FramesPerSec);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @see gl4java.awt.GLCanvas#GLCanvas
+ *
+ */
+ public GLAnimCanvas( GLCapabilities capabilities,
+ int width, int height,
+ String gl_Name,
+ String glu_Name
+ )
+ {
+ super( capabilities, width, height, gl_Name, glu_Name );
+ setAnimateFps(FramesPerSec);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @see gl4java.awt.GLCanvas#GLCanvas
+ *
+ */
+ public GLAnimCanvas( GLCapabilities capabilities,
+ int width, int height )
+ {
+ super( capabilities, width, height);
+ setAnimateFps(FramesPerSec);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @see gl4java.awt.GLCanvas#GLCanvas
+ */
+ public GLAnimCanvas( GraphicsConfiguration config,
+ GLCapabilities capabilities,
+ int width, int height,
+ String gl_Name,
+ String glu_Name
+ )
+ {
+ super( config, capabilities,
+ width, height, gl_Name, glu_Name );
+ setAnimateFps(FramesPerSec);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @see gl4java.awt.GLCanvas#GLCanvas
+ */
+ public GLAnimCanvas( GraphicsConfiguration config,
+ GLCapabilities capabilities,
+ int width, int height )
+ {
+ super( config, capabilities,
+ width, height);
+ setAnimateFps(FramesPerSec);
+ }
+
+ /**
+ * ReInit should be overwritten by you,
+ * to enter your re-initialisation within setSuspended(false)
+ *
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ */
+ public void ReInit()
+ {
+ }
+
+ protected boolean useRepaint = true;
+
+ protected boolean useFpsSleep = true;
+
+ /**
+ * The normal behavior is to use 'repaint'
+ * within the AWT-Event Thread to render.
+ * <p>
+ * If you have serious reasons, e.g. measuring performance,
+ * you can change it while invoke this function with 'false'.
+ * In this case, the thread itself calls the sDisplay method !
+ *
+ * On fast good multi-threading machines (native-thread-JVM),
+ * this should increase the performance and the responsiveness !
+ * <p>
+ *
+ * @param b if true, uses repaint (default), otherwise directly sDisplay
+ * @see gl4java.awt.GLCanvas#sDisplay
+ * @see gl4java.awt.GLAnimCanvas#setUseFpsSleep
+ */
+ public void setUseRepaint(boolean b)
+ {
+ useRepaint = b;
+ }
+
+ /**
+ * The normal behavior is to use FpsSleep
+ *
+ * But you can overwrite this behavior and
+ * drop the Frame Per Secound sleeps -
+ * so that much frames are rendered as the machine can do !
+ * <p>
+ *
+ * @param b if true, uses Fps sleeping, else not !
+ * @see gl4java.awt.GLCanvas#sDisplay
+ * @see gl4java.awt.GLAnimCanvas#setUseRepaint
+ */
+ public void setUseFpsSleep(boolean b)
+ {
+ useFpsSleep = b;
+ }
+
+ public boolean getUseRepaint()
+ {
+ return useRepaint;
+ }
+
+ public boolean getUseFpsSleep()
+ {
+ return useFpsSleep;
+ }
+
+ /**
+ * HERE WE DO HAVE OUR RUNNING THREAD !
+ * WE NEED STUFF LIKE THAT FOR ANIMATION ;-)
+ */
+ public void start()
+ {
+ if(killme == null)
+ {
+ killme = new Thread(this);
+ killme.start();
+
+ resetFpsCounter();
+ }
+ }
+
+ public synchronized void stop()
+ {
+ killme = null;
+ threadSuspended=false;
+
+ notifyAll();
+ }
+
+ /**
+ * You should call this before releasing/dispose this Window !
+ * Also you can overwrite this class,
+ * to dispose your own elements, e.g. a Frame etc. -
+ * but be shure that you call
+ * cvsDispose implementation call this one !
+ *
+ * This function calls gljDestroy of GLContext !
+ *
+ * @see gl4java.GLContext#gljDestroy
+ * @see gl4java.awt.GLCanvas#cvsDispose
+ * @see gl4java.awt.GLCanvas#doCleanup
+ */
+ public void cvsDispose()
+ {
+ stop();
+ super.cvsDispose();
+ }
+
+ protected boolean shallWeRender = true;
+ protected boolean isRunning = false;
+
+ private long _fDelay = 0;
+ private long _fDelay_Frames = 10;
+ private boolean _fDelaySync=true;
+ private boolean _fDelayRun=false;
+
+ /**
+ * The running loop for animations
+ * which initiates the call of display
+ *
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ * @see gl4java.awt.GLCanvas#display
+ */
+ public void run()
+ {
+ Thread thisThread = Thread.currentThread();
+
+ isRunning = true;
+
+ synchronized (this) {
+ globalThreadNumber++;
+ }
+
+ while (killme==thisThread)
+ {
+ if(cvsIsInit())
+ {
+ /* DRAW THE TINGS .. */
+ if (shallWeRender)
+ {
+ if(useRepaint)
+ repaint();
+ else
+ sDisplay();
+ } else {
+ synchronized (this) {
+ threadSuspended=true;
+ }
+ }
+
+ if(fps_isCounting)
+ fps_frames++;
+
+ }
+
+ try {
+ if(useFpsSleep)
+ {
+ if(useRepaint)
+ {
+ if(mSecPerFrame<_f_dur)
+ dFpsMilli=_f_dur;
+ else
+ dFpsMilli=mSecPerFrame;
+ }
+ else
+ {
+ dFpsMilli= mSecPerFrame - _f_dur;
+ if (dFpsMilli<=0)
+ dFpsMilli= 1;
+ }
+
+ Thread.currentThread().sleep(dFpsMilli, 0 );
+ } else {
+ Thread.yield();
+ }
+
+ if (threadSuspended) {
+ stopFpsCounter();
+ synchronized (this) {
+ while (threadSuspended)
+ wait();
+ }
+ }
+ } catch (InterruptedException e)
+ {}
+ }
+
+ if(glj!=null)
+ glj.gljFree(); // just to be sure ..
+
+ synchronized (this) {
+ globalThreadNumber--;
+ }
+
+ isRunning = false;
+ }
+
+ /**
+ * Here we can (re)start or suspend animation ...
+ *
+ * If the thread should be (re)started and is not alive -> killed,
+ * or never be started, it will be started !
+ *
+ * @param suspend if true the thread will be suspended,
+ * if false, the thread will be (re)started
+ *
+ * @see gl4java.awt.GLAnimCanvas#isAlive
+ * @see gl4java.awt.GLAnimCanvas#start
+ */
+ public void setSuspended(boolean suspend)
+ {
+ setSuspended(suspend, false);
+ }
+
+ /**
+ * Here we can (re)start or suspend animation ...
+ *
+ * If the thread should be (re)started and is not alive -> killed,
+ * or never be started, it will be started !
+ *
+ * @param suspend if true the thread will be suspended,
+ * if false, the thread will be (re)started
+ *
+ * @param reInit if true the ReInit will be called additionally,
+ * where the user can set additional initialisations
+ *
+ * @see gl4java.awt.GLAnimCanvas#isAlive
+ * @see gl4java.awt.GLAnimCanvas#start
+ * @see gl4java.awt.GLAnimCanvas#run
+ */
+ public synchronized void setSuspended(boolean suspend, boolean reInit)
+ {
+ if(suspend) {
+ shallWeRender=false;
+ } else if(isAlive()==false) {
+ start();
+ } else {
+ // the thread is alive, but suspended and should be
+ // re-started
+ shallWeRender=true;
+ resetFpsCounter();
+
+ if(reInit)
+ ReInit();
+
+ threadSuspended=false;
+ notifyAll();
+ }
+ }
+
+ /**
+ * is the thread alive, means is started and not died ?
+ *
+ * @see gl4java.awt.GLAnimCanvas#run
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ * @see gl4java.awt.GLAnimCanvas#start
+ * @see gl4java.awt.GLAnimCanvas#stop
+ */
+ public boolean isAlive()
+ {
+ if(killme==null) return false;
+ return killme.isAlive();
+ }
+
+ /**
+ * is the thread suspended, means is started but waiting,
+ * or not alive (ok :-| - but it is practical)
+ *
+ * @see gl4java.awt.GLAnimCanvas#run
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ * @see gl4java.awt.GLAnimCanvas#start
+ * @see gl4java.awt.GLAnimCanvas#stop
+ */
+ public boolean isSuspended()
+ {
+ if(killme==null) return true;
+ return threadSuspended;
+ }
+
+ private double fps=0; // frame-per-sec
+ private long fps_duration =0; // milli-secs
+ private long fps_start=0; // milli-secs
+ private long fps_frames =0; // number of frames
+ private boolean fps_isCounting =true; // shall i count
+ private boolean verboseFps =false; // shall i be verbose
+
+ /**
+ * resets the Fps Counter
+ * <p>
+ * this function is called automatically by
+ * start and after setSuspended suspends the
+ * animation thread !
+ *
+ * @see gl4java.awt.GLAnimCanvas#start
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#getFps
+ * @see gl4java.awt.GLAnimCanvas#getFpsDuration
+ * @see gl4java.awt.GLAnimCanvas#getFpsFrames
+ * @see gl4java.awt.GLAnimCanvas#setVerboseFps
+ */
+ public void resetFpsCounter()
+ {
+ fps=0; // frame-per-sec
+ fps_duration =0; // milli-secs
+ fps_frames =0; // number of frames
+ fps_isCounting =true; // shall i count
+ fps_start=System.currentTimeMillis();
+ }
+
+ /**
+ * stops the Fps Counter and sets all values
+ * fot the getFps* methods
+ * <p>
+ * this function is called automatically by
+ * run, if the thread is suspended via setSuspended(true)
+ * <p>
+ * All data's are print out on System.out
+ * if verboseFps is set !
+ *
+ * @see gl4java.awt.GLAnimCanvas#run
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#getFps
+ * @see gl4java.awt.GLAnimCanvas#getFpsDuration
+ * @see gl4java.awt.GLAnimCanvas#getFpsFrames
+ * @see gl4java.awt.GLAnimCanvas#setVerboseFps
+ */
+ public void stopFpsCounter()
+ {
+ if(fps_isCounting==true)
+ {
+ long fps_end=System.currentTimeMillis();
+ fps_duration = fps_end-fps_start;
+ double timed= ((double)fps_duration)/1000.0;
+ if(timed==0) timed=1.0;
+ fps = ((double)fps_frames)/timed ;
+ fps_isCounting=false;
+ }
+ if(verboseFps)
+ {
+ System.out.println("\nfps = "+String.valueOf(fps));
+ System.out.println("time = "+String.valueOf(fps_duration)+" ms");
+ System.out.println("frames = "+String.valueOf(fps_frames));
+ if(fps_frames==0) fps_frames=1;
+ System.out.println("time/f = "+String.valueOf(fps_duration/fps_frames)+" ms");
+ }
+ }
+
+ /**
+ * sets if the Fps data shall be printed to System.out
+ * while stopFpsCounter is called !
+ * <p>
+ * verboseFps is set to true by default !
+ *
+ * @see gl4java.awt.GLAnimCanvas#run
+ * @see gl4java.awt.GLAnimCanvas#setSuspended
+ * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#getFps
+ * @see gl4java.awt.GLAnimCanvas#getFpsDuration
+ * @see gl4java.awt.GLAnimCanvas#getFpsFrames
+ * @see gl4java.awt.GLAnimCanvas#setVerboseFps
+ */
+ public void setVerboseFps(boolean v)
+ {
+ verboseFps=v;
+ }
+
+ /**
+ * returns the calculated frames per secounds
+ * <p>
+ * this data is avaiable after calling stopFpsCounter
+ *
+ * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#getFps
+ * @see gl4java.awt.GLAnimCanvas#getFpsDuration
+ * @see gl4java.awt.GLAnimCanvas#getFpsFrames
+ * @see gl4java.awt.GLAnimCanvas#setVerboseFps
+ */
+ public double getFps()
+ {
+ return fps;
+ }
+
+ /**
+ * returns the calculated duration in millisecs
+ * <p>
+ * this data is avaiable after calling stopFpsCounter
+ *
+ * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#getFps
+ * @see gl4java.awt.GLAnimCanvas#getFpsDuration
+ * @see gl4java.awt.GLAnimCanvas#getFpsFrames
+ * @see gl4java.awt.GLAnimCanvas#setVerboseFps
+ */
+ public long getFpsDuration()
+ {
+ return fps_duration;
+ }
+
+ /**
+ * returns the calculated frames number
+ * <p>
+ * this data is avaiable after calling stopFpsCounter
+ *
+ * @see gl4java.awt.GLAnimCanvas#resetFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#stopFpsCounter
+ * @see gl4java.awt.GLAnimCanvas#getFps
+ * @see gl4java.awt.GLAnimCanvas#getFpsDuration
+ * @see gl4java.awt.GLAnimCanvas#getFpsFrames
+ * @see gl4java.awt.GLAnimCanvas#setVerboseFps
+ */
+ public long getFpsFrames()
+ {
+ return fps_frames;
+ }
+
+ /**
+ * Just set the FramePerSecounds for Animation
+ *
+ * @deprecated Now the frames per seconds are allways
+ * calculated, no pre-sync needed.
+ * @see #setAnimateFps(double)
+ */
+ public void setAnimateFps(double fps, int synFrames)
+ {
+ setAnimateFps(fps);
+ }
+
+ /**
+ * Just set the FramePerSecounds for Animation
+ *
+ * @see gl4java.awt.GLAnimCanvas#getMaxFps
+ */
+ public void setAnimateFps(double fps)
+ {
+ FramesPerSec=fps;
+ mSecPerFrame = (long) ( (1.0/FramesPerSec) * 1000.0 ) ;
+ if(verboseFps)
+ {
+ System.out.println("\nset fps := "+
+ String.valueOf(fps)+
+ " -> "+String.valueOf(mSecPerFrame)+
+ " [ms/frame]"
+ );
+ }
+ resetFpsCounter();
+ }
+
+ /**
+ * Just get the maximum number of Frames per secounds,
+ * which is calculated with the time, one frame needs to render !
+ *
+ * this value is avaiable after the thread is started
+ * and the first frames are rendered !
+ *
+ * @see gl4java.awt.GLAnimCanvas#setAnimateFps
+ */
+ public double getMaxFps()
+ {
+ return (1.0/(double)_f_dur)*1000.0;
+ }
+
+}
+
diff --git a/gl4java/awt/GLCanvas.java b/gl4java/awt/GLCanvas.java
index da4cbfa..f997bdd 100644
--- a/gl4java/awt/GLCanvas.java
+++ b/gl4java/awt/GLCanvas.java
@@ -1,814 +1,1063 @@
-/**
- * @(#) GLCanvas.java
- */
-
-
-package gl4java.awt;
-
-import gl4java.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-/**
- * This is meant as an base class writing
- * easy render functions. A clean usage of multi-threading compatible
- * with JAVA2 is implemented in GLAnimCanvas !
- *
- * <p>
- *
- * If you are interessting in further Documentation and/or
- * the history of GL4Java follow the following link.
- *
- * <pre>
- <a href="../../GL4Java.html">The GL4Java Documentation</a>
- * </pre>
- * <p>
- *
- * You should overwrite the following methods for your needs:
- * <pre>
- <a href="GLCanvas.html#init()">preInit - initialisation before creating GLContext</a>
- <a href="GLCanvas.html#init()">init - 1st initialisation after creating GLContext</a>
- <a href="GLCanvas.html#doCleanup()">doCleanup - OGL cleanup prior to context deletion</a>
- <a href="GLCanvas.html#display()">display - render your frame</a>
- <a href="GLCanvas.html#reshape(int, int)">reshape - to reshape (window resize), gljResize() is allready invoked !</a>
- * </pre>
- *
- * To check if you can use the GLContext and GL and GLU methods,
- * use the function
- * <pre>
- <a href="GLCanvas.html#cvsIsInit()">cvsIsInit</a>
- * </pre>
- * <p>
- * IF you remove/release a GLCanvas,
- * e.g. you want to close/dispose it�s Window (which contains this GLCanvas),
- * you HAVE TO call:
- *
- * <pre>
- <a href="GLCanvas.html#cvsDispose()">cvsDispose</a>
- * </pre>
- * You should call this before releasing/dispose this Window !
- * Also you can overwrite this class,
- * to dispose your own elements, e.g. a Frame etc. -
- * but be shure that you call
- * cvsDispose implementation call this one !
- *
- * <p>
- * We do override the following Canvas methods.
- *
- * <pre>
- <a href="GLCanvas.html#update(java.awt.Graphics)">update</a>
- <a href="GLCanvas.html#paint(java.awt.Graphics)">paint</a>
- * </pre>
- * <p>
- *
- * @see gl4java.awt.GLAnimCanvas
- * @version 2.0, 21. April 1999
- * @author Sven Goethel
- *
- */
-public class GLCanvas extends Canvas
- implements GLEnum, GLUEnum,
- ComponentListener, WindowListener, MouseListener
-{
- protected GLContext glj = null;
- public GLFunc gl = null;
- public GLUFunc glu = null;
-
- protected Dimension size = null;
- protected boolean mustResize = false;
-
- protected boolean needCvsDispose = false;
-
- /**
- * Visual pre-set for doubleBuffer, default: true
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected boolean doubleBuffer = true;
-
- /**
- * Visual pre-set for stencil-bit number, default: 0
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected int stencilBits = 0;
-
- /**
- * Visual pre-set for accumulator buffer size, default: 0
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * This value has a special behavior.
- * For input - within the contructor,
- * it is the value for each component !
- *
- * The output value, after the constructor returns,
- * it is the summary of all accumulation bits of all components !
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected int accumSize = 0;
-
- /**
- * Visual pre-set for stereoView, default: false
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected boolean stereoView = false;
-
- /**
- * Visual pre-set for RGBA usage, default: true - of course ;-)
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected boolean rgba = true;
-
- /**
- * Visual pre-set for RGBA usage, default: true - of course ;-)
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected boolean createOwnWindow = false;
-
- /**
- * The context with wich display lists and textures will be shared.
- *
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#paint
- */
- protected GLContext sharedGLContext;
-
- static {
- if(GLContext.loadNativeLibraries(null, null, null)==false)
- System.out.println("GLCanvas could not load def. native libs.");
- }
-
- /**
- *
- * Constructor
- *
- * @param width the canvas initial-prefered width
- * @param height the canvas initial-prefered height
- *
- * @param gl_Name The name of the GLFunc implementation
- * If gl_Name==null, the default class will be used !
- *
- * @param glu_Name The name of the GLUFunc implementation
- * If gl_LibName==null, the default class will be used !
- *
- */
- public GLCanvas( int width, int height,
- String gl_Name,
- String glu_Name
- )
- {
- super( );
-
- if( (gl=GLContext.createGLFunc(gl_Name)) ==null)
- {
- System.out.println("GLFunc implementation "+gl_Name+" not created");
- }
- if( (glu=GLContext.createGLUFunc(glu_Name)) ==null)
- {
- System.out.println("GLUFunc implementation "+glu_Name+" not created");
- }
-
- size = new Dimension(width, height);
-
- setSize(size);
-
- }
-
- /**
- *
- * Constructor
- *
- * Uses the default GLFunc and GLUFunc implementation !
- *
- * @param width the canvas initial-prefered width
- * @param height the canvas initial-prefered height
- *
- */
- public GLCanvas( int width, int height )
- {
- this(width, height, null, null);
- }
-
- /* GLCanvas AWT classes */
-
- public Dimension getPreferredSize() {
- return getMinimumSize();
- }
-
- public Dimension getMinimumSize() {
- return size;
- }
-
- /**
- * Used to return the created GLContext
- */
- public final GLContext getGLContext() { return glj; }
-
- /**
- *
- * Overridden update
- * This one only call's the paint method, without clearing
- * the background - thats hopefully done by OpenGL ;-)
- *
- * @param g the Graphics Context
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- */
- public void update(Graphics g)
- {
- /* let's let OpenGL clear the background ... */
- paint(g);
- }
-
- /**
- * Safe the toplevel window
- */
- protected Window topLevelWindow = null;
-
- /**
- *
- * This function returns the found TopLevelWindow,
- * which contains this Canvas ..
- *
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- */
- public final Window getTopLevelWindow()
- { return topLevelWindow; }
-
- /**
- * this function overrides the Canvas paint method !
- *
- * For the first paint,
- * the user function preInit is called, a GLContext is created
- * and the user function init is called !
- *
- * Also, if a GL Context exist, GLCanvas's sDisplay-method will be called
- * to do OpenGL-rendering.
- *
- * The sDisplay method itself calls the display-method !
- * sDisplay is needed to be thread-safe, to manage
- * the resize functionality and to safe the time per frame.
- *
- * To define your rendering, you should overwrite the display-method
- * in your derivation.
- *
- * @see gl4java.GLContext#GLContext
- * @see gl4java.awt.GLCanvas#cvsIsInit
- * @see gl4java.awt.GLCanvas#sDisplay
- * @see gl4java.awt.GLCanvas#display
- * @see gl4java.awt.GLCanvas#preInit
- * @see gl4java.awt.GLCanvas#init
- */
- public synchronized final void paint( Graphics g )
- {
- if(glj == null || ( !glj.gljIsInit() && isGLEnabled() ) )
- {
- if(GLContext.gljClassDebug)
- System.out.println("GLCanvas create GLContext (recreate="+
- (glj != null) +")");
- preInit();
-
- if(glj!=null) glj=null;
-
- glj = new GLContext ( this, gl, glu,
- createOwnWindow,
- doubleBuffer, stereoView,
- rgba, stencilBits, accumSize,
- sharedGLContext );
-
- if(glj!=null)
- {
- createOwnWindow = glj.isOwnWindowCreated();
- doubleBuffer = glj.isDoubleBuffer();
- stencilBits = glj.getStencilBitNumber();
- accumSize = glj.getAccumSize();
- stereoView = glj.isStereoView();
- rgba = glj.isRGBA();
- }
-
- init();
-
- // fetch the top-level window ,
- // to add us as the windowListener
- //
- Container _c = getParent();
- Container c = null;
-
- while(_c!=null)
- {
- c = _c;
- _c = _c.getParent();
- }
-
- if(c instanceof Window) {
- topLevelWindow = (Window)c;
- topLevelWindow.addComponentListener(this);
- } else {
- topLevelWindow = null;
- System.out.println("toplevel is not a Window: "+c);
- }
-
- if(topLevelWindow!=null)
- {
- topLevelWindow.addWindowListener(this);
- } else {
- System.out.println("no parent found for "+getName());
- System.out.flush();
- }
-
- /* to be able for RESIZE event's */
- addComponentListener(this);
- addMouseListener(this);
- }
-
- sDisplay();
- }
-
- /**
- *
- * This is your pre-init method.
- * preInit is called just BEFORE the GL-Context is created.
- * You should override preInit, to initialize your visual-stuff,
- * like the protected vars: doubleBuffer and stereoView
- *
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- * @see gl4java.awt.GLCanvas#doubleBuffer
- * @see gl4java.awt.GLCanvas#stereoView
- * @see gl4java.awt.GLCanvas#rgba
- * @see gl4java.awt.GLCanvas#stencilBits
- * @see gl4java.awt.GLCanvas#accumSize
- */
- public void preInit()
- {
- }
-
- /**
- *
- * This is your init method.
- * init is called right after the GL-Context is initialized.
- * You should override init, to initialize your stuff needed
- * by OpenGL an Java !
- *
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- */
- public void init()
- {
- }
-
- /**
- * This method is used to clean up any OpenGL stuff (delete textures
- * or whatever) prior to actually deleting the OpenGL context.
- * You should override this with your own version, if you need to do
- * any cleanup work at this phase.
- * This functions is called within cvsDispose
- *
- * @return void
- *
- * @see gl4java.awt.GLCanvas#cvsDispose
- */
- public void doCleanup()
- {
- }
-
- /**
- * This function returns, if everything is init: the GLContext,
- * the and the users init function
- * This value is set in the paint method!
- *
- * @return boolean
- *
- * @see gl4java.awt.GLCanvas#paint
- * @see gl4java.awt.GLCanvas#init
- */
- public boolean cvsIsInit()
- {
- if(glj!=null)
- return glj.gljIsInit();
- return false;
- }
-
- /**
- * This function enables, disables the GL-Context !
- * If false is given, the openGL renderer/context is
- * disabled and disconected (gljFree is called, if initialized) !
- *
- * If disabled, all GL Functions are disabled but the
- * Destroy & Free are not !
- *
- * @return boolean
- *
- * @see gl4java.awt.GLCanvas#cvsDispose
- * @see gl4java.GLContext#setEnable
- * @see gl4java.GLContext#gljMakeCurrent
- * @see gl4java.GLContext#gljDestroy
- * @see gl4java.GLContext#gljFree
- */
- public void setGLEnabled(boolean b)
- {
- if(glj!=null)
- glj.setEnabled(b);
- }
-
- /**
- * This function enables, disables the GL-Context !
- * If false is given, the openGL renderer/context is
- * disabled and disconected (gljFree is called, if initialized) !
- *
- * If disabled, all GL Functions are disabled but the
- * Destroy & Free are not !
- *
- * The Visible-Flag of this AWT Component is also set to the given value !
- * The setVisible(boolean) method of Component is called !
- *
- * @return boolean
- *
- * @see gl4java.awt.GLCanvas#cvsDispose
- * @see gl4java.GLContext#setEnable
- * @see gl4java.GLContext#gljMakeCurrent
- * @see gl4java.GLContext#gljDestroy
- * @see gl4java.GLContext#gljFree
- */
- public void setVisible(boolean b)
- {
- if(glj!=null)
- glj.setEnabled(b);
- super.setVisible(b);
- }
-
- /**
- * This function queries, if the GL-Context is enabled !
- *
- * @return boolean
- *
- * @see gl4java.GLContext#isEnabled
- * @see gl4java.GLContext#gljMakeCurrent
- */
- public boolean isGLEnabled()
- {
- if(glj!=null)
- return glj.isEnabled();
- return false;
- }
-
- protected long _f_dur = 0;
-
- /**
- *
- * This is the thread save rendering-method called by paint.
- * The actual thread will be set to highes priority befor calling
- * 'display'. After 'display' the priority will be reset !
- *
- * 'gljFree' will be NOT called after 'display'.
- *
- * We tested the above to use multi-threading and
- * for the demonstration 'glDemos' it works ;-)) !
- *
- * BE SURE, if you want to call 'display' by yourself
- * (e.g. in the run method for animation)
- * YOU HAVE TO CALL sDisplay -- OR YOU MUST KNOW WHAT YOU ARE DOING THEN !
- *
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- * @see gl4java.awt.GLCanvas#display
- */
- public synchronized final void sDisplay()
- {
- boolean ok = true;
-
- long _s = System.currentTimeMillis();
-
- if(!cvsIsInit())
- {
- return;
- }
-
- if( mustResize )
- {
- if( glj.gljMakeCurrent() == true )
- {
- size = getSize();
- glj.gljResize( size.width, size.height ) ;
- reshape(size.width, size.height);
- mustResize = false;
- invalidate();
- repaint(100);
- glj.gljFree();
- }
- }
- if(ok)
- {
- display();
- }
-
- _f_dur = System.currentTimeMillis()-_s;
- }
-
- /**
- *
- * This is the rendering-method called by sDisplay
- * (and sDisplay is called by paint !).
- * The derived-class (Your Subclass) will redefine this, to draw it's own...
- *
- * <p>
- *
- * You MUST encapsulate your OpenGL call's within:
- * <pre>
- - glj.gljMakeCurrent()
- YOUR OpenGL commands here !
- - glj.gljFree()
- * </pre>
- *
- * BE SURE, if you want to call 'display' by yourself
- * (e.g. in the run method for animation)
- * YOU HAVE TO CALL sDisplay !
- *
- * 'sDisplay' manages a semaphore to avoid reentrance of
- * the display function !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- *
- * @return void
- *
- * @see gl4java.awt.GLCanvas#sDisplay
- * @see gl4java.awt.GLCanvas#paint
- * @see gl4java.GLContext#gljMakeCurrent
- * @see gl4java.GLContext#gljSwap
- */
- public void display()
- {
- }
-
- /**
- *
- * This is the reshape-method called by paint.
- * The derived-class (Your Subclass) will redefine this,
- * to manage your individual reshape ...
- *
- * This �reshape� method will be invoked after the first paint command
- * after GLCanvas.componentResize is called AND only if �gljUse� was
- * succesfull (so a call of gljUse is redundant).
- * �reshape� is not an overloading of java.awt.Component.reshape,
- * �reshape� is more like �glut�-reshape.
- *
- * GLCanvas.reshape allready has a simple default implementation,
- * which calls �gljResize� and �glViewport� - so you may be can
- * left this one as it is (no need to overload).
- * The needed call to �gljResize� is done by hte invoker paint !
- *
- * @param width the new width
- * @param height the new height
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- * @see gl4java.awt.GLCanvas#sDisplay
- */
- public void reshape( int width, int height )
- {
- gl.glViewport(0,0, width, height);
- }
-
- /**
- *
- * �componentResized� is the componentListeners event handler.
- *
- * This method sets the variable �mustResize� to true,
- * so the upcoming �paint� method-call will invoke �reshape� !
- *
- * This little look-alike complicating thing is done,
- * to avoid an Exception by using the glContext from more than
- * one concurrent thread�s !
- *
- * You cannot override this implementation, it is final
- * - override �reshape' instead !
- *
- * @param e the element, which is resized
- * @return void
- *
- * @see gl4java.awt.GLCanvas#paint
- * @see gl4java.awt.GLCanvas#reshape
- */
- public void componentResized(ComponentEvent e)
- {
- if(glj!=null && glj.gljIsInit() && e.getComponent()==this )
- {
- mustResize = true;
- repaint();
- }
- }
-
- public void componentMoved(ComponentEvent e)
- {
- if(glj!=null && glj.gljIsInit())
- {
- repaint(100);
- }
- }
-
- public void componentShown(ComponentEvent e)
- {
- }
-
- public void componentHidden(ComponentEvent e)
- { }
-
- public void mouseClicked(MouseEvent e)
- {
- if(glj!=null && glj.gljIsInit())
- {
- repaint();
- }
- }
-
- public void mouseEntered(MouseEvent e)
- { }
- public void mouseExited(MouseEvent e)
- {}
- public void mousePressed(MouseEvent e)
- {
- }
- public void mouseReleased(MouseEvent e)
- {
- }
-
- public void windowOpened(WindowEvent e)
- {
- }
-
- /**
- *
- * �windowClosing� is the windowListeners event handler
- * for the topLevelWindow of this Canvas !
- *
- * This methods free�s AND destroy�s
- * the GL Context with �glj.gljDestroy� !
- *
- * @return void
- *
- */
- public void windowClosing(WindowEvent e)
- {
- if(e.getComponent().equals(topLevelWindow))
- {
- cvsDispose();
- }
- }
-
- /**
- *
- * �windowClosed� is the windowListeners event handler.
- *
- * @return void
- *
- */
- public void windowClosed(WindowEvent e)
- {
- if (needCvsDispose) cvsDispose();
- }
-
- public void windowIconified(WindowEvent e)
- {
- }
-
- public void windowDeiconified(WindowEvent e)
- {
- }
-
- public void windowActivated(WindowEvent e)
- {
- if(glj!=null && glj.gljIsInit())
- {
- repaint(100);
- }
- }
-
- public void windowDeactivated(WindowEvent e)
- {
- }
-
- /**
- * You should call this before releasing/dispose this Window !
- * Also you can overwrite this class,
- * to dispose your own elements, e.g. a Frame etc. -
- * but be shure that you call
- * cvsDispose implementation call this one !
- *
- * This function calls gljDestroy of GLContext !
- * The Visibility is set to false !
- * The Enabled is set to false either !
- *
- * To bring this component back to live,
- * you need call setVisible(true) !
- *
- * @see gl4java.GLContext#gljDestroy
- * @see gl4java.awt.GLCanvas#doCleanup
- */
- public void cvsDispose()
- {
- if(GLContext.gljClassDebug)
- System.out.println("GLCanvas cvsDispose (doit="+
- ( (glj != null) && glj.gljIsInit() ) +")");
-
- removeComponentListener(this);
- removeMouseListener(this);
-
- if (glj != null)
- {
- if (glj.gljIsInit())
- {
- /* Sometimes the Microsoft VM calls the
- Applet.stop() method but doesn't have
- permissions to do J/Direct calls, so
- this whole block of code will throw a
- security exception. If this happens,
- however, windowClosing() will still
- call us again later and we will have
- another opportunity to shut down the
- context, so it all works out fine. */
- try
- {
- setVisible(false);
- doCleanup();
-
- glj.gljDestroy();
- needCvsDispose = false;
- }
- catch (Exception ex)
- {
- needCvsDispose = true;
- }
- }
- }
-
- // Setting glj to null will simply cause paint() to re-initialize.
- // We don't want that to happen, so we will leave glj non-null.
- }
-
- /**
- * does nothing than:
- *
- * @see gl4java.awt.GLCanvas#cvsDispose
- */
- protected void finalize()
- throws Throwable
- {
- if(GLContext.gljClassDebug)
- System.out.println("GLCanvas finalize ..");
-
- cvsDispose();
- super.finalize();
- }
-
- /**
- * does nothing than:
- *
- * @see gl4java.awt.GLCanvas#cvsDispose
- *
- * @deprecated Use cvsDispose instead, well finalize is also implemented
- */
- public void destroy()
- {
- if(GLContext.gljClassDebug)
- System.out.println("GLCanvas destroy ..");
-
- cvsDispose();
- }
-
- /**
- * get methods
- */
- public final int cvsGetWidth() {
- return getSize().width;
- }
- public final int cvsGetHeight() {
- return getSize().height;
- }
-}
-
+/**
+ * @(#) GLCanvas.java
+ */
+
+
+package gl4java.awt;
+
+import gl4java.*;
+import gl4java.drawable.*;
+import gl4java.drawable.utils.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.EventListener;
+
+/**
+ * This is meant as an base class writing
+ * easy render functions. A clean usage of multi-threading compatible
+ * with JAVA2 is implemented in GLAnimCanvas !
+ *
+ * <p>
+ *
+ * If you are interessting in further Documentation and/or
+ * the history of GL4Java follow the following link.
+ *
+ * <pre>
+ <a href="../../GL4Java.html">The GL4Java Documentation</a>
+ * </pre>
+ * <p>
+ *
+ * There are two ways of using a GLCanvas: the {@link
+ * gl4java.drawable.GLEventListener} model or the subclassing model. Earlier
+ * versions of OpenGL for Java only supported the subclassing model.
+ * The default implementations of {@link #init}, {@link #display},
+ * {@link #reshape} and {@link #doCleanup}
+ * now send events to GLEventListeners; they can
+ * still be overridden as before to support the subclassing model.
+ *
+ * <p>
+ * If using the subclassing model, you should override the following
+ * methods for your needs:
+ * <pre>
+ <a href="GLCanvas.html#init()">preInit - initialisation before creating GLContext</a>
+ <a href="GLCanvas.html#init()">init - 1st initialisation after creating GLContext</a>
+ <a href="GLCanvas.html#doCleanup()">doCleanup - OGL cleanup prior to context deletion</a>
+ <a href="GLCanvas.html#display()">display - render your frame</a>
+ <a href="GLCanvas.html#reshape(int, int)">reshape - to reshape (window resize), gljResize() is allready invoked !</a>
+ * </pre>
+ *
+ * To check if you can use the GLContext and GL and GLU methods,
+ * use the function
+ * <pre>
+ <a href="GLCanvas.html#cvsIsInit()">cvsIsInit</a>
+ * </pre>
+ * <p>
+ * IF you remove/release a GLCanvas,
+ * e.g. you want to close/dispose it�s Window (which contains this GLCanvas),
+ * you HAVE TO call:
+ *
+ * <pre>
+ <a href="GLCanvas.html#cvsDispose()">cvsDispose</a>
+ * </pre>
+ * You should call this before releasing/dispose this Window !
+ * Also you can overwrite this class,
+ * to dispose your own elements, e.g. a Frame etc. -
+ * but be shure that you call
+ * cvsDispose implementation call this one !
+ *
+ * <p>
+ * We do override the following Canvas methods.
+ *
+ * <pre>
+ <a href="GLCanvas.html#update(java.awt.Graphics)">update</a>
+ <a href="GLCanvas.html#paint(java.awt.Graphics)">paint</a>
+ * </pre>
+ * <p>
+ *
+ * @see gl4java.awt.GLAnimCanvas
+ * @version 2.0, 21. April 1999
+ * @author Sven Goethel
+ * */
+public class GLCanvas extends Canvas
+ implements GLEnum, GLUEnum,
+ ComponentListener, WindowListener, MouseListener,
+ GLDrawable
+{
+ protected GLContext glj = null;
+ public GLFunc gl = null;
+ public GLUFunc glu = null;
+
+ protected Dimension size = null;
+ protected boolean mustResize = false;
+
+ protected boolean needCvsDispose = false;
+
+ /**
+ * Visual pre-set for doubleBuffer, default: true
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected boolean doubleBuffer = true;
+
+ /**
+ * Visual pre-set for stencil-bit number, default: 0
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected int stencilBits = 0;
+
+ /**
+ * Visual pre-set for accumulator buffer size, default: 0
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * This value has a special behavior.
+ * For input - within the contructor,
+ * it is the value for each component !
+ *
+ * The output value, after the constructor returns,
+ * it is the summary of all accumulation bits of all components !
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected int accumSize = 0;
+
+ /**
+ * Visual pre-set for stereoView, default: false
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected boolean stereoView = false;
+
+ /**
+ * Visual pre-set for RGBA usage, default: true - of course ;-)
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected boolean rgba = true;
+
+ protected GLCapabilities capabilities = null;
+
+ /**
+ * Visual pre-set for RGBA usage, default: true - of course ;-)
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected boolean createOwnWindow = false;
+
+ /**
+ * The context with wich display lists and textures will be shared.
+ *
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ protected GLContext sharedGLContext;
+
+ // The list of GLEventListeners
+ private GLEventListenerList listeners = new GLEventListenerList();
+
+ static {
+ if(GLContext.loadNativeLibraries(null, null, null)==false)
+ System.out.println("GLCanvas could not load def. native libs.");
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @param width the canvas initial-prefered width
+ * @param height the canvas initial-prefered height
+ *
+ * @param gl_Name The name of the GLFunc implementation
+ * If gl_Name==null, the default class will be used !
+ *
+ * @param glu_Name The name of the GLUFunc implementation
+ * If gl_LibName==null, the default class will be used !
+ *
+ */
+ public GLCanvas( GLCapabilities capabilities,
+ int width, int height,
+ String gl_Name,
+ String glu_Name
+ )
+ {
+ super( );
+
+ this.capabilities=capabilities;
+
+ if( (gl=GLContext.createGLFunc(gl_Name)) ==null)
+ {
+ System.out.println("GLFunc implementation "+gl_Name+" not created");
+ }
+ if( (glu=GLContext.createGLUFunc(glu_Name)) ==null)
+ {
+ System.out.println("GLUFunc implementation "+glu_Name+" not created");
+ }
+
+ size = new Dimension(width, height);
+
+ setSize(size);
+
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @param width the canvas initial-prefered width
+ * @param height the canvas initial-prefered height
+ *
+ * @param gl_Name The name of the GLFunc implementation
+ * If gl_Name==null, the default class will be used !
+ *
+ * @param glu_Name The name of the GLUFunc implementation
+ * If gl_LibName==null, the default class will be used !
+ *
+ */
+ public GLCanvas( GLCapabilities capabilities,
+ int width, int height
+ )
+ {
+ this(capabilities, width, height, null, null);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @param width the canvas initial-prefered width
+ * @param height the canvas initial-prefered height
+ *
+ * @param gl_Name The name of the GLFunc implementation
+ * If gl_Name==null, the default class will be used !
+ *
+ * @param glu_Name The name of the GLUFunc implementation
+ * If gl_LibName==null, the default class will be used !
+ *
+ */
+ public GLCanvas( int width, int height,
+ String gl_Name,
+ String glu_Name
+ )
+ {
+ this(null, width, height, gl_Name, glu_Name);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @param width the canvas initial-prefered width
+ * @param height the canvas initial-prefered height
+ *
+ */
+ public GLCanvas( int width, int height )
+ {
+ this(width, height, null, null);
+ }
+
+ /**
+ *
+ * Constructor (JDK 1.2 or later)
+ *
+ * @param config the GraphicsConfiguration for this canvas (>= JDK 1.2)
+ *
+ * @param width the canvas initial-prefered width
+ * @param height the canvas initial-prefered height
+ *
+ * @param gl_Name The name of the GLFunc implementation
+ * If gl_Name==null, the default class will be used !
+ *
+ * @param glu_Name The name of the GLUFunc implementation
+ * If gl_LibName==null, the default class will be used !
+ *
+ */
+ public GLCanvas( GraphicsConfiguration config,
+ GLCapabilities capabilities,
+ int width, int height,
+ String gl_Name,
+ String glu_Name
+ )
+ {
+ super( config );
+
+ this.capabilities=capabilities;
+
+ if( (gl=GLContext.createGLFunc(gl_Name)) ==null)
+ {
+ System.out.println("GLFunc implementation "+gl_Name+" not created");
+ }
+ if( (glu=GLContext.createGLUFunc(glu_Name)) ==null)
+ {
+ System.out.println("GLUFunc implementation "+glu_Name+" not created");
+ }
+
+ size = new Dimension(width, height);
+
+ setSize(size);
+
+ }
+
+ /**
+ *
+ * Constructor (JDK 1.2 or later)
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @param config the GraphicsConfiguration for this canvas (>= JDK 1.2)
+ *
+ * @param width the canvas initial-prefered width
+ * @param height the canvas initial-prefered height
+ *
+ */
+ public GLCanvas( GraphicsConfiguration config,
+ GLCapabilities capabilities,
+ int width, int height )
+ {
+ this(config, capabilities, width, height, null, null);
+ }
+
+ /* GLCanvas AWT classes */
+
+ public Dimension getPreferredSize() {
+ return getMinimumSize();
+ }
+
+ public Dimension getMinimumSize() {
+ return size;
+ }
+
+ /**
+ * Used to return the created GLContext
+ */
+ public final GLContext getGLContext() { return glj; }
+
+ /**
+ *
+ * Overridden update
+ * This one only call's the paint method, without clearing
+ * the background - thats hopefully done by OpenGL ;-)
+ *
+ * @param g the Graphics Context
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ public void update(Graphics g)
+ {
+ /* let's let OpenGL clear the background ... */
+ paint(g);
+ }
+
+ /**
+ * Safe the toplevel window
+ */
+ protected Window topLevelWindow = null;
+
+ /**
+ *
+ * This function returns the found TopLevelWindow,
+ * which contains this Canvas ..
+ *
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ */
+ public final Window getTopLevelWindow()
+ { return topLevelWindow; }
+
+ /**
+ * this function overrides the Canvas paint method !
+ *
+ * For the first paint,
+ * the user function preInit is called, a GLContext is created
+ * and the user function init is called !
+ *
+ * Also, if a GL Context exist, GLCanvas's sDisplay-method will be called
+ * to do OpenGL-rendering.
+ *
+ * The sDisplay method itself calls the display-method !
+ * sDisplay is needed to be thread-safe, to manage
+ * the resize functionality and to safe the time per frame.
+ *
+ * To define your rendering, you should overwrite the display-method
+ * in your derivation.
+ *
+ * @see gl4java.GLContext#GLContext
+ * @see gl4java.awt.GLCanvas#cvsIsInit
+ * @see gl4java.awt.GLCanvas#sDisplay
+ * @see gl4java.awt.GLCanvas#display
+ * @see gl4java.awt.GLCanvas#preInit
+ * @see gl4java.awt.GLCanvas#init
+ */
+ public synchronized final void paint( Graphics g )
+ {
+ if(glj == null || ( !glj.gljIsInit() && isGLEnabled() ) )
+ {
+ if(GLContext.gljClassDebug)
+ System.out.println("GLCanvas create GLContext (recreate="+
+ (glj != null) +")");
+ preInit();
+
+ if(glj!=null) glj=null;
+
+ if (capabilities != null )
+ {
+ glj = new GLContext ( this, gl, glu,
+ capabilities,
+ sharedGLContext );
+ } else {
+ glj = new GLContext ( this, gl, glu,
+ createOwnWindow,
+ doubleBuffer, stereoView,
+ rgba, stencilBits, accumSize,
+ sharedGLContext );
+ }
+
+ if(glj!=null)
+ {
+ createOwnWindow = glj.isOwnWindowCreated();
+ doubleBuffer = glj.isDoubleBuffer();
+ stencilBits = glj.getStencilBitNumber();
+ accumSize = glj.getAccumSize();
+ stereoView = glj.isStereoView();
+ rgba = glj.isRGBA();
+ }
+
+ init();
+
+ // fetch the top-level window ,
+ // to add us as the windowListener
+ //
+ Container _c = getParent();
+ Container c = null;
+
+ while(_c!=null)
+ {
+ c = _c;
+ _c = _c.getParent();
+ }
+
+ if(c instanceof Window) {
+ topLevelWindow = (Window)c;
+ topLevelWindow.addComponentListener(this);
+ } else {
+ topLevelWindow = null;
+ System.out.println("toplevel is not a Window: "+c);
+ }
+
+ if(topLevelWindow!=null)
+ {
+ topLevelWindow.addWindowListener(this);
+ } else {
+ System.out.println("no parent found for "+getName());
+ System.out.flush();
+ }
+
+ /* to be able for RESIZE event's */
+ addComponentListener(this);
+ addMouseListener(this);
+
+ /* force a reshape, to be sure .. */
+ mustResize = true;
+ }
+
+ sDisplay();
+ }
+
+ /**
+ *
+ * This is your pre-init method.
+ * preInit is called just BEFORE the GL-Context is created.
+ * You should override preInit, to initialize your visual-stuff,
+ * like the protected vars: doubleBuffer and stereoView
+ *
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.awt.GLCanvas#doubleBuffer
+ * @see gl4java.awt.GLCanvas#stereoView
+ * @see gl4java.awt.GLCanvas#rgba
+ * @see gl4java.awt.GLCanvas#stencilBits
+ * @see gl4java.awt.GLCanvas#accumSize
+ */
+ public void preInit()
+ {
+ }
+
+ /**
+ *
+ * init is called right after the GL-Context is initialized.
+ * The default implementation calls init() on all of this
+ * component's GLEventListeners.
+ *
+ * <p>
+ * If using the subclassing model, you can override this to
+ * perform one-time OpenGL initializations such as setting up
+ * lights and display lists.
+ *
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.drawable.GLEventListener#init
+ */
+ public void init()
+ {
+ listeners.sendInitEvent(this);
+ }
+
+ /**
+ * This method is used to clean up any OpenGL stuff (delete textures
+ * or whatever) prior to actually deleting the OpenGL context.
+ * You should override this with your own version, if you need to do
+ * any cleanup work at this phase.
+ * This functions is called within cvsDispose
+ *
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#cvsDispose
+ * @see gl4java.drawable.GLEventListener#cleanup
+ */
+ public void doCleanup()
+ {
+ listeners.sendCleanupEvent(this);
+ }
+
+ /**
+ * This function returns, if everything is init: the GLContext,
+ * the and the users init function
+ * This value is set in the paint method!
+ *
+ * @return boolean
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.awt.GLCanvas#init
+ */
+ public boolean cvsIsInit()
+ {
+ if(glj!=null)
+ return glj.gljIsInit();
+ return false;
+ }
+
+ /**
+ * This function enables, disables the GL-Context !
+ * If false is given, the openGL renderer/context is
+ * disabled and disconected (gljFree is called, if initialized) !
+ *
+ * If disabled, all GL Functions are disabled but the
+ * Destroy & Free are not !
+ *
+ * @return boolean
+ *
+ * @see gl4java.awt.GLCanvas#cvsDispose
+ * @see gl4java.GLContext#setEnabled
+ * @see gl4java.GLContext#gljMakeCurrent
+ * @see gl4java.GLContext#gljDestroy
+ * @see gl4java.GLContext#gljFree
+ */
+ public void setGLEnabled(boolean b)
+ {
+ if(glj!=null)
+ glj.setEnabled(b);
+ }
+
+ /**
+ * This function enables, disables the GL-Context !
+ * If false is given, the openGL renderer/context is
+ * disabled and disconected (gljFree is called, if initialized) !
+ *
+ * If disabled, all GL Functions are disabled but the
+ * Destroy & Free are not !
+ *
+ * The Visible-Flag of this AWT Component is also set to the given value !
+ * The setVisible(boolean) method of Component is called !
+ *
+ * @return boolean
+ *
+ * @see gl4java.awt.GLCanvas#cvsDispose
+ * @see gl4java.GLContext#setEnabled
+ * @see gl4java.GLContext#gljMakeCurrent
+ * @see gl4java.GLContext#gljDestroy
+ * @see gl4java.GLContext#gljFree
+ */
+ public void setVisible(boolean b)
+ {
+ if(glj!=null)
+ glj.setEnabled(b);
+ super.setVisible(b);
+ }
+
+ /**
+ * This function queries, if the GL-Context is enabled !
+ *
+ * @return boolean
+ *
+ * @see gl4java.GLContext#isEnabled
+ * @see gl4java.GLContext#gljMakeCurrent
+ */
+ public boolean isGLEnabled()
+ {
+ if(glj!=null)
+ return glj.isEnabled();
+ return false;
+ }
+
+ protected long _f_dur = 0;
+
+ /**
+ *
+ * This is the thread save rendering-method called by paint.
+ * The actual thread will be set to highes priority befor calling
+ * 'display'. After 'display' the priority will be reset !
+ *
+ * 'gljFree' will be NOT called after 'display'.
+ *
+ * We tested the above to use multi-threading and
+ * for the demonstration 'glDemos' it works ;-)) !
+ *
+ * BE SURE, if you want to call 'display' by yourself
+ * (e.g. in the run method for animation)
+ * YOU HAVE TO CALL sDisplay -- OR YOU MUST KNOW WHAT YOU ARE DOING THEN !
+ *
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.awt.GLCanvas#display
+ */
+ public synchronized final void sDisplay()
+ {
+ boolean ok = true;
+
+ if(!cvsIsInit())
+ {
+ return;
+ }
+
+ if( mustResize )
+ {
+ if( glj.gljMakeCurrent() == true )
+ {
+ size = getSize();
+ glj.gljResize( size.width, size.height ) ;
+ reshape(size.width, size.height);
+ mustResize = false;
+ invalidate();
+ repaint(100);
+ glj.gljFree();
+ }
+ }
+
+ long _s = System.currentTimeMillis();
+
+ if(ok)
+ {
+ display();
+ }
+
+ _f_dur = System.currentTimeMillis()-_s;
+ }
+
+ /**
+ *
+ * This is the rendering-method called by sDisplay
+ * (and sDisplay is called by paint !).
+ *
+ * <p>
+ * The default implementation of display() sends
+ * preDisplay, display and postDisplay events to
+ * all {@link gl4java.GLEventListener}s associated with this
+ * GLCanvas in the above order.
+ *
+ * <p>
+ * <pre>
+ reset timer for frame duration (done by sDisplay)
+
+ for_all(gl4java.GLEventListener)
+ SEND preDisplay
+
+ if( gljMakeCurrent() )
+ {
+ for_all(gl4java.GLEventListener)
+ SEND display
+ gljFree()
+ gljSwap()
+
+ for_all(gl4java.GLEventListener)
+ SEND postDisplay
+ }
+
+ stop timer for frame duration (done by sDisplay)
+ * </pre>
+ *
+ * <p>
+ * If you use the subclassing model (as opposed to the
+ * GLEventListener model), your subclass will redefine this to
+ * perform its OpenGL drawing. In this case you MUST encapsulate
+ * your OpenGL calls within:
+ * <pre>
+ - glj.gljMakeCurrent()
+ YOUR OpenGL commands here !
+ - glj.gljFree()
+ * </pre>
+ *
+ * BE SURE, if you want to call 'display' by yourself
+ * (e.g. in the run method for animation)
+ * YOU HAVE TO CALL sDisplay !
+ *
+ * 'sDisplay' manages a semaphore to avoid reentrance of
+ * the display function !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ *
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#sDisplay
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.GLContext#gljMakeCurrent
+ * @see gl4java.GLContext#gljSwap
+ * @see gl4java.drawable.GLEventListener#preDisplay
+ * @see gl4java.drawable.GLEventListener#display
+ * @see gl4java.drawable.GLEventListener#postDisplay
+ */
+ public void display()
+ {
+ listeners.sendPreDisplayEvent(this);
+
+ if (glj.gljMakeCurrent()) {
+ listeners.sendDisplayEvent(this);
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ listeners.sendPostDisplayEvent(this);
+ }
+
+ }
+
+ /**
+ *
+ * This �reshape� method will be invoked after the first paint command
+ * after GLCanvas.componentResize is called AND only if �gljMakeCurrent� was
+ * successful (so a call of gljMakeCurrent is redundant).
+ * �reshape� is not an overloading of java.awt.Component.reshape,
+ * �reshape� is more like �glut�-reshape.
+ *
+ * <p>
+ * GLCanvas.reshape already has a simple default implementation,
+ * which calls �gljResize� and �glViewport�. It also sends the
+ * reshape() event to all GLEventListeners. If using the
+ * GLEventListener model, it may not be necessary to do anything
+ * in your event listener's reshape() method; if using the
+ * subclassing model, it may not be necessary to override this.
+ *
+ * <p>
+ * The needed call to �gljResize� is done by the invoker paint !
+ *
+ * @param width the new width
+ * @param height the new height
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.awt.GLCanvas#sDisplay
+ * @see gl4java.drawable.GLEventListener#reshape
+ */
+ public void reshape( int width, int height )
+ {
+ gl.glViewport(0,0, width, height);
+ listeners.sendReshapeEvent(this, width, height);
+ }
+
+ /**
+ *
+ * �componentResized� is the componentListeners event handler.
+ *
+ * This method sets the variable �mustResize� to true,
+ * so the upcoming �paint� method-call will invoke �reshape� !
+ *
+ * This little look-alike complicating thing is done,
+ * to avoid an Exception by using the glContext from more than
+ * one concurrent thread�s !
+ *
+ * You cannot override this implementation, it is final
+ * - override �reshape' instead !
+ *
+ * @param e the element, which is resized
+ * @return void
+ *
+ * @see gl4java.awt.GLCanvas#paint
+ * @see gl4java.awt.GLCanvas#reshape
+ */
+ public void componentResized(ComponentEvent e)
+ {
+ if(glj!=null && glj.gljIsInit() && e.getComponent()==this )
+ {
+ mustResize = true;
+ repaint();
+ }
+ }
+
+ public void componentMoved(ComponentEvent e)
+ {
+ if(glj!=null && glj.gljIsInit())
+ {
+ repaint(100);
+ }
+ }
+
+ public void componentShown(ComponentEvent e)
+ {
+ }
+
+ public void componentHidden(ComponentEvent e)
+ { }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ if(glj!=null && glj.gljIsInit())
+ {
+ repaint();
+ }
+ }
+
+ public void mouseEntered(MouseEvent e)
+ { }
+ public void mouseExited(MouseEvent e)
+ {}
+ public void mousePressed(MouseEvent e)
+ {
+ }
+ public void mouseReleased(MouseEvent e)
+ {
+ }
+
+ public void windowOpened(WindowEvent e)
+ {
+ }
+
+ /**
+ *
+ * �windowClosing� is the windowListeners event handler
+ * for the topLevelWindow of this Canvas !
+ *
+ * This methods free�s AND destroy�s
+ * the GL Context with �glj.gljDestroy� !
+ *
+ * @return void
+ *
+ */
+ public void windowClosing(WindowEvent e)
+ {
+ if(e.getComponent().equals(topLevelWindow))
+ {
+ cvsDispose();
+ }
+ }
+
+ /**
+ *
+ * �windowClosed� is the windowListeners event handler.
+ *
+ * @return void
+ *
+ */
+ public void windowClosed(WindowEvent e)
+ {
+ if (needCvsDispose) cvsDispose();
+ }
+
+ public void windowIconified(WindowEvent e)
+ {
+ }
+
+ public void windowDeiconified(WindowEvent e)
+ {
+ }
+
+ public void windowActivated(WindowEvent e)
+ {
+ if(glj!=null && glj.gljIsInit())
+ {
+ repaint(100);
+ }
+ }
+
+ public void windowDeactivated(WindowEvent e)
+ {
+ }
+
+ /**
+ * You should call this before releasing/dispose this Window !
+ * Also you can overwrite this class,
+ * to dispose your own elements, e.g. a Frame etc. -
+ * but be shure that you call
+ * cvsDispose implementation call this one !
+ *
+ * This function calls gljDestroy of GLContext !
+ * The Visibility is set to false !
+ * The Enabled is set to false either !
+ *
+ * To bring this component back to live,
+ * you need call setVisible(true) !
+ *
+ * @see gl4java.GLContext#gljDestroy
+ * @see gl4java.awt.GLCanvas#doCleanup
+ */
+ public void cvsDispose()
+ {
+ if(GLContext.gljClassDebug)
+ System.out.println("GLCanvas cvsDispose (doit="+
+ ( (glj != null) && glj.gljIsInit() ) +")");
+
+ removeComponentListener(this);
+ removeMouseListener(this);
+
+ if (glj != null)
+ {
+ if (glj.gljIsInit())
+ {
+ /* Sometimes the Microsoft VM calls the
+ Applet.stop() method but doesn't have
+ permissions to do J/Direct calls, so
+ this whole block of code will throw a
+ security exception. If this happens,
+ however, windowClosing() will still
+ call us again later and we will have
+ another opportunity to shut down the
+ context, so it all works out fine. */
+ try
+ {
+ setVisible(false);
+ doCleanup();
+
+ glj.gljDestroy();
+ needCvsDispose = false;
+ }
+ catch (Exception ex)
+ {
+ needCvsDispose = true;
+ }
+ }
+ }
+
+ // Setting glj to null will simply cause paint() to re-initialize.
+ // We don't want that to happen, so we will leave glj non-null.
+ }
+
+ /**
+ * does nothing than:
+ *
+ * @see gl4java.awt.GLCanvas#cvsDispose
+ */
+ protected void finalize()
+ throws Throwable
+ {
+ if(GLContext.gljClassDebug)
+ System.out.println("GLCanvas finalize ..");
+
+ cvsDispose();
+ super.finalize();
+ }
+
+ /**
+ * does nothing than:
+ *
+ * @see gl4java.awt.GLCanvas#cvsDispose
+ *
+ * @deprecated Use cvsDispose instead, well finalize is also implemented
+ */
+ public void destroy()
+ {
+ if(GLContext.gljClassDebug)
+ System.out.println("GLCanvas destroy ..");
+
+ cvsDispose();
+ }
+
+ /**
+ * get methods
+ */
+ public final int cvsGetWidth() {
+ return getSize().width;
+ }
+ public final int cvsGetHeight() {
+ return getSize().height;
+ }
+
+ //----------------------------------------------------------------------
+ // Implementation of GLDrawable
+ //
+
+ public void addGLEventListener(GLEventListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeGLEventListener(GLEventListener listener) {
+ listeners.remove(listener);
+ }
+
+ public EventListener[] getListeners(Class listenerType)
+ throws ClassCastException
+ {
+ EventListener[] evtlst=null;
+ Class _GLEventListener = null;
+
+ try {
+ _GLEventListener = Class.forName("gl4java.drawable.GLEventListener");
+ } catch (Exception ex) {
+ System.out.println(ex);
+ }
+
+ if (_GLEventListener!=null &&
+ listenerType.isAssignableFrom(_GLEventListener) )
+ evtlst = listeners.getListeners();
+
+ EventListener[] t_evtlst = super.getListeners(listenerType);
+
+ if(t_evtlst==null || t_evtlst.length==0)
+ return evtlst;
+
+ if(evtlst==null || evtlst.length==0)
+ return t_evtlst;
+
+ EventListener[] n_evtlst =
+ new EventListener[t_evtlst.length+evtlst.length];
+
+ try {
+ System.arraycopy(evtlst, 0, n_evtlst, 0, evtlst.length);
+ System.arraycopy(t_evtlst, 0, n_evtlst, evtlst.length, t_evtlst.length);
+ } catch (Exception ex)
+ { System.out.println(ex); }
+
+ evtlst = null;
+ t_evtlst = null;
+
+ return n_evtlst;
+ }
+
+ public GLFunc getGL() {
+ return gl;
+ }
+
+ public GLUFunc getGLU() {
+ return glu;
+ }
+}
diff --git a/gl4java/awt/GLImageCanvas.java b/gl4java/awt/GLImageCanvas.java
index 113d589..0a87785 100755
--- a/gl4java/awt/GLImageCanvas.java
+++ b/gl4java/awt/GLImageCanvas.java
@@ -1,402 +1,409 @@
-/**
- * @(#) GLImageCanvas.java
- */
-
-
-package gl4java.awt;
-
-import gl4java.*;
-import gl4java.utils.*;
-import gl4java.utils.textures.*;
-
-import java.awt.*;
-import java.net.*;
-
-/**
- * This Class provides a simple universal
- * Image/Texture OpenGL Canvas !
- *
- * A special demo/application for this class can be found
- * in "demos/MiscDemos/GLImageViewerCanvas.java" !
- *
- * @see TextureLoader
- * @author Sven Goethel
- *
- */
-public class GLImageCanvas extends GLCanvas
-{
- int texName[] = {0};
- TextureLoader txtLoader = null;
- boolean newText = false;
- boolean keepAspect = true;
- boolean zoomImg = true;
-
- TextureGrabber textGrab4Snapshot = null;
- String textGrab4SnapshotFName = null;
- URL textGrab4SnapshotURL = null;
- String textGrab4SnapshotURI = null;
-
- public GLImageCanvas(int w, int h)
- {
- super(w, h);
- }
-
- public void setKeepAspectRatio(boolean v)
- { keepAspect=v; }
-
- public boolean getKeepAspectRatio()
- { return keepAspect; }
-
- public void setZoomAble(boolean v)
- { zoomImg = v; }
-
- public boolean getZoomAble()
- { return zoomImg; }
-
- public TextureLoader getTextureLoader()
- { return txtLoader; }
-
- public void setOriginalSize()
- {
- if(txtLoader!=null && txtLoader.isOk())
- {
- internalSetSize( txtLoader.getImageWidth(),
- txtLoader.getImageHeight() );
- }
- }
-
- /**
- * Creates a snapshot (save texture/image) of the current
- * GL-Context !
- *
- * The snapshot itself is created delayed,
- * so no return value is avaiable.
- * Because this is a non critical path, I hope its enough !
- *
- * @param tg The TextureGrabber
- * @param fname The filename
- * @see TextureGrabber
- */
- public void snapshot(TextureGrabber tg, String fname)
- {
- textGrab4Snapshot=tg;
- textGrab4SnapshotFName=fname;
- repaint();
- }
-
- /**
- * Creates a snapshot (save texture/image) of the current
- * GL-Context !
- *
- * The snapshot itself is created delayed,
- * so no return value is avaiable.
- * Because this is a non critical path, I hope its enough !
- *
- * @param tg The TextureGrabber
- * @param base The base URL
- * @param uri The additional uri for the base URL
- * @see TextureGrabber
- */
- public void snapshot(TextureGrabber tg, URL base, String uri)
- {
- textGrab4Snapshot=tg;
- textGrab4SnapshotURL = base;
- textGrab4SnapshotURI = uri;
- repaint();
- }
-
- public Dimension getPreferredSize() {
- return getMinimumSize();
- }
-
- public Dimension getMinimumSize() {
- return getSize();
- }
-
- protected void internalSetSize(int w, int h)
- {
- setSize( w, h );
- invalidate();
-
- Window holder = Tool.getWindow(this);
-
- if(holder!=null)
- {
- holder.invalidate();
- holder.pack();
- holder.repaint();
- }
- }
-
- public void preInit()
- {
- // createOwnWindow = true;
- }
-
- public void init()
- {
- gl.glEnable(GL_TEXTURE_2D);
-
- gl.glGenTextures(1,texName);
- gl.glBindTexture(GL_TEXTURE_2D,texName[0]);
-
- gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
- gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
- gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
- gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
- gl.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- gl.glShadeModel (GL_SMOOTH);
-
- gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
-
- reshape(getSize().width, getSize().height);
- }
-
- /**
- * Loads an Image of the appropiate type,
- * and renders and resizes the complete window !
- *
- * @param fname The filename
- * @param type The type of file, e.g. TextureLoader is used !
- * The following types are currently allowed:
- * "png" for PngTextureLoader,
- * "ppm" for PPMAsciiTextureLoader,
- * "tga" for PPMAsciiTextureLoader,
- * "any" for AWTTextureLoader !
- */
- public boolean loadTexture(String fname, String type)
- {
- return loadTexture(fname, null, null, type);
- }
-
- /**
- * Loads an Image of the appropiate type,
- * and renders and resizes the complete window !
- *
- * @param base The base URL
- * @param uri The additional uri for the base URL
- * @param type The type of file, e.g. TextureLoader is used !
- * The following types are currently allowed:
- * "png" for PngTextureLoader,
- * "ppm" for PPMAsciiTextureLoader,
- * "tga" for PPMAsciiTextureLoader,
- * "any" for AWTTextureLoader !
- */
- public boolean loadTexture(URL base, String uri, String type)
- {
- return loadTexture(null, base, uri, type);
- }
-
- protected boolean loadTexture(String fname,
- URL base, String uri, String type)
- {
- boolean ok = true;
-
- if( glj.gljMakeCurrent() == false )
- {
- System.out.println("problem in use() method");
- return false;
- }
-
- // texture laden
- if(type.equals("png"))
- txtLoader = new PngTextureLoader(gl, glu);
- else if(type.equals("ppm"))
- txtLoader = new PPMAsciiTextureLoader(gl, glu);
- else if(type.equals("tga"))
- txtLoader = new TGATextureLoader(gl, glu);
- else if(type.equals("any"))
- txtLoader = new AWTTextureLoader(this, gl, glu);
- else {
- System.out.println("Imagetype: "+type+" is currently not supported !");
- ok = false;
- }
-
- if(ok)
- {
- try {
- if(fname!=null)
- txtLoader.readTexture(fname);
- else
- txtLoader.readTexture(base, uri);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- if(ok && txtLoader.isOk())
- {
- gl.glEnable(GL_TEXTURE_2D);
-
- txtLoader.texImage2DNonScaled(true);
-
- gl.glDisable(GL_TEXTURE_2D);
- System.out.println("texture succesfully loaded !");
- System.out.println("texture: "+txtLoader);
- }
- glj.gljCheckGL();
- glj.gljFree();
- if(ok) {
- internalSetSize( txtLoader.getImageWidth(),
- txtLoader.getImageHeight() );
- }
- return ok;
- }
-
- public void display()
- {
- int i;
-
- /* Standard GL4Java Init */
- if( glj.gljMakeCurrent() == false )
- {
- System.out.println("problem in use() method");
- return;
- }
-
- SetCamera();
-
- // just render it
- gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- DrawObj(false);
-
- if(textGrab4Snapshot!=null)
- {
- textGrab4Snapshot.grabPixels(GL_BACK,
- 0, 0, cvsGetWidth(), cvsGetHeight());
- if(textGrab4SnapshotFName!=null)
- textGrab4Snapshot.write2File(textGrab4SnapshotFName);
- else
- textGrab4Snapshot.write2File(textGrab4SnapshotURL,
- textGrab4SnapshotURI);
- textGrab4Snapshot =null;
- textGrab4SnapshotFName=null;
- textGrab4SnapshotURL =null;
- textGrab4SnapshotURI =null;
- }
-
- /* For your animation dutys ;-) */
- glj.gljSwap();
- glj.gljCheckGL();
- glj.gljFree();
- }
-
- /**
- * to prevent a deadlock in recursive
- * reshape .. internalSetSize .. pack .. resize -> reshape !
- */
- private int reshape_resize_sema = 1;
-
- public void reshape(int w, int h)
- {
- if(reshape_resize_sema>0 &&
- keepAspect && txtLoader!=null && txtLoader.isOk())
- {
- reshape_resize_sema--;
-
- int rw=w; int rh=h;
- if(zoomImg)
- {
- double iaspect = (double)txtLoader.getImageWidth()/
- (double)txtLoader.getImageHeight();
- if(rw<rh)
- {
- h = (int) ((rw / iaspect)+0.5);
- } else {
- w = (int) ((rh * iaspect)+0.5);
- }
- } else {
- w = txtLoader.getImageWidth();
- h = txtLoader.getImageHeight();
- }
- if(rw!=w || rh!=h)
- {
- internalSetSize( w, h );
- return ; /* the true resize is coming up ... */
- }
- }
- reshape_resize_sema=1;
- gl.glViewport (0, 0, w, h);
- SetCamera();
- }
-
-
- protected void DrawObj(boolean blend)
- {
- gl.glPushMatrix();
- if(blend)
- {
- gl.glEnable(GL_BLEND);
- gl.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- }
-
- gl.glColor4f(1f,1f,1f,1f);
-
- if(txtLoader!=null && txtLoader.isOk())
- {
- gl.glEnable(GL_TEXTURE_2D);
- gl.glBegin(GL_QUADS);
-
- gl.glNormal3f(0f,0f,1f);
- gl.glTexCoord2f(0f,0f);
- gl.glVertex2f(0f, 0f);
-
- gl.glNormal3f(0f,0f,1f);
- gl.glTexCoord2f(0f,1f);
- gl.glVertex2f(0f, 1f);
-
- gl.glNormal3f(0f,0f,1f);
- gl.glTexCoord2f(1f,1f);
- gl.glVertex2f(1f, 1f);
-
- gl.glNormal3f(0f,0f,1f);
- gl.glTexCoord2f(1f,0f);
- gl.glVertex2f(1f, 0f);
-
- gl.glEnd();
- gl.glDisable(GL_TEXTURE_2D);
- }
-
- if(blend)
- gl.glDisable(GL_BLEND);
-
- gl.glPopMatrix();
- }
-
- protected void SetCamera()
- {
- float imgwidth = 1f;
- float imgheight = 1f;
- float txtdx=0f;
- float txtdy=0f;
-
- if(txtLoader!=null && txtLoader.isOk())
- {
- Dimension idim = new Dimension(txtLoader.getImageWidth(),
- txtLoader.getImageHeight());
- Dimension tdim = new Dimension(txtLoader.getTextureWidth(),
- txtLoader.getTextureHeight());
-
- imgwidth = (float)idim.width/(float)tdim.width;
- imgheight = (float)idim.height/(float)tdim.height;
-
- /*
- System.out.println("image : "+idim);
- System.out.println("text : "+tdim);
- System.out.println("image/text : "+imgwidth+"/"+imgheight);
- */
- }
-
- gl.glMatrixMode (GL_PROJECTION);
- gl.glLoadIdentity ();
- glu.gluOrtho2D(0, imgwidth,
- 0, imgheight);
-
- gl.glMatrixMode (GL_MODELVIEW);
- gl.glLoadIdentity ();
- }
-
-}
-
+/**
+ * @(#) GLImageCanvas.java
+ */
+
+
+package gl4java.awt;
+
+import gl4java.*;
+import gl4java.utils.*;
+import gl4java.utils.textures.*;
+
+import java.awt.*;
+import java.net.*;
+
+/**
+ * This Class provides a simple universal
+ * Image/Texture OpenGL Canvas !
+ *
+ * A special demo/application for this class can be found
+ * in "demos/MiscDemos/GLImageViewerCanvas.java" !
+ *
+ * @see TextureLoader
+ * @author Sven Goethel
+ *
+ */
+public class GLImageCanvas extends GLCanvas
+{
+ int texName[] = {0};
+ TextureLoader txtLoader = null;
+ boolean newText = false;
+ boolean keepAspect = true;
+ boolean zoomImg = true;
+
+ TextureGrabber textGrab4Snapshot = null;
+ String textGrab4SnapshotFName = null;
+ URL textGrab4SnapshotURL = null;
+ String textGrab4SnapshotURI = null;
+
+ public GLImageCanvas(int w, int h)
+ {
+ super(w, h);
+ }
+
+ public GLImageCanvas( GraphicsConfiguration config,
+ GLCapabilities capabilities,
+ int w, int h)
+ {
+ super(config, capabilities, w, h);
+ }
+
+ public void setKeepAspectRatio(boolean v)
+ { keepAspect=v; }
+
+ public boolean getKeepAspectRatio()
+ { return keepAspect; }
+
+ public void setZoomAble(boolean v)
+ { zoomImg = v; }
+
+ public boolean getZoomAble()
+ { return zoomImg; }
+
+ public TextureLoader getTextureLoader()
+ { return txtLoader; }
+
+ public void setOriginalSize()
+ {
+ if(txtLoader!=null && txtLoader.isOk())
+ {
+ internalSetSize( txtLoader.getImageWidth(),
+ txtLoader.getImageHeight() );
+ }
+ }
+
+ /**
+ * Creates a snapshot (save texture/image) of the current
+ * GL-Context !
+ *
+ * The snapshot itself is created delayed,
+ * so no return value is avaiable.
+ * Because this is a non critical path, I hope its enough !
+ *
+ * @param tg The TextureGrabber
+ * @param fname The filename
+ * @see TextureGrabber
+ */
+ public void snapshot(TextureGrabber tg, String fname)
+ {
+ textGrab4Snapshot=tg;
+ textGrab4SnapshotFName=fname;
+ repaint();
+ }
+
+ /**
+ * Creates a snapshot (save texture/image) of the current
+ * GL-Context !
+ *
+ * The snapshot itself is created delayed,
+ * so no return value is avaiable.
+ * Because this is a non critical path, I hope its enough !
+ *
+ * @param tg The TextureGrabber
+ * @param base The base URL
+ * @param uri The additional uri for the base URL
+ * @see TextureGrabber
+ */
+ public void snapshot(TextureGrabber tg, URL base, String uri)
+ {
+ textGrab4Snapshot=tg;
+ textGrab4SnapshotURL = base;
+ textGrab4SnapshotURI = uri;
+ repaint();
+ }
+
+ public Dimension getPreferredSize() {
+ return getMinimumSize();
+ }
+
+ public Dimension getMinimumSize() {
+ return getSize();
+ }
+
+ protected void internalSetSize(int w, int h)
+ {
+ setSize( w, h );
+ invalidate();
+
+ Window holder = Tool.getWindow(this);
+
+ if(holder!=null)
+ {
+ holder.invalidate();
+ holder.pack();
+ holder.repaint();
+ }
+ }
+
+ public void preInit()
+ {
+ // createOwnWindow = true;
+ }
+
+ public void init()
+ {
+ gl.glEnable(GL_TEXTURE_2D);
+
+ gl.glGenTextures(1,texName);
+ gl.glBindTexture(GL_TEXTURE_2D,texName[0]);
+
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ gl.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ gl.glShadeModel (GL_SMOOTH);
+
+ gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
+
+ reshape(getSize().width, getSize().height);
+ }
+
+ /**
+ * Loads an Image of the appropiate type,
+ * and renders and resizes the complete window !
+ *
+ * @param fname The filename
+ * @param type The type of file, e.g. TextureLoader is used !
+ * The following types are currently allowed:
+ * "png" for PngTextureLoader,
+ * "ppm" for PPMAsciiTextureLoader,
+ * "tga" for PPMAsciiTextureLoader,
+ * "any" for AWTTextureLoader !
+ */
+ public boolean loadTexture(String fname, String type)
+ {
+ return loadTexture(fname, null, null, type);
+ }
+
+ /**
+ * Loads an Image of the appropiate type,
+ * and renders and resizes the complete window !
+ *
+ * @param base The base URL
+ * @param uri The additional uri for the base URL
+ * @param type The type of file, e.g. TextureLoader is used !
+ * The following types are currently allowed:
+ * "png" for PngTextureLoader,
+ * "ppm" for PPMAsciiTextureLoader,
+ * "tga" for PPMAsciiTextureLoader,
+ * "any" for AWTTextureLoader !
+ */
+ public boolean loadTexture(URL base, String uri, String type)
+ {
+ return loadTexture(null, base, uri, type);
+ }
+
+ protected boolean loadTexture(String fname,
+ URL base, String uri, String type)
+ {
+ boolean ok = true;
+
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return false;
+ }
+
+ // texture laden
+ if(type.equals("png"))
+ txtLoader = new PngTextureLoader(gl, glu);
+ else if(type.equals("ppm"))
+ txtLoader = new PPMAsciiTextureLoader(gl, glu);
+ else if(type.equals("tga"))
+ txtLoader = new TGATextureLoader(gl, glu);
+ else if(type.equals("any"))
+ txtLoader = new AWTTextureLoader(this, gl, glu);
+ else {
+ System.out.println("Imagetype: "+type+" is currently not supported !");
+ ok = false;
+ }
+
+ if(ok)
+ {
+ try {
+ if(fname!=null)
+ txtLoader.readTexture(fname);
+ else
+ txtLoader.readTexture(base, uri);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ if(ok && txtLoader.isOk())
+ {
+ gl.glEnable(GL_TEXTURE_2D);
+
+ txtLoader.texImage2DNonScaled(true);
+
+ gl.glDisable(GL_TEXTURE_2D);
+ System.out.println("texture succesfully loaded !");
+ System.out.println("texture: "+txtLoader);
+ }
+ glj.gljCheckGL();
+ glj.gljFree();
+ if(ok) {
+ internalSetSize( txtLoader.getImageWidth(),
+ txtLoader.getImageHeight() );
+ }
+ return ok;
+ }
+
+ public void display()
+ {
+ int i;
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ SetCamera();
+
+ // just render it
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ DrawObj(false);
+
+ if(textGrab4Snapshot!=null)
+ {
+ textGrab4Snapshot.grabPixels(GL_BACK,
+ 0, 0, cvsGetWidth(), cvsGetHeight());
+ if(textGrab4SnapshotFName!=null)
+ textGrab4Snapshot.write2File(textGrab4SnapshotFName);
+ else
+ textGrab4Snapshot.write2File(textGrab4SnapshotURL,
+ textGrab4SnapshotURI);
+ textGrab4Snapshot =null;
+ textGrab4SnapshotFName=null;
+ textGrab4SnapshotURL =null;
+ textGrab4SnapshotURI =null;
+ }
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ /**
+ * to prevent a deadlock in recursive
+ * reshape .. internalSetSize .. pack .. resize -> reshape !
+ */
+ private int reshape_resize_sema = 1;
+
+ public void reshape(int w, int h)
+ {
+ if(reshape_resize_sema>0 &&
+ keepAspect && txtLoader!=null && txtLoader.isOk())
+ {
+ reshape_resize_sema--;
+
+ int rw=w; int rh=h;
+ if(zoomImg)
+ {
+ double iaspect = (double)txtLoader.getImageWidth()/
+ (double)txtLoader.getImageHeight();
+ if(rw<rh)
+ {
+ h = (int) ((rw / iaspect)+0.5);
+ } else {
+ w = (int) ((rh * iaspect)+0.5);
+ }
+ } else {
+ w = txtLoader.getImageWidth();
+ h = txtLoader.getImageHeight();
+ }
+ if(rw!=w || rh!=h)
+ {
+ internalSetSize( w, h );
+ return ; /* the true resize is coming up ... */
+ }
+ }
+ reshape_resize_sema=1;
+ gl.glViewport (0, 0, w, h);
+ SetCamera();
+ }
+
+
+ protected void DrawObj(boolean blend)
+ {
+ gl.glPushMatrix();
+ if(blend)
+ {
+ gl.glEnable(GL_BLEND);
+ gl.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ gl.glColor4f(1f,1f,1f,1f);
+
+ if(txtLoader!=null && txtLoader.isOk())
+ {
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glBegin(GL_QUADS);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(0f,0f);
+ gl.glVertex2f(0f, 0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(0f,1f);
+ gl.glVertex2f(0f, 1f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(1f,1f);
+ gl.glVertex2f(1f, 1f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(1f,0f);
+ gl.glVertex2f(1f, 0f);
+
+ gl.glEnd();
+ gl.glDisable(GL_TEXTURE_2D);
+ }
+
+ if(blend)
+ gl.glDisable(GL_BLEND);
+
+ gl.glPopMatrix();
+ }
+
+ protected void SetCamera()
+ {
+ float imgwidth = 1f;
+ float imgheight = 1f;
+ float txtdx=0f;
+ float txtdy=0f;
+
+ if(txtLoader!=null && txtLoader.isOk())
+ {
+ Dimension idim = new Dimension(txtLoader.getImageWidth(),
+ txtLoader.getImageHeight());
+ Dimension tdim = new Dimension(txtLoader.getTextureWidth(),
+ txtLoader.getTextureHeight());
+
+ imgwidth = (float)idim.width/(float)tdim.width;
+ imgheight = (float)idim.height/(float)tdim.height;
+
+ /*
+ System.out.println("image : "+idim);
+ System.out.println("text : "+tdim);
+ System.out.println("image/text : "+imgwidth+"/"+imgheight);
+ */
+ }
+
+ gl.glMatrixMode (GL_PROJECTION);
+ gl.glLoadIdentity ();
+ glu.gluOrtho2D(0, imgwidth,
+ 0, imgheight);
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+ }
+
+}
+
diff --git a/gl4java/swing/GLAnimJPanel.java b/gl4java/swing/GLAnimJPanel.java
index a7af76a..bdbdd94 100644
--- a/gl4java/swing/GLAnimJPanel.java
+++ b/gl4java/swing/GLAnimJPanel.java
@@ -24,6 +24,25 @@ import java.lang.Math;
* <pre>
<a href="../../GL4Java.html">The GL4Java Documentation</a>
* </pre>
+ *
+ * <p>
+ * There are two ways of using a GLAnimJPanel: the {@link
+ * gl4java.GLEventListener} model or the subclassing model. Earlier
+ * versions of the system only supported the subclassing model. The
+ * default implementations of {@link #init}, {@link #display},
+ * {@link #reshape} and {@link #doCleanup}
+ * now send events to GLEventListeners; they can
+ * still be overridden as before to support the subclassing model.
+ *
+ * <p>
+ * If using the subclassing model, you should override the following
+ * methods for your needs:
+ * <pre>
+ <a href="GLAnimJPanel.html#init()">init - 1st initialisation</a>
+ <a href="GLAnimJPanel.html#display()">display - render one frame</a>
+ <a href="GLCanvas.html#reshape(int, int)">reshape - to reshape (window resize)</a>
+ <a href="GLAnimJPanel.html#ReInit()">ReInit - ReInitialisation after stop for setSuspended(false)</a>
+ * </pre>
* <p>
*
* This code uses repaint() to fire a sDisplay call by the AWT-Event thread !
@@ -93,14 +112,6 @@ import java.lang.Math;
* </pre>
* Like the first animation run, this class renders a view frames (default 10)
* to subtract the render time from the sleep time !
- * <p>
- * You should overwrite the following methods for your needs:
- * <pre>
- <a href="GLAnimJPanel.html#init()">init - 1st initialisation</a>
- <a href="GLAnimJPanel.html#display()">display - render one frame</a>
- <a href="GLCanvas.html#reshape(int, int)">reshape - to reshape (window resize)</a>
- <a href="GLAnimJPanel.html#ReInit()">ReInit - ReInitialisation after stop for setSuspended(false)</a>
- * </pre>
*
* @see gl4java.awt.GLCanvas
* @version 2.0, 21. April 1999
@@ -231,53 +242,6 @@ public class GLAnimJPanel extends GLJPanel
setAnimateFps(FramesPerSec);
}
- /**
- * init should be overwritten by you,
- * to enter your initialisation code
- *
- */
- public void init()
- {
- /* here we should add and initialize our JAVA components */
-
- /* ... and furthet OpenGL init's - like you want to */
-
- glj.gljCheckGL();
-
- ReInit();
-
- /* and start our working thread ... */
- start();
- }
-
- /**
- *
- * This is the rendering-method called by sDisplay
- * (and sDisplay is called by paint, or by the thread directly !).
- * The derived-class (Your Subclass) will redefine this,
- * to draw it's own animation !
- *
- * <p>
- *
- * You should set shallWeRender here,
- * to signalize the animation-loop 'run' to supsend
- * <p>
- * To restart the thread, just call setSuspended(false)
- *
- * @see gl4java.swing.GLAnimJPanel#shallWeRender
- * @see gl4java.swing.GLAnimJPanel#run
- * @see gl4java.swing.GLAnimJPanel#setSuspended
- * @see gl4java.awt.GLAnimCanvas#sDisplay
- * @see gl4java.awt.GLAnimCanvas#paint
- */
- public void display()
- {
- int i;
-
- // ... just render it
-
- }
-
/**
* ReInit should be overwritten by you,
* to enter your re-initialisation within setSuspended(false)
@@ -362,16 +326,6 @@ public class GLAnimJPanel extends GLJPanel
notify();
}
- /**
- * Should be set in display,
- * whether to render or not while the animation loop
- * <p>
- * If shallWeRender is false,
- * this thread will suspend !
- *
- * @see gl4java.swing.GLAnimJPanel#display
- * @see gl4java.swing.GLAnimJPanel#run
- */
protected boolean shallWeRender = true;
private long _fDelay = 0;
@@ -383,7 +337,7 @@ public class GLAnimJPanel extends GLJPanel
* The running loop for animations
* which initiates the call of display
*
- * @see gl4java.swing.GLAnimJPanel#shallWeRender
+ * @see gl4java.swing.GLAnimJPanel#setSuspended
* @see gl4java.swing.GLAnimJPanel#display
*/
public void run()
@@ -563,13 +517,13 @@ public class GLAnimJPanel extends GLJPanel
* fot the getFps* methods
* <p>
* this function is called automatically by
- * run, if the thread is suspended via shallWeRender
+ * run, if the thread is suspended via setSuspended
* <p>
* All data's are print out on System.out
* if verboseFps is set !
*
* @see gl4java.swing.GLAnimJPanel#run
- * @see gl4java.swing.GLAnimJPanel#shallWeRender
+ * @see gl4java.swing.GLAnimJPanel#setSuspended
* @see gl4java.swing.GLAnimJPanel#resetFpsCounter
* @see gl4java.swing.GLAnimJPanel#stopFpsCounter
* @see gl4java.swing.GLAnimJPanel#getFps
@@ -605,7 +559,7 @@ public class GLAnimJPanel extends GLJPanel
* verboseFps is set to true by default !
*
* @see gl4java.swing.GLAnimJPanel#run
- * @see gl4java.swing.GLAnimJPanel#shallWeRender
+ * @see gl4java.swing.GLAnimJPanel#setSuspended
* @see gl4java.swing.GLAnimJPanel#resetFpsCounter
* @see gl4java.swing.GLAnimJPanel#stopFpsCounter
* @see gl4java.swing.GLAnimJPanel#getFps
diff --git a/gl4java/swing/GLJPanel.java b/gl4java/swing/GLJPanel.java
index 1e23110..31ee17f 100644
--- a/gl4java/swing/GLJPanel.java
+++ b/gl4java/swing/GLJPanel.java
@@ -1,866 +1,932 @@
-package gl4java.swing;
-
-import gl4java.*;
-
-import java.awt.*;
-import java.awt.image.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-/**
- * This is meant as an base class writing
- * easy render functions. A clean usage of multi-threading compatible
- * with JAVA2 is implemented in GLAnimJPanel !
- *
- * <p>
- *
- * If you are interessting in further Documentation and/or
- * the history of GL4Java follow the following link.
- *
- * <pre>
- <a href="../../GL4Java.html">The GL4Java Documentation</a>
- * </pre>
- * <p>
- *
- * You should overwrite the following methods for your needs:
- * <pre>
- <a href="GLJPanel.html#init()">preInit - initialisation before creating GLContext</a>
- <a href="GLJPanel.html#init()">init - 1st initialisation after creating GLContext</a>
- <a href="GLJPanel.html#doCleanup()">doCleanup - OGL cleanup prior to context deletion</a>
- <a href="GLJPanel.html#display()">display - render your frame</a>
- <a href="GLJPanel.html#reshape(int, int)">reshape - to reshape (window resize), gljResize() is allready invoked !</a>
- * </pre>
- *
- * To check if you can use the GLContext and GL and GLU methods,
- * use the function
- * <pre>
- <a href="GLJPanel.html#cvsIsInit()">cvsIsInit</a>
- * </pre>
- * <p>
- * IF you remove/release a GLJPanel,
- * e.g. you want to close/dispose it�s Window (which contains this GLJPanel),
- * you HAVE TO call:
- *
- * <pre>
- <a href="GLJPanel.html#cvsDispose()">cvsDispose</a>
- * </pre>
- * You should call this before releasing/dispose this Window !
- * Also you can overwrite this class,
- * to dispose your own elements, e.g. a Frame etc. -
- * but be shure that you call
- * cvsDispose implementation call this one !
- *
- * <p>
- * We do override the following Canvas methods.
- *
- * <pre>
- <a href="GLJPanel.html#update(java.awt.Graphics)">update</a>
- <a href="GLJPanel.html#paint(java.awt.Graphics)">paint</a>
- * </pre>
- * <p>
- *
- * @see gl4java.swing.GLAnimJPanel
- * @see gl4java.awt.GLCanvas
- *
- * @version 2.0, 21. April 1999
- * @author Sven Goethel
- *
- */
-public class GLJPanel extends JPanel
- implements GLEnum, GLUEnum,
- ComponentListener, WindowListener, MouseListener
-{
- protected GLContext glj = null;
- public GLFunc gl = null;
- public GLUFunc glu = null;
-
- protected boolean mustResize = false;
-
- protected boolean cvsInitialized=false;
-
- protected boolean needCvsDispose = false;
-
- /**
- * Visual pre-set for stencil-bit number, default: 0
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.swing.GLJPanel#preInit
- * @see gl4java.swing.GLJPanel#paint
- */
- protected int stencilBits = 0;
-
- /**
- * Visual pre-set for accumulator buffer size, default: 0
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.swing.GLJPanel#preInit
- * @see gl4java.swing.GLJPanel#paint
- */
- protected int accumSize = 0;
-
- /**
- * Visual pre-set for stereoView, default: false
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.swing.GLJPanel#preInit
- * @see gl4java.swing.GLJPanel#paint
- */
- protected boolean stereoView = false;
-
- /**
- * Visual pre-set for RGBA usage, default: true - of course ;-)
- * This value is updated after a GLContext is created with the
- * original updated value of GLContext !
- *
- * @see gl4java.swing.GLJPanel#preInit
- * @see gl4java.swing.GLJPanel#paint
- */
- protected boolean rgba = true;
-
- /**
- * The context with witch display lists and textures will be shared.
- *
- * @see gl4java.swing.GLJPanel#preInit
- * @see gl4java.swing.GLJPanel#paint
- */
- protected GLContext sharedGLContext;
-
- /**
- * The data to hold the offscreen pixels on the java side !
- *
- * @see gl4java.swing.GLJPanel#offImagePixels
- * @see gl4java.swing.GLJPanel#paint
- */
- protected BufferedImage offImage = null;
-
- /**
- * The data to hold the offscreen pixels on the GL side !
- *
- * @see gl4java.swing.GLJPanel#offImage
- * @see gl4java.swing.GLJPanel#paint
- */
- protected byte[] offImagePixels = null;
-
- /**
- * The custom set offscreen Size
- *
- * If this is set to != null,
- * the offscreen pixmap is used in this size,
- * not in the components-size (-> faster if smaller)
- *
- * @see gl4java.swing.GLJPanel#paint
- * @see gl4java.swing.GLJPanel#setOffScreenSize
- * @see gl4java.swing.GLJPanel#getOffScreenSize
- */
- protected Dimension offScrnSize = null;
- protected boolean customOffScrnSize=false;
- protected boolean offScrnSizeChanged=false;
-
- static {
- if(GLContext.loadNativeLibraries(null, null, null)==false)
- System.out.println("GLJPanel could not load def. native libs.");
- }
-
- /**
- *
- * Constructor
- *
- * @param gl_Name The name of the GLFunc implementation
- * If gl_Name==null, the default class will be used !
- *
- * @param glu_Name The name of the GLUFunc implementation
- * If gl_LibName==null, the default class will be used !
- *
- * @param layout the layout manager
- * @param isDoubleBuffered the flag indicates,
- * if double buffer should be used
- *
- */
- public GLJPanel( String gl_Name,
- String glu_Name,
- LayoutManager layout, boolean isDoubleBuffered
- )
- {
- super( layout, isDoubleBuffered );
-
- if( (gl=GLContext.createGLFunc(gl_Name)) ==null)
- {
- System.out.println("GLFunc implementation "+gl_Name+" not created");
- }
- if( (glu=GLContext.createGLUFunc(glu_Name)) ==null)
- {
- System.out.println("GLUFunc implementation "+glu_Name+" not created");
- }
-
- /* to be able for RESIZE event's */
- addComponentListener(this);
-
- setOpaque(false);
- }
-
- /**
- *
- * Constructor
- *
- * @param layout the layout manager
- * @param isDoubleBuffered the flag indicates,
- * if double buffer should be used
- *
- */
- public GLJPanel( LayoutManager layout, boolean isDoubleBuffered )
- {
- this(null, null, layout, isDoubleBuffered);
- }
-
- /**
- *
- * Constructor
- *
- * Uses the default GLFunc and GLUFunc implementation !
- *
- * @param isDoubleBuffered the flag indicates,
- * if double buffer should be used
- */
- public GLJPanel( boolean isDoubleBuffered )
- {
- this(null, null, new FlowLayout(), isDoubleBuffered);
- }
-
- /**
- *
- * Constructor
- *
- * Uses the default GLFunc and GLUFunc implementation !
- *
- * @param layout the layout manager
- */
- public GLJPanel(LayoutManager layout)
- {
- this(null, null, layout, true);
- }
-
- /**
- *
- * Constructor
- *
- * Uses the default GLFunc and GLUFunc implementation !
- *
- */
- public GLJPanel( )
- {
- this(null, null, new FlowLayout(), true);
- }
-
- /**
- * Used to return the created GLContext
- */
- public final GLContext getGLContext() { return glj; }
-
- /**
- * Safe the toplevel window
- */
- protected Window topLevelWindow = null;
-
- /**
- *
- * This function returns the found TopLevelWindow,
- * which contains this Canvas ..
- *
- * @return void
- *
- * @see gl4java.swing.GLJPanel#paint
- */
- public final Window getTopLevelWindow()
- { return topLevelWindow; }
-
- /**
- * The customers offscreen Size
- *
- * If this is set,
- * the offscreen pixmap is used in this size,
- * not in the components-size (-> faster if smaller)
- *
- * @see gl4java.swing.GLJPanel#offScrnSize
- * @see gl4java.swing.GLJPanel#setOffScreenSize
- */
- public Dimension getOffScreenSize()
- { return offScrnSize; }
-
- /**
- * The customers offscreen Size
- *
- * If this is set,
- * the offscreen pixmap is used in this size,
- * not in the components-size (-> faster if smaller)
- *
- * @see gl4java.swing.GLJPanel#offScrnSize
- * @see gl4java.swing.GLJPanel#getOffScreenSize
- */
- public void setOffScreenSize(Dimension size)
- {
- if((size!=null && size.equals(offScrnSize)==false) ||
- size!=offScrnSize
- )
- {
- offScrnSizeChanged=true;
- offScrnSize=size;
- customOffScrnSize=offScrnSize!=null;
- }
- }
-
- /**
- * this function overrides the Canvas paint method !
- *
- * For the first paint,
- * the user function preInit is called, a GLContext is created
- * and the user function init is called !
- *
- * Also, if a GL Context exist, GLJPanel's sDisplay-method will be called
- * to do OpenGL-rendering.
- *
- * The sDisplay method itself calls the display-method !
- * sDisplay is needed to be thread-safe, to manage
- * the resize functionality and to safe the time per frame.
- *
- * To define your rendering, you should overwrite the display-method
- * in your derivation.
- *
- * @see gl4java.GLContext#GLContext
- * @see gl4java.swing.GLJPanel#cvsIsInit
- * @see gl4java.swing.GLJPanel#sDisplay
- * @see gl4java.swing.GLJPanel#display
- * @see gl4java.swing.GLJPanel#preInit
- * @see gl4java.swing.GLJPanel#init
- */
- public synchronized final void paintComponent(Graphics g)
- {
- if(glj == null ||
- (mustResize && !customOffScrnSize) || offScrnSizeChanged )
- {
- if(mustResize)
- {
- cvsDispose();
- mustResize=false;
- }
- preInit();
- glj = GLContext.createOffScreenCtx ( this, gl, glu,
- stereoView,
- rgba, stencilBits, accumSize,
- sharedGLContext,
- offScrnSize
- );
-
- if(glj!=null)
- {
- /*
- createOwnWindow = glj.isOwnWindowCreated();
- doubleBuffer = glj.isDoubleBuffer();
- */
- stencilBits = glj.getStencilBitNumber();
- accumSize = glj.getAccumSize();
- stereoView = glj.isStereoView();
- rgba = glj.isRGBA();
- }
- if(offImage!=null)
- offImage.flush();
- offImage=null;
- offScrnSizeChanged=false;
-
- init();
-
- // fetch the top-level window ,
- // to add us as the windowListener
- //
- Container _c = getParent();
- Container c = null;
-
- while(_c!=null)
- {
- c = _c;
- _c = _c.getParent();
- }
-
- if(c instanceof Window) {
- topLevelWindow = (Window)c;
- topLevelWindow.addComponentListener(this);
- topLevelWindow.addMouseListener(this);
- } else {
- topLevelWindow = null;
- System.out.println("toplevel is not a Window: "+c);
- }
-
- if(topLevelWindow!=null)
- {
- topLevelWindow.addWindowListener(this);
- } else {
- System.out.println("no parent found for "+getName());
- System.out.flush();
- }
- if(glj!=null && glj.gljIsInit())
- cvsInitialized=true;
- }
- /*
- if( mustResize ) size = getSize();
- g.setClip(0, 0, size.width, size.height );
- */
- //super.paintComponent(g);
-
- gr = g;
- sDisplay();
- }
-
- Graphics gr = null;
- DataBufferInt dbInt = null;
-
- /**
- *
- * This is the thread save rendering-method called by paint.
- * The actual thread will be set to highes priority befor calling
- * 'display'. After 'display' the priority will be reset !
- *
- * 'gljFree' will be NOT called after 'display'.
- *
- * We tested the above to use multi-threading and
- * for the demonstration 'glDemos' it works ;-)) !
- *
- * BE SURE, if you want to call 'display' by yourself
- * (e.g. in the run method for animation)
- * YOU HAVE TO CALL sDisplay -- OR YOU MUST KNOW WHAT YOU ARE DOING THEN !
- *
- * @return void
- *
- * @see gl4java.swing.GLJPanel#paint
- * @see gl4java.swing.GLJPanel#display
- */
- public synchronized final void sDisplay()
- {
- boolean ok = true;
-
- long _s = System.currentTimeMillis();
-
- if(!cvsIsInit())
- return;
-
- if( glj.gljMakeCurrent() == false ) {
- System.out.println("GLJPanel: problem in use() method");
- return;
- }
-
- if(ok)
- {
- display();
- _f_dur_self = System.currentTimeMillis()-_s;
- if(GLContext.gljClassDebug)
- {
- _f_dur_self_sum+=_f_dur_self;
- glj.gljCheckGL();
- }
-
- int glFormat;
- int glComps;
- int awtFormat;
-
- glFormat = (rgba == true)?GL_RGBA:GL_RGB;
- glComps = (rgba == true)?4:3;
- awtFormat = (rgba == true)?BufferedImage.TYPE_INT_ARGB:
- BufferedImage.TYPE_INT_RGB;
-
- Dimension size = null;
- if(customOffScrnSize)
- size=offScrnSize;
- else
- size=getSize();
- int w=size.width;
- int h=size.height;
-
- long _s_tst = System.currentTimeMillis();
-
- if(offImage==null ||
- offImage.getHeight()!=h || offImage.getWidth()!=w)
- {
- if(offImage!=null)
- offImage.flush();
- offImage = new BufferedImage(w,h,awtFormat);
- offImagePixels=new byte[w*h*glComps];
- dbInt = (DataBufferInt)
- offImage.getRaster().getDataBuffer();
-
- if(GLContext.gljClassDebug)
- {
- System.out.print("set offImage to size: "+size+
- "(hw size: "+w+"x"+h+"), type: ");
- switch(glFormat) {
- case GL_RGB: System.out.println("RGB"); break;
- case GL_RGBA: System.out.println("RGBA"); break;
- case GL_BGR_EXT: System.out.println("BGR"); break;
- case GL_BGRA_EXT: System.out.println("BGRA"); break;
- }
- }
- }
-
- glj.gljReadPixelGL2AWT(0,0,w,h,glFormat,GL_UNSIGNED_BYTE,
- glj.isDoubleBuffer()?GL_BACK:GL_FRONT,
- offImagePixels, dbInt.getData());
-
- //glj.gljSwap(); // no true swapping with offscreen buffers ..
-
- if(GLContext.gljClassDebug)
- _f_dur_tst_sum+=System.currentTimeMillis()-_s_tst;
-
- if(GLContext.gljClassDebug)
- glj.gljCheckGL();
- glj.gljFree(); // enable ctx for threads ...
-
- if(!customOffScrnSize)
- gr.drawImage(offImage, 0, 0, this);
- else {
- size=super.getSize();
- gr.drawImage(offImage, 0, 0, size.width, size.height, this);
- }
-
- _f_dur_total = System.currentTimeMillis()-_s;
- if(GLContext.gljClassDebug)
- {
- _f_dur_total_sum+=_f_dur_total;
- if(++_f_dur_times==100)
- {
- System.out.println("self p 100: "+
- (double)(_f_dur_self_sum/100)/1000.0+" s");
-
- System.out.println("tst p 100: "+
- (double)(_f_dur_tst_sum/100)/1000.0+" s");
-
- System.out.println("gl-bitblit p 100: "+
- (double)((_f_dur_total_sum-_f_dur_self_sum)/100)/1000.0+" s");
- System.out.println("total p 100: "+
- (double)(_f_dur_total_sum/100)/1000.0+" s");
-
- _f_dur_self_sum=0;
- _f_dur_tst_sum=0;
- _f_dur_total_sum=0;
- _f_dur_times=0;
- }
- }
-
- }
-
- }
-
- /**
- *
- * This is the rendering-method called by sDisplay
- * (and sDisplay is called by paint !).
- * The derived-class (Your Subclass) will redefine this, to draw it's own...
- *
- * BE SURE, if you want to call 'display' by yourself
- * (e.g. in the run method for animation)
- * YOU HAVE TO CALL sDisplay !
- *
- * 'sDisplay' manages a semaphore to avoid reentrance of
- * the display function !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- *
- * @return void
- *
- * @see gl4java.swing.GLJPanel#sDisplay
- * @see gl4java.swing.GLJPanel#paint
- */
- public void display()
- {
- }
-
- /**
- *
- * This is your pre-init method.
- * preInit is called just BEFORE the GL-Context is created.
- * You should override preInit, to initialize your visual-stuff,
- * like the protected vars: doubleBuffer and stereoView
- *
- * @return void
- *
- * @see gl4java.swing.GLJPanel#paint
- * @see gl4java.swing.GLJPanel#stereoView
- * @see gl4java.swing.GLJPanel#rgba
- * @see gl4java.swing.GLJPanel#stencilBits
- * @see gl4java.swing.GLJPanel#accumSize
- */
- public void preInit()
- {
- }
-
- /**
- *
- * This is your init method.
- * init is called right after the GL-Context is initialized.
- * You should override init, to initialize your stuff needed
- * by OpenGL an Java !
- *
- * @return void
- *
- * @see gl4java.swing.GLJPanel#paint
- */
- public void init()
- {
- }
-
- /**
- * This method is used to clean up any OpenGL stuff (delete textures
- * or whatever) prior to actually deleting the OpenGL context.
- * You should override this with your own version, if you need to do
- * any cleanup work at this phase.
- * This functions is called within cvsDispose
- *
- * @return void
- *
- * @see gl4java.swing.GLJPanel#cvsDispose
- */
- public void doCleanup()
- {
- }
-
- /**
- * This function returns, if everything is init: the GLContext,
- * the and the users init function
- * This value is set in the paint method!
- *
- * @return boolean
- *
- * @see gl4java.swing.GLJPanel#paint
- * @see gl4java.swing.GLJPanel#init
- */
- public boolean cvsIsInit()
- {
- return cvsInitialized;
- }
-
- protected long _f_dur_self = 0;
- protected long _f_dur_self_sum = 0;
- protected long _f_dur_tst_sum = 0;
- protected long _f_dur_total = 0;
- protected long _f_dur_total_sum = 0;
- protected int _f_dur_times = 0;
-
- /**
- *
- * This is the reshape-method called by paint.
- * The derived-class (Your Subclass) will redefine this,
- * to manage your individual reshape ...
- *
- * This �reshape� method will be invoked after the first paint command
- * after GLJPanel.componentResize is called AND only if �gljUse� was
- * succesfull (so a call of gljUse is redundant).
- * �reshape� is not an overloading of java.awt.Component.reshape,
- * �reshape� is more like �glut�-reshape.
- *
- * GLJPanel.reshape allready has a simple default implementation,
- * which calls �gljResize� and �glViewport� - so you may be can
- * left this one as it is (no need to overload).
- * The needed call to �gljResize� is done by hte invoker paint !
- *
- * @param width the new width
- * @param height the new height
- * @return void
- *
- * @see gl4java.swing.GLJPanel#paint
- * @see gl4java.swing.GLJPanel#sDisplay
- */
- public void reshape( int width, int height )
- {
- if(GLContext.gljClassDebug)
- System.out.println("GLJPanel::reshape bounds("+getBounds()+")");
- gl.glViewport(0,0, width, height);
- }
-
- /**
- *
- * �componentResized� is the componentListeners event handler.
- *
- * This method sets the variable �mustResize� to true,
- * so the upcoming �paint� method-call will invoke �reshape� !
- *
- * This little look-alike complicating thing is done,
- * to avoid an Exception by using the glContext from more than
- * one concurrent thread�s !
- *
- * You cannot override this implementation, it is final
- * - override �reshape' instead !
- *
- * @param e the element, which is resized
- * @return void
- *
- * @see gl4java.swing.GLJPanel#paint
- * @see gl4java.swing.GLJPanel#reshape
- */
- public void componentResized(ComponentEvent e)
- {
- if(GLContext.gljClassDebug)
- System.out.println("GLJPanel::componentResized("+e.getComponent()+")");
- if(glj!=null && glj.gljIsInit() && e.getComponent()==this )
- {
- mustResize = true;
- //repaint();
- }
- }
-
- public void componentMoved(ComponentEvent e)
- {
- /*
- if(GLContext.gljClassDebug)
- System.out.print("GLJPanel::componentMoved("+e.getComponent()+")");
- if(e.getComponent().equals(topLevelWindow))
- {
- repaint();
- }
- */
- }
-
- public void componentShown(ComponentEvent e)
- {
- }
-
- public void componentHidden(ComponentEvent e)
- {
- }
-
- public void mouseClicked(MouseEvent e)
- {
- }
- public void mouseEntered(MouseEvent e)
- {
- /*
- if(GLContext.gljClassDebug)
- System.out.print("GLJPanel::mouseEntered("+e.getComponent()+")");
- if(e.getComponent().equals(topLevelWindow))
- {
- repaint();
- }
- */
- }
- public void mouseExited(MouseEvent e)
- {}
- public void mousePressed(MouseEvent e)
- {
- }
- public void mouseReleased(MouseEvent e)
- {
- }
-
- public void windowOpened(WindowEvent e)
- {
- }
-
- /**
- *
- * �windowClosing� is the windowListeners event handler
- * for the topLevelWindow of this Canvas !
- *
- * This methods free�s AND destroy�s
- * the GL Context with �glj.gljDestroy� !
- *
- * @return void
- *
- */
- public void windowClosing(WindowEvent e)
- {
- if(e.getComponent().equals(topLevelWindow))
- {
- cvsDispose();
- }
- }
-
- /**
- *
- * �windowClosed� is the windowListeners event handler.
- *
- * @return void
- *
- */
- public void windowClosed(WindowEvent e)
- {
- if (needCvsDispose) cvsDispose();
- }
-
- public void windowIconified(WindowEvent e)
- {
- }
-
- public void windowDeiconified(WindowEvent e)
- {
- }
-
- public void windowActivated(WindowEvent e)
- {
- }
-
- public void windowDeactivated(WindowEvent e)
- {
- }
-
- /**
- * You should call this before releasing/dispose this Window !
- * Also you can overwrite this class,
- * to dispose your own elements, e.g. a Frame etc. -
- * but be shure that you call
- * cvsDispose implementation call this one !
- *
- * This function calls gljDestroy of GLContext !
- *
- * @see gl4java.GLContext#gljDestroy
- * @see gl4java.swing.GLJPanel#doCleanup
- */
- public void cvsDispose()
- {
- cvsInitialized = false;
- if (glj != null)
- {
- if (glj.gljIsInit())
- {
- /* Sometimes the Microsoft VM calls the
- Applet.stop() method but doesn't have
- permissions to do J/Direct calls, so
- this whole block of code will throw a
- security exception. If this happens,
- however, windowClosing() will still
- call us again later and we will have
- another opportunity to shut down the
- context, so it all works out fine. */
- try
- {
- glj.gljFree();
- doCleanup();
- //locks and free's GLContext
- glj.setEnabled(false);
- glj.gljDestroy();
- needCvsDispose = false;
- }
- catch (Exception ex)
- {
- needCvsDispose = true;
- }
- }
- }
-
- // Setting glj to null will simply cause paint() to re-initialize.
- // We don't want that to happen, so we will leave glj non-null.
- }
-
- public Dimension getSize()
- {
- if(customOffScrnSize)
- return offScrnSize;
- return super.getSize();
- }
-
- /**
- * get methods
- */
- public final int cvsGetWidth() {
- return getSize().width;
- }
- public final int cvsGetHeight() {
- return getSize().height;
- }
-}
-
+package gl4java.swing;
+
+import gl4java.*;
+import gl4java.drawable.*;
+import gl4java.drawable.utils.*;
+
+import java.awt.*;
+import java.awt.image.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * This is meant as an base class writing
+ * easy render functions. A clean usage of multi-threading compatible
+ * with JAVA2 is implemented in GLAnimJPanel !
+ *
+ * <p>
+ *
+ * If you are interessting in further Documentation and/or
+ * the history of GL4Java follow the following link.
+ *
+ * <pre>
+ <a href="../../GL4Java.html">The GL4Java Documentation</a>
+ * </pre>
+ * <p>
+ *
+ * There are two ways of using a GLJPanel: the {@link
+ * gl4java.GLEventListener} model or the subclassing model. Earlier
+ * versions of the system only supported the subclassing model. The
+ * default implementations of {@link #init}, {@link #display},
+ * {@link #reshape} and {@link #doCleanup}
+ * now send events to GLEventListeners; they can
+ * still be overridden as before to support the subclassing model.
+ *
+ * <p>
+ * If using the subclassing model, you should override the following
+ * methods for your needs:
+ * <pre>
+ <a href="GLJPanel.html#init()">preInit - initialisation before creating GLContext</a>
+ <a href="GLJPanel.html#init()">init - 1st initialisation after creating GLContext</a>
+ <a href="GLJPanel.html#doCleanup()">doCleanup - OGL cleanup prior to context deletion</a>
+ <a href="GLJPanel.html#display()">display - render your frame</a>
+ <a href="GLJPanel.html#reshape(int, int)">reshape - to reshape (window resize), gljResize() is allready invoked !</a>
+ * </pre>
+ *
+ * To check if you can use the GLContext and GL and GLU methods,
+ * use the function
+ * <pre>
+ <a href="GLJPanel.html#cvsIsInit()">cvsIsInit</a>
+ * </pre>
+ * <p>
+ * IF you remove/release a GLJPanel,
+ * e.g. you want to close/dispose it�s Window (which contains this GLJPanel),
+ * you HAVE TO call:
+ *
+ * <pre>
+ <a href="GLJPanel.html#cvsDispose()">cvsDispose</a>
+ * </pre>
+ * You should call this before releasing/dispose this Window !
+ * Also you can overwrite this class,
+ * to dispose your own elements, e.g. a Frame etc. -
+ * but be shure that you call
+ * cvsDispose implementation call this one !
+ *
+ * <p>
+ * We do override the following Canvas methods.
+ *
+ * <pre>
+ <a href="GLJPanel.html#update(java.awt.Graphics)">update</a>
+ <a href="GLJPanel.html#paint(java.awt.Graphics)">paint</a>
+ * </pre>
+ * <p>
+ *
+ * @see gl4java.swing.GLAnimJPanel
+ * @see gl4java.awt.GLCanvas
+ *
+ * @version 2.0, 21. April 1999
+ * @author Sven Goethel
+ * */
+public class GLJPanel extends JPanel
+ implements GLEnum, GLUEnum,
+ ComponentListener, WindowListener, MouseListener,
+ GLDrawable
+{
+ protected GLContext glj = null;
+ public GLFunc gl = null;
+ public GLUFunc glu = null;
+
+ protected boolean mustResize = false;
+
+ protected boolean cvsInitialized=false;
+
+ protected boolean needCvsDispose = false;
+
+ /**
+ * Visual pre-set for stencil-bit number, default: 0
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.swing.GLJPanel#preInit
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected int stencilBits = 0;
+
+ /**
+ * Visual pre-set for accumulator buffer size, default: 0
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.swing.GLJPanel#preInit
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected int accumSize = 0;
+
+ /**
+ * Visual pre-set for stereoView, default: false
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.swing.GLJPanel#preInit
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected boolean stereoView = false;
+
+ /**
+ * Visual pre-set for RGBA usage, default: true - of course ;-)
+ * This value is updated after a GLContext is created with the
+ * original updated value of GLContext !
+ *
+ * @see gl4java.swing.GLJPanel#preInit
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected boolean rgba = true;
+
+ /**
+ * The context with witch display lists and textures will be shared.
+ *
+ * @see gl4java.swing.GLJPanel#preInit
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected GLContext sharedGLContext;
+
+ /**
+ * The data to hold the offscreen pixels on the java side !
+ *
+ * @see gl4java.swing.GLJPanel#offImagePixels
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected BufferedImage offImage = null;
+
+ /**
+ * The data to hold the offscreen pixels on the GL side !
+ *
+ * @see gl4java.swing.GLJPanel#offImage
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ protected byte[] offImagePixels = null;
+
+ /**
+ * The custom set offscreen Size
+ *
+ * If this is set to != null,
+ * the offscreen pixmap is used in this size,
+ * not in the components-size (-> faster if smaller)
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.swing.GLJPanel#setOffScreenSize
+ * @see gl4java.swing.GLJPanel#getOffScreenSize
+ */
+ protected Dimension offScrnSize = null;
+ protected boolean customOffScrnSize=false;
+ protected boolean offScrnSizeChanged=false;
+
+ // The list of GLEventListeners
+ private GLEventListenerList listeners = new GLEventListenerList();
+
+ static {
+ if(GLContext.loadNativeLibraries(null, null, null)==false)
+ System.out.println("GLJPanel could not load def. native libs.");
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @param gl_Name The name of the GLFunc implementation
+ * If gl_Name==null, the default class will be used !
+ *
+ * @param glu_Name The name of the GLUFunc implementation
+ * If gl_LibName==null, the default class will be used !
+ *
+ * @param layout the layout manager
+ * @param isDoubleBuffered the flag indicates,
+ * if double buffer should be used
+ *
+ */
+ public GLJPanel( String gl_Name,
+ String glu_Name,
+ LayoutManager layout, boolean isDoubleBuffered
+ )
+ {
+ super( layout, isDoubleBuffered );
+
+ if( (gl=GLContext.createGLFunc(gl_Name)) ==null)
+ {
+ System.out.println("GLFunc implementation "+gl_Name+" not created");
+ }
+ if( (glu=GLContext.createGLUFunc(glu_Name)) ==null)
+ {
+ System.out.println("GLUFunc implementation "+glu_Name+" not created");
+ }
+
+ /* to be able for RESIZE event's */
+ addComponentListener(this);
+
+ setOpaque(false);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * @param layout the layout manager
+ * @param isDoubleBuffered the flag indicates,
+ * if double buffer should be used
+ *
+ */
+ public GLJPanel( LayoutManager layout, boolean isDoubleBuffered )
+ {
+ this(null, null, layout, isDoubleBuffered);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @param isDoubleBuffered the flag indicates,
+ * if double buffer should be used
+ */
+ public GLJPanel( boolean isDoubleBuffered )
+ {
+ this(null, null, new FlowLayout(), isDoubleBuffered);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ * @param layout the layout manager
+ */
+ public GLJPanel(LayoutManager layout)
+ {
+ this(null, null, layout, true);
+ }
+
+ /**
+ *
+ * Constructor
+ *
+ * Uses the default GLFunc and GLUFunc implementation !
+ *
+ */
+ public GLJPanel( )
+ {
+ this(null, null, new FlowLayout(), true);
+ }
+
+ /**
+ * Used to return the created GLContext
+ */
+ public final GLContext getGLContext() { return glj; }
+
+ /**
+ * Safe the toplevel window
+ */
+ protected Window topLevelWindow = null;
+
+ /**
+ *
+ * This function returns the found TopLevelWindow,
+ * which contains this Canvas ..
+ *
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ */
+ public final Window getTopLevelWindow()
+ { return topLevelWindow; }
+
+ /**
+ * The customers offscreen Size
+ *
+ * If this is set,
+ * the offscreen pixmap is used in this size,
+ * not in the components-size (-> faster if smaller)
+ *
+ * @see gl4java.swing.GLJPanel#offScrnSize
+ * @see gl4java.swing.GLJPanel#setOffScreenSize
+ */
+ public Dimension getOffScreenSize()
+ { return offScrnSize; }
+
+ /**
+ * The customers offscreen Size
+ *
+ * If this is set,
+ * the offscreen pixmap is used in this size,
+ * not in the components-size (-> faster if smaller)
+ *
+ * @see gl4java.swing.GLJPanel#offScrnSize
+ * @see gl4java.swing.GLJPanel#getOffScreenSize
+ */
+ public void setOffScreenSize(Dimension size)
+ {
+ if((size!=null && size.equals(offScrnSize)==false) ||
+ size!=offScrnSize
+ )
+ {
+ offScrnSizeChanged=true;
+ offScrnSize=size;
+ customOffScrnSize=offScrnSize!=null;
+ }
+ }
+
+ /**
+ * this function overrides the Canvas paint method !
+ *
+ * For the first paint,
+ * the user function preInit is called, a GLContext is created
+ * and the user function init is called !
+ *
+ * Also, if a GL Context exist, GLJPanel's sDisplay-method will be called
+ * to do OpenGL-rendering.
+ *
+ * The sDisplay method itself calls the display-method !
+ * sDisplay is needed to be thread-safe, to manage
+ * the resize functionality and to safe the time per frame.
+ *
+ * To define your rendering, you should overwrite the display-method
+ * in your derivation.
+ *
+ * @see gl4java.GLContext#GLContext
+ * @see gl4java.swing.GLJPanel#cvsIsInit
+ * @see gl4java.swing.GLJPanel#sDisplay
+ * @see gl4java.swing.GLJPanel#display
+ * @see gl4java.swing.GLJPanel#preInit
+ * @see gl4java.swing.GLJPanel#init
+ */
+ public synchronized final void paintComponent(Graphics g)
+ {
+ if(glj == null ||
+ (mustResize && !customOffScrnSize) || offScrnSizeChanged )
+ {
+ if(mustResize)
+ {
+ cvsDispose();
+ mustResize=false;
+ }
+ preInit();
+ glj = GLContext.createOffScreenCtx ( this, gl, glu,
+ stereoView,
+ rgba, stencilBits, accumSize,
+ sharedGLContext,
+ offScrnSize
+ );
+
+ if(glj!=null)
+ {
+ /*
+ createOwnWindow = glj.isOwnWindowCreated();
+ doubleBuffer = glj.isDoubleBuffer();
+ */
+ stencilBits = glj.getStencilBitNumber();
+ accumSize = glj.getAccumSize();
+ stereoView = glj.isStereoView();
+ rgba = glj.isRGBA();
+ }
+ if(offImage!=null)
+ offImage.flush();
+ offImage=null;
+ offScrnSizeChanged=false;
+
+ init();
+
+ // fetch the top-level window ,
+ // to add us as the windowListener
+ //
+ Container _c = getParent();
+ Container c = null;
+
+ while(_c!=null)
+ {
+ c = _c;
+ _c = _c.getParent();
+ }
+
+ if(c instanceof Window) {
+ topLevelWindow = (Window)c;
+ topLevelWindow.addComponentListener(this);
+ topLevelWindow.addMouseListener(this);
+ } else {
+ topLevelWindow = null;
+ System.out.println("toplevel is not a Window: "+c);
+ }
+
+ if(topLevelWindow!=null)
+ {
+ topLevelWindow.addWindowListener(this);
+ } else {
+ System.out.println("no parent found for "+getName());
+ System.out.flush();
+ }
+ if(glj!=null && glj.gljIsInit())
+ cvsInitialized=true;
+ }
+ /*
+ if( mustResize ) size = getSize();
+ g.setClip(0, 0, size.width, size.height );
+ */
+ //super.paintComponent(g);
+
+ gr = g;
+ sDisplay();
+ }
+
+ Graphics gr = null;
+ DataBufferInt dbInt = null;
+
+ /**
+ *
+ * This is the thread save rendering-method called by paint.
+ * The actual thread will be set to highes priority befor calling
+ * 'display'. After 'display' the priority will be reset !
+ *
+ * 'gljFree' will be NOT called after 'display'.
+ *
+ * We tested the above to use multi-threading and
+ * for the demonstration 'glDemos' it works ;-)) !
+ *
+ * BE SURE, if you want to call 'display' by yourself
+ * (e.g. in the run method for animation)
+ * YOU HAVE TO CALL sDisplay -- OR YOU MUST KNOW WHAT YOU ARE DOING THEN !
+ *
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.swing.GLJPanel#display
+ * @see gl4java.drawable.GLEventListener#preDisplay
+ * @see gl4java.drawable.GLEventListener#display
+ * @see gl4java.drawable.GLEventListener#postDisplay
+ */
+ public synchronized final void sDisplay()
+ {
+ boolean ok = true;
+
+ long _s = System.currentTimeMillis();
+
+ if(!cvsIsInit())
+ return;
+
+ listeners.sendPreDisplayEvent(this);
+
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("GLJPanel: problem in use() method");
+ return;
+ }
+
+ if(ok)
+ {
+ display();
+ _f_dur_self = System.currentTimeMillis()-_s;
+ if(GLContext.gljClassDebug)
+ {
+ _f_dur_self_sum+=_f_dur_self;
+ glj.gljCheckGL();
+ }
+
+ int glFormat;
+ int glComps;
+ int awtFormat;
+
+ glFormat = (rgba == true)?GL_RGBA:GL_RGB;
+ glComps = (rgba == true)?4:3;
+ awtFormat = (rgba == true)?BufferedImage.TYPE_INT_ARGB:
+ BufferedImage.TYPE_INT_RGB;
+
+ Dimension size = null;
+ if(customOffScrnSize)
+ size=offScrnSize;
+ else
+ size=getSize();
+ int w=size.width;
+ int h=size.height;
+
+ long _s_tst = System.currentTimeMillis();
+
+ if(offImage==null ||
+ offImage.getHeight()!=h || offImage.getWidth()!=w)
+ {
+ if(offImage!=null)
+ offImage.flush();
+ offImage = new BufferedImage(w,h,awtFormat);
+ offImagePixels=new byte[w*h*glComps];
+ dbInt = (DataBufferInt)
+ offImage.getRaster().getDataBuffer();
+
+ if(GLContext.gljClassDebug)
+ {
+ System.out.print("set offImage to size: "+size+
+ "(hw size: "+w+"x"+h+"), type: ");
+ switch(glFormat) {
+ case GL_RGB: System.out.println("RGB"); break;
+ case GL_RGBA: System.out.println("RGBA"); break;
+ case GL_BGR_EXT: System.out.println("BGR"); break;
+ case GL_BGRA_EXT: System.out.println("BGRA"); break;
+ }
+ }
+ }
+
+ glj.gljReadPixelGL2AWT(0,0,w,h,glFormat,GL_UNSIGNED_BYTE,
+ glj.isDoubleBuffer()?GL_BACK:GL_FRONT,
+ offImagePixels, dbInt.getData());
+
+ //glj.gljSwap(); // no true swapping with offscreen buffers ..
+
+ if(GLContext.gljClassDebug)
+ _f_dur_tst_sum+=System.currentTimeMillis()-_s_tst;
+
+ if(GLContext.gljClassDebug)
+ glj.gljCheckGL();
+ glj.gljFree(); // enable ctx for threads ...
+
+ if(!customOffScrnSize)
+ gr.drawImage(offImage, 0, 0, this);
+ else {
+ size=super.getSize();
+ gr.drawImage(offImage, 0, 0, size.width, size.height, this);
+ }
+
+ _f_dur_total = System.currentTimeMillis()-_s;
+ if(GLContext.gljClassDebug)
+ {
+ _f_dur_total_sum+=_f_dur_total;
+ if(++_f_dur_times==100)
+ {
+ System.out.println("self p 100: "+
+ (double)(_f_dur_self_sum/100)/1000.0+" s");
+
+ System.out.println("tst p 100: "+
+ (double)(_f_dur_tst_sum/100)/1000.0+" s");
+
+ System.out.println("gl-bitblit p 100: "+
+ (double)((_f_dur_total_sum-_f_dur_self_sum)/100)/1000.0+" s");
+ System.out.println("total p 100: "+
+ (double)(_f_dur_total_sum/100)/1000.0+" s");
+
+ _f_dur_self_sum=0;
+ _f_dur_tst_sum=0;
+ _f_dur_total_sum=0;
+ _f_dur_times=0;
+ }
+ }
+ }
+
+ listeners.sendPostDisplayEvent(this);
+
+ }
+
+ /**
+ *
+ * This is the rendering-method called by sDisplay
+ * (and sDisplay is called by paint !).
+ *
+ * <p>
+ * The default implementation of display() sends display events to
+ * all {@link gl4java.GLEventListener}s associated with this
+ * GLJPanel, and automatically calls {@link
+ * gl4java.GLContext#gljMakeCurrent} and {@link
+ * gl4java.GLContext#gljFree} as necessary.
+ *
+ * <p>}
+ * If you use the subclassing model (as opposed to the
+ * GLEventListener model), your subclass will redefine this to
+ * perform its OpenGL drawing.
+ *
+ * <p>
+ * BE SURE, if you want to call 'display' by yourself
+ * (e.g. in the run method for animation)
+ * YOU HAVE TO CALL sDisplay !
+ *
+ * 'sDisplay' manages a semaphore to avoid reentrance of
+ * the display function !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ *
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#sDisplay
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.drawable.GLEventListener#display
+ */
+ public void display()
+ {
+ listeners.sendDisplayEvent(this);
+ }
+
+ /**
+ *
+ * This is your pre-init method.
+ * preInit is called just BEFORE the GL-Context is created.
+ * You should override preInit, to initialize your visual-stuff,
+ * like the protected vars: doubleBuffer and stereoView
+ *
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.swing.GLJPanel#stereoView
+ * @see gl4java.swing.GLJPanel#rgba
+ * @see gl4java.swing.GLJPanel#stencilBits
+ * @see gl4java.swing.GLJPanel#accumSize
+ */
+ public void preInit()
+ {
+ }
+
+ /**
+ *
+ * init is called right after the GL-Context is initialized.
+ * The default implementation calls init() on all of this
+ * component's GLEventListeners.
+ *
+ * <p>
+ * If using the subclassing model, you can override this to
+ * perform one-time OpenGL initializations such as setting up
+ * lights and display lists.
+ *
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.drawable.GLEventListener#init
+ */
+ public void init()
+ {
+ listeners.sendInitEvent(this);
+ }
+
+ /**
+ * This method is used to clean up any OpenGL stuff (delete textures
+ * or whatever) prior to actually deleting the OpenGL context.
+ * You should override this with your own version, if you need to do
+ * any cleanup work at this phase.
+ * This functions is called within cvsDispose
+ *
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#cvsDispose
+ * @see gl4java.drawable.GLEventListener#cleanup
+ */
+ public void doCleanup()
+ {
+ listeners.sendCleanupEvent(this);
+ }
+
+ /**
+ * This function returns, if everything is init: the GLContext,
+ * the and the users init function
+ * This value is set in the paint method!
+ *
+ * @return boolean
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.swing.GLJPanel#init
+ */
+ public boolean cvsIsInit()
+ {
+ return cvsInitialized;
+ }
+
+ protected long _f_dur_self = 0;
+ protected long _f_dur_self_sum = 0;
+ protected long _f_dur_tst_sum = 0;
+ protected long _f_dur_total = 0;
+ protected long _f_dur_total_sum = 0;
+ protected int _f_dur_times = 0;
+
+ /**
+ *
+ * This �reshape� method will be invoked after the first paint command
+ * after GLCanvas.componentResize is called AND only if �gljMakeCurrent� was
+ * successful (so a call of gljMakeCurrent is redundant).
+ * �reshape� is not an overloading of java.awt.Component.reshape,
+ * �reshape� is more like �glut�-reshape.
+ *
+ * <p>
+ * GLCanvas.reshape already has a simple default implementation,
+ * which calls �gljResize� and �glViewport�. It also sends the
+ * reshape() event to all GLEventListeners. If using the
+ * GLEventListener model, it may not be necessary to do anything
+ * in your event listener's reshape() method; if using the
+ * subclassing model, it may not be necessary to override this.
+ *
+ * <p>
+ * The needed call to �gljResize� is done by the invoker paint !
+ *
+ * @param width the new width
+ * @param height the new height
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.swing.GLJPanel#sDisplay
+ * @see gl4java.drawable.GLEventListener#reshape
+ */
+ public void reshape( int width, int height )
+ {
+ if(GLContext.gljClassDebug)
+ System.out.println("GLJPanel::reshape bounds("+getBounds()+")");
+ gl.glViewport(0,0, width, height);
+ listeners.sendReshapeEvent(this, width, height);
+ }
+
+ /**
+ *
+ * �componentResized� is the componentListeners event handler.
+ *
+ * This method sets the variable �mustResize� to true,
+ * so the upcoming �paint� method-call will invoke �reshape� !
+ *
+ * This little look-alike complicating thing is done,
+ * to avoid an Exception by using the glContext from more than
+ * one concurrent thread�s !
+ *
+ * You cannot override this implementation, it is final
+ * - override �reshape' instead !
+ *
+ * @param e the element, which is resized
+ * @return void
+ *
+ * @see gl4java.swing.GLJPanel#paint
+ * @see gl4java.swing.GLJPanel#reshape
+ */
+ public void componentResized(ComponentEvent e)
+ {
+ if(GLContext.gljClassDebug)
+ System.out.println("GLJPanel::componentResized("+e.getComponent()+")");
+ if(glj!=null && glj.gljIsInit() && e.getComponent()==this )
+ {
+ mustResize = true;
+ //repaint();
+ }
+ }
+
+ public void componentMoved(ComponentEvent e)
+ {
+ /*
+ if(GLContext.gljClassDebug)
+ System.out.print("GLJPanel::componentMoved("+e.getComponent()+")");
+ if(e.getComponent().equals(topLevelWindow))
+ {
+ repaint();
+ }
+ */
+ }
+
+ public void componentShown(ComponentEvent e)
+ {
+ }
+
+ public void componentHidden(ComponentEvent e)
+ {
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ }
+ public void mouseEntered(MouseEvent e)
+ {
+ /*
+ if(GLContext.gljClassDebug)
+ System.out.print("GLJPanel::mouseEntered("+e.getComponent()+")");
+ if(e.getComponent().equals(topLevelWindow))
+ {
+ repaint();
+ }
+ */
+ }
+ public void mouseExited(MouseEvent e)
+ {}
+ public void mousePressed(MouseEvent e)
+ {
+ }
+ public void mouseReleased(MouseEvent e)
+ {
+ }
+
+ public void windowOpened(WindowEvent e)
+ {
+ }
+
+ /**
+ *
+ * �windowClosing� is the windowListeners event handler
+ * for the topLevelWindow of this Canvas !
+ *
+ * This methods free�s AND destroy�s
+ * the GL Context with �glj.gljDestroy� !
+ *
+ * @return void
+ *
+ */
+ public void windowClosing(WindowEvent e)
+ {
+ if(e.getComponent().equals(topLevelWindow))
+ {
+ cvsDispose();
+ }
+ }
+
+ /**
+ *
+ * �windowClosed� is the windowListeners event handler.
+ *
+ * @return void
+ *
+ */
+ public void windowClosed(WindowEvent e)
+ {
+ if (needCvsDispose) cvsDispose();
+ }
+
+ public void windowIconified(WindowEvent e)
+ {
+ }
+
+ public void windowDeiconified(WindowEvent e)
+ {
+ }
+
+ public void windowActivated(WindowEvent e)
+ {
+ }
+
+ public void windowDeactivated(WindowEvent e)
+ {
+ }
+
+ /**
+ * You should call this before releasing/dispose this Window !
+ * Also you can overwrite this class,
+ * to dispose your own elements, e.g. a Frame etc. -
+ * but be shure that you call
+ * cvsDispose implementation call this one !
+ *
+ * This function calls gljDestroy of GLContext !
+ *
+ * @see gl4java.GLContext#gljDestroy
+ * @see gl4java.swing.GLJPanel#doCleanup
+ */
+ public void cvsDispose()
+ {
+ cvsInitialized = false;
+ if (glj != null)
+ {
+ if (glj.gljIsInit())
+ {
+ /* Sometimes the Microsoft VM calls the
+ Applet.stop() method but doesn't have
+ permissions to do J/Direct calls, so
+ this whole block of code will throw a
+ security exception. If this happens,
+ however, windowClosing() will still
+ call us again later and we will have
+ another opportunity to shut down the
+ context, so it all works out fine. */
+ try
+ {
+ glj.gljFree();
+ doCleanup();
+ //locks and free's GLContext
+ glj.setEnabled(false);
+ glj.gljDestroy();
+ needCvsDispose = false;
+ }
+ catch (Exception ex)
+ {
+ needCvsDispose = true;
+ }
+ }
+ }
+
+ // Setting glj to null will simply cause paint() to re-initialize.
+ // We don't want that to happen, so we will leave glj non-null.
+ }
+
+ public Dimension getSize()
+ {
+ if(customOffScrnSize)
+ return offScrnSize;
+ return super.getSize();
+ }
+
+ /**
+ * get methods
+ */
+ public final int cvsGetWidth() {
+ return getSize().width;
+ }
+ public final int cvsGetHeight() {
+ return getSize().height;
+ }
+
+ //----------------------------------------------------------------------
+ // Implementation of GLDrawable
+ //
+
+ public void addGLEventListener(GLEventListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeGLEventListener(GLEventListener listener) {
+ listeners.remove(listener);
+ }
+
+ public GLFunc getGL() {
+ return gl;
+ }
+
+ public GLUFunc getGLU() {
+ return glu;
+ }
+}
diff --git a/makefile b/makefile
index 3fede20..d85a17d 100644
--- a/makefile
+++ b/makefile
@@ -96,14 +96,14 @@ CNATIVEDIR = CNativeCode
# LIBRARY DEFINITION
LIBMAJOR = 2
-LIBMINOR = 5
-LIBBUGFIX = 2
+LIBMINOR = 6
+LIBBUGFIX = 0
RELEASE = 0
#
# The demo release number
#
-DEMORELEASE = 3
+DEMORELEASE = 4
#lib GLContext
LIBBASENAME1c = GL4JavaJauGljJNI13
@@ -192,12 +192,15 @@ MK_GL4JAVA_JAR = ( cd $(DEST_CLASSES_DIR) ; \
gl4java/system \
gl4java/utils/*.class \
gl4java/utils/textures \
- gl4java/utils/glut/*.class ; \
+ gl4java/utils/glut/*.class \
+ gl4java/drawable ; \
rm -f gl4java-glutfonts.jar ; \
$(JAR) cf gl4java-glutfonts.jar \
gl4java/utils/glut/fonts ; \
- for i in $(JAR_DESTS); do \
- cp -av gl4java*.jar $$i ; done \
+ if [ ! -z "$(JAR_DESTS)" ] ; then \
+ for i in $(JAR_DESTS); do \
+ cp -av gl4java*.jar $$i ; done \
+ fi \
)
######################################################################
@@ -222,6 +225,12 @@ JAVA_C_MAP4_FILE = GLFuncJauJNInf.java
#lib GLUFunc - 2
JAVA_C_MAP5_FILE = GLUFuncJauJNInf.java
+JAVA_C_MAP6_X11_FILE = X11SunJDK13GLDrawableFactory.java
+
+JAVA_C_MAP6_WIN32_FILE = Win32SunJDK13GLDrawableFactory.java
+
+JAVA_C_MAP6_MAC_FILE = MacSunJDK13GLDrawableFactory.java
+
FILES_GLUT_FONT.java = \
$(PACKAGEDIR)/utils/glut/fonts/GLUTBitmapFont.java \
$(PACKAGEDIR)/utils/glut/fonts/GLUTStrokeFont.java \
@@ -247,6 +256,7 @@ FILES_GLUT_FONT.class = ${FILES_GLUT_FONT.java:.java=.class}
FILES.java = $(PACKAGEDIR)/GL4JavaInitException.java \
$(PACKAGEDIR)/jau/awt/WinHandleAccess.java \
$(PACKAGEDIR)/GL4JavaReflections.java \
+ $(PACKAGEDIR)/GLCapabilities.java \
$(PACKAGEDIR)/GLEnum.java \
$(PACKAGEDIR)/GLUEnum.java \
$(PACKAGEDIR)/GLFunc.java \
@@ -277,15 +287,23 @@ FILES.java = $(PACKAGEDIR)/GL4JavaInitException.java \
$(PACKAGEDIR)/utils/textures/TGATextureLoader.java \
$(PACKAGEDIR)/utils/textures/AWTTextureLoader.java \
$(PACKAGEDIR)/utils/textures/TextureGrabber.java \
- $(PACKAGEDIR)/utils/textures/TGATextureGrabber.java
+ $(PACKAGEDIR)/utils/textures/TGATextureGrabber.java \
+ $(PACKAGEDIR)/drawable/GLEventListener.java \
+ $(PACKAGEDIR)/drawable/utils/GLEventListenerList.java \
+ $(PACKAGEDIR)/drawable/GLDrawable.java \
+ $(PACKAGEDIR)/drawable/GLDrawableFactory.java \
+ $(PACKAGEDIR)/drawable/DummyGLDrawableFactory.java \
+ $(PACKAGEDIR)/drawable/SunJDK13GLDrawableFactory.java
FILES.class = ${FILES.java:.java=.class}
-FILES_mac.java = gl4java/jau/awt/macintosh/MacHandleAccess.java
+FILES_mac.java = gl4java/jau/awt/macintosh/MacHandleAccess.java \
+ gl4java/drawable/$(JAVA_C_MAP6_MAC_FILE)
FILES_mac.class = ${FILES_mac.java:.java=.class}
-FILES_w32.java = gl4java/jau/awt/windows/Win32HandleAccess.java
+FILES_w32.java = gl4java/jau/awt/windows/Win32HandleAccess.java \
+ gl4java/drawable/$(JAVA_C_MAP6_WIN32_FILE)
FILES_w32.class = ${FILES_w32.java:.java=.class}
@@ -294,7 +312,8 @@ FILES_msw32.java = $(PACKAGEDIR)/system/GljMSJDirect.java \
FILES_msw32.class = ${FILES_msw32.java:.java=.class}
-FILES_x11.java = gl4java/jau/awt/motif/X11HandleAccess.java
+FILES_x11.java = gl4java/jau/awt/motif/X11HandleAccess.java \
+ gl4java/drawable/$(JAVA_C_MAP6_X11_FILE)
FILES_x11.class = ${FILES_x11.java:.java=.class}
@@ -315,6 +334,7 @@ FILES1b.c = $(CNATIVEDIR)/OpenGL_X11.c \
FILES1c.c = $(CNATIVEDIR)/OpenGL_X11_jawt.c \
$(CNATIVEDIR)/OpenGL_X11_common.c \
$(CNATIVEDIR)/jawt_misc.c \
+ $(CNATIVEDIR)/GLDrawableFactory_X11_SunJDK13.c \
$(CNATIVEDIR)/OpenGL_misc.c \
$(CNATIVEDIR)/jni12tools.c \
$(CNATIVEDIR)/GLCallbackHelperJNI.c
@@ -384,6 +404,12 @@ FILE.gen4.h = $(CHEADERDIR)/$(PACKAGEDIR)_${JAVA_C_MAP4_FILE:.java=.h}
#lib GLUFunc - 2
FILE.gen5.h = $(CHEADERDIR)/$(PACKAGEDIR)_${JAVA_C_MAP5_FILE:.java=.h}
+FILE.gen6.x11.h = $(CHEADERDIR)/$(PACKAGEDIR)_drawable_${JAVA_C_MAP6_X11_FILE:.java=.h}
+
+FILE.gen6.win32.h = $(CHEADERDIR)/$(PACKAGEDIR)_drawable_${JAVA_C_MAP6_WIN32_FILE:.java=.h}
+
+FILE.gen6.mac.h = $(CHEADERDIR)/$(PACKAGEDIR)_drawable_${JAVA_C_MAP6_MAC_FILE:.java=.h}
+
FILES.gen = $(FILE.gen1.h) \
$(FILE.gen2.h) \
$(FILE.gen3.h) \
@@ -417,6 +443,7 @@ x11 : cleanup gljni \
$(FILES.class) $(FILES_x11.class) \
$(DEST_CLASSES_DIR)/gl4java.jar \
$(FILES.gen) \
+ $(FILE.gen6.x11.h) \
$(HOME_LIB_DIR)/$(LIBRARY1) \
$(HOME_LIB_DIR)/$(LIBRARY1b) \
$(HOME_LIB_DIR)/$(LIBRARY1c) \
@@ -435,6 +462,7 @@ mac : cleanup gljni \
$(FILES.class) $(FILES_mac.class) \
makeJar \
$(FILES.gen) \
+ $(FILE.gen6.mac.h) \
$(CNATIVEDIR)/winstuff.h
@@ -442,8 +470,9 @@ w32 : cleanupw32 gljni \
$(FILES_w32.class) \
$(FILES_msw32.class) \
$(FILES.class) \
- makeJar \
+ $(DEST_CLASSES_DIR)/gl4java.jar \
$(FILES.gen) \
+ $(FILE.gen6.win32.h) \
$(CNATIVEDIR)/winstuff.h
#gljni : tools gl2j gl2c
@@ -590,7 +619,7 @@ $(CNATIVEDIR)/OpenGL_X11.o: ${FILE.gen1.h}
$(CNATIVEDIR)/OpenGL_misc.o: ${FILE.gen1.h}
-$(FILE.gen1.h): $(PACKAGEDIR)/${JAVA_C_MAP1_FILE}
+$(FILE.gen1.h): $(PACKAGEDIR)/${JAVA_C_MAP1_FILE:.java=.class}
rm -f $(FILE.gen1.h)
$(JAVAH) -jni -d $(CHEADERDIR) $(PACKAGEDIR).${JAVA_C_MAP1_FILE:.java=} 2>&1 \
| tee -a $(THISDIR)/errors
@@ -605,7 +634,7 @@ $(CNATIVEDIR)/OpenGL_JauJNI_dynfuncs.o: ${FILE.gen2.h} \
$(CNATIVEDIR)/jnitools.h \
$(CNATIVEDIR)/GLCallbackHelperJNI.h
-$(FILE.gen2.h): $(PACKAGEDIR)/${JAVA_C_MAP2_FILE}
+$(FILE.gen2.h): $(PACKAGEDIR)/${JAVA_C_MAP2_FILE:.java=.class}
rm -f $(FILE.gen2.h)
$(JAVAH) -jni -d $(CHEADERDIR) $(PACKAGEDIR).${JAVA_C_MAP2_FILE:.java=} 2>&1 \
| tee -a $(THISDIR)/errors
@@ -616,7 +645,7 @@ $(CNATIVEDIR)/OpenGLU_JauJNI_funcs.o: ${FILE.gen3.h} \
$(CNATIVEDIR)/jnitools.h \
$(CNATIVEDIR)/GLCallbackHelperJNI.h
-$(FILE.gen3.h): $(PACKAGEDIR)/${JAVA_C_MAP3_FILE}
+$(FILE.gen3.h): $(PACKAGEDIR)/${JAVA_C_MAP3_FILE:.java=.class}
rm -f $(FILE.gen3.h)
$(JAVAH) -jni -d $(CHEADERDIR) $(PACKAGEDIR).${JAVA_C_MAP3_FILE:.java=} 2>&1 \
| tee -a $(THISDIR)/errors
@@ -626,7 +655,7 @@ $(CNATIVEDIR)/OpenGL_JauJNInf_dynfuncs.o: ${FILE.gen4.h} \
$(CNATIVEDIR)/jnitools.h \
$(CNATIVEDIR)/GLCallbackHelperJNI.h
-$(FILE.gen4.h): $(PACKAGEDIR)/${JAVA_C_MAP4_FILE}
+$(FILE.gen4.h): $(PACKAGEDIR)/${JAVA_C_MAP4_FILE:.java=.class}
rm -f $(FILE.gen4.h)
$(JAVAH) -jni -d $(CHEADERDIR) $(PACKAGEDIR).${JAVA_C_MAP4_FILE:.java=} 2>&1 \
| tee -a $(THISDIR)/errors
@@ -636,11 +665,29 @@ $(CNATIVEDIR)/OpenGLU_JauJNInf_funcs.o: ${FILE.gen5.h} \
$(CNATIVEDIR)/jnitools.h \
$(CNATIVEDIR)/GLCallbackHelperJNI.h
-$(FILE.gen5.h): $(PACKAGEDIR)/${JAVA_C_MAP5_FILE}
+$(FILE.gen5.h): $(PACKAGEDIR)/${JAVA_C_MAP5_FILE:.java=.class}
rm -f $(FILE.gen5.h)
$(JAVAH) -jni -d $(CHEADERDIR) $(PACKAGEDIR).${JAVA_C_MAP5_FILE:.java=} 2>&1 \
| tee -a $(THISDIR)/errors
+$(FILE.gen6.x11.h): $(PACKAGEDIR)/drawable/${JAVA_C_MAP6_X11_FILE:.java=.class}
+ rm -f $(FILE.gen6.x11.h)
+ $(JAVAH) -jni -d $(CHEADERDIR) \
+ $(PACKAGEDIR).drawable.${JAVA_C_MAP6_X11_FILE:.java=} 2>&1 \
+ | tee -a $(THISDIR)/errors
+
+$(FILE.gen6.win32.h): $(PACKAGEDIR)/drawable/${JAVA_C_MAP6_WIN32_FILE:.java=.class}
+ rm -f $(FILE.gen6.win32.h)
+ $(JAVAH) -jni -d $(CHEADERDIR) \
+ $(PACKAGEDIR).drawable.${JAVA_C_MAP6_WIN32_FILE:.java=} 2>&1 \
+ | tee -a $(THISDIR)/errors
+
+$(FILE.gen6.mac.h): $(PACKAGEDIR)/drawable/${JAVA_C_MAP6_MAC_FILE:.java=.class}
+ rm -f $(FILE.gen6.mac.h)
+ $(JAVAH) -jni -d $(CHEADERDIR) \
+ $(PACKAGEDIR).drawable.${JAVA_C_MAP6_MAC_FILE:.java=} 2>&1 \
+ | tee -a $(THISDIR)/errors
+
#
# This is the stuff for the MS-JVM
#
@@ -765,6 +812,8 @@ javadoc:
-doctitle "GL4Java API" \
gl4java gl4java.jau.awt gl4java.awt gl4java.swing \
gl4java.system gl4java.applet \
+ gl4java.drawable \
+ gl4java.drawable.utils \
gl4java.utils \
gl4java.utils.glut \
gl4java.utils.glut.fonts \
@@ -782,6 +831,8 @@ javadocw32:
-author -version \
gl4java gl4java.jau.awt gl4java.awt gl4java.swing \
gl4java.system gl4java.applet \
+ gl4java.drawable \
+ gl4java.drawable.utils \
gl4java.utils \
gl4java.utils.glut \
gl4java.utils.glut.fonts \
@@ -813,6 +864,7 @@ java2binpkg: pbinpkg
gl4java/swing \
gl4java/jau \
gl4java/system \
+ gl4java/drawable \
gl4java/utils/*.class \
gl4java/utils/textures \
gl4java/utils/glut/*.class
diff --git a/symbols.mak.win32-java2-32bit b/symbols.mak.win32-java2-32bit
index d0532fa..6004eb9 100644
--- a/symbols.mak.win32-java2-32bit
+++ b/symbols.mak.win32-java2-32bit
@@ -19,6 +19,12 @@ JDK_HOME_w32 = D:\\java2
JAVASHAREINC = $(JDK_HOME)/include
JAVAOSINC = $(JDK_HOME)/include/win32
+JAR_DESTS = //D/java2/jre/lib/ext \
+ //D/jdk1.2.2/jre/lib/ext \
+ //D/jre1.3.0/lib/ext \
+ //D/jre1.3.0_01/lib/ext \
+ //D/Programme/Netscape/Communicator/Program/java/classes
+
CC = gcc
MKLIB = mklibs/mkslib.linux
MKEXP = echo