diff options
author | Sven Gothel <[email protected]> | 2001-09-26 00:21:57 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2001-09-26 00:21:57 +0000 |
commit | 744ceb659539753d571dc46aebb601d4a2f0b401 (patch) | |
tree | d5dbaac2714b00532c51d8f35bcd6ec0927d235c | |
parent | 26883064d71736ccd96a6f1d9b19b85b66f5ac7c (diff) |
bugfix: auto context switch
27 files changed, 657 insertions, 121 deletions
diff --git a/C2J/manual/glu-manualCoded.orig.h b/C2J/manual/glu-manualCoded.orig.h index d81f084..2fd451f 100644 --- a/C2J/manual/glu-manualCoded.orig.h +++ b/C2J/manual/glu-manualCoded.orig.h @@ -8,3 +8,4 @@ extern void gluTessCallback( GLUtriangulatorObj *tobj, GLenum which, */ extern const GLubyte* gluGetString( GLenum name ); + diff --git a/C2J/manual/glu-manualCodedImplJNI2.java b/C2J/manual/glu-manualCodedImplJNI2.java index b236c3e..d30c227 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.8.0.0"; } +{ return "2.8.0.4"; } /** @@ -119,3 +119,113 @@ public final native long gluNewQuadric( ); public final native long gluNewNurbsRenderer( ); public final native long gluNewTess( ); +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param obj array of the three obj x,y,z input components + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public final int gluProject(double obj[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win) +{ + return gluProject( obj[0], obj[1], obj[2], + modelMatrix, projMatrix, viewport, win); +} + +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public final int gluProject(double objx, + double objy, + double objz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win) +{ + double x[] = { 0 }; + double y[] = { 0 }; + double z[] = { 0 }; + + if(win!=null && win.length>=3) + { + x[0]=win[0]; y[0]=win[1]; z[0]=win[2]; + } + + int r = gluProject(objx, objy, objz, modelMatrix, projMatrix, + viewport, x, y, z); + + if(win!=null && win.length>=3) + { + win[0]=x[0]; win[1]=y[0]; win[2]=z[0]; + } + + return r; +} + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param win array of the three win x,y,z input components + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public final int gluUnProject(double win[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj) +{ + return gluUnProject(win[0], win[1], win[2], + modelMatrix, projMatrix, viewport, obj); +} + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public final int gluUnProject(double winx, + double winy, + double winz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj) +{ + double x[] = { 0 }; + double y[] = { 0 }; + double z[] = { 0 }; + + if(obj!=null && obj.length>=3) + { + x[0]=obj[0]; y[0]=obj[1]; z[0]=obj[2]; + } + + int r = gluUnProject(winx, winy, winz, modelMatrix, projMatrix, + viewport, x, y, z); + + if(obj!=null && obj.length>=3) + { + obj[0]=x[0]; obj[1]=y[0]; obj[2]=z[0]; + } + + return r; +} + diff --git a/C2J/manual/glu-manualCodedVirt.java b/C2J/manual/glu-manualCodedVirt.java index e8c3fe2..0f5dbae 100644 --- a/C2J/manual/glu-manualCodedVirt.java +++ b/C2J/manual/glu-manualCodedVirt.java @@ -62,3 +62,66 @@ public void gluDeleteNurbsRenderer( long nobj ); public void gluDeleteTess( long tobj ); +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param obj array of the three obj x,y,z input components + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public int gluProject(double obj[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win); + +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public int gluProject(double objx, + double objy, + double objz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win); + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param win array of the three win x,y,z input components + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public int gluUnProject(double win[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj); + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public int gluUnProject(double winx, + double winy, + double winz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj); + + diff --git a/CNativeCode/OpenGL_X11.c b/CNativeCode/OpenGL_X11.c index f95ee8a..f7e0795 100644 --- a/CNativeCode/OpenGL_X11.c +++ b/CNativeCode/OpenGL_X11.c @@ -516,7 +516,6 @@ Java_gl4java_GLContext_gljMakeCurrentNative( JNIEnv *env, jobject obj, (Window)((PointerHolder)thisWin), (GLXContext)((PointerHolder)glContext) ) ) { - extern GLenum glGetError ( void ) ; fprintf(stderr, "GL4Java: gljMakeCurrent failed with GC\n Another thread may be use it now ...\n"); fflush(stderr); ret = JNI_FALSE; diff --git a/CNativeCode/jawt_misc.c b/CNativeCode/jawt_misc.c index dcdf4c3..ec71954 100644 --- a/CNativeCode/jawt_misc.c +++ b/CNativeCode/jawt_misc.c @@ -7,6 +7,12 @@ static JAWT _awt ; static jboolean _awt_init = JNI_FALSE ; +static long mem_used = 0L; +static int gdsi = 0; +static int gds = 0; + +static jboolean jawtdebug = JNI_FALSE; + jboolean LIBAPIENTRY jawt_create_offscreen (JNIEnv *env, JAWTDataHolder **ppJData, jboolean verbose) { @@ -21,6 +27,7 @@ jawt_create_offscreen (JNIEnv *env, JAWTDataHolder **ppJData, jboolean verbose) } *ppJData = calloc(1, sizeof(JAWTDataHolder)); + mem_used += sizeof(JAWTDataHolder); // Get the drawing surface (*ppJData)->ds = NULL; @@ -34,6 +41,9 @@ jawt_create_offscreen (JNIEnv *env, JAWTDataHolder **ppJData, jboolean verbose) (*ppJData)->offScreen = 1; (*ppJData)->result = JNI_TRUE; + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (eo create offscr): mem %ld\n", mem_used); + return JNI_TRUE; } @@ -52,6 +62,10 @@ jawt_create_open (JNIEnv *env, jobject component, } *ppJData = calloc(1, sizeof(JAWTDataHolder)); + mem_used += sizeof(JAWTDataHolder); + + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (create open): mem %ld\n", mem_used); // Get the drawing surface (*ppJData)->ds = NULL; @@ -87,8 +101,12 @@ jawt_free_close_unlock (JNIEnv *env, JAWTDataHolder **ppJData, jboolean verbose) res = jawt_close_unlock(env, *ppJData, verbose); free(*ppJData); + mem_used -= sizeof(JAWTDataHolder); *ppJData=NULL; + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (eo free close unlock): mem %ld\n", mem_used); + return res; } @@ -133,16 +151,16 @@ jawt_open (JNIEnv *env, jobject component, JAWTDataHolder *pJData, jboolean verb // Get the drawing surface pJData->ds = _awt.GetDrawingSurface(env, component); + gds++; pJData->result = pJData->ds != NULL; if(verbose && pJData->result==JNI_FALSE) { - if(verbose) - { - fprintf(stderr, "GL4Java-JAWT: open failed -> GetDrawingSurface()==NULL\n"); - fflush(stderr); - } + fprintf(stderr, "GL4Java-JAWT: open failed -> GetDrawingSurface()==NULL\n"); + fflush(stderr); } + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (eo open): gds=%d\n", gds); return pJData->result; } @@ -160,9 +178,15 @@ jawt_close_unlock (JNIEnv *env, JAWTDataHolder *pJData, jboolean verbose) // Free the drawing surface if(pJData->ds!=0) + { _awt.FreeDrawingSurface(pJData->ds); + gds--; + } pJData->ds=0; + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (eo close unlock): gds=%d\n", gds); + return pJData->result; } @@ -233,7 +257,12 @@ jawt_lock (JNIEnv *env, JAWTDataHolder *pJData, jboolean ignoreSurfaceChanged, // Get the drawing surface info pJData->dsi = pJData->ds->GetDrawingSurfaceInfo(pJData->ds); + gdsi++; exc = (*env)->ExceptionOccurred(env); + + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (eo lock): gdsi=%d\n", gdsi); + if(exc) { if(verbose) { @@ -322,7 +351,12 @@ jawt_unlock (JNIEnv *env, JAWTDataHolder *pJData, jboolean verbose) { // Free the drawing surface info pJData->ds->FreeDrawingSurfaceInfo(pJData->dsi); + gdsi--; exc = (*env)->ExceptionOccurred(env); + + if(verbose || jawtdebug) + fprintf(stdout, "GL4Java-JAWT INFO (eo unlock): gdsi=%d\n", gdsi); + if(exc) { if(verbose) { @@ -22,7 +22,7 @@ PROJECT_NAME = GL4Java # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.7.2.0 +PROJECT_NUMBER = 2.8.0.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/demos/GLLandScape/GLLandScape1w1.java b/demos/GLLandScape/GLLandScape1w1.java index cef739a..6d8b650 100644 --- a/demos/GLLandScape/GLLandScape1w1.java +++ b/demos/GLLandScape/GLLandScape1w1.java @@ -151,7 +151,10 @@ class GLLandScape1w1 extends GLAnimCanvas random = new Random(System.currentTimeMillis()); planes = new GlutPlaneObj[MAX_PLANES]; for (i = 0; i < MAX_PLANES; i++) + { + System.out.println("init .. plane: "+i); planes[i] = new GlutPlaneObj(gl, glu); + } // srand((unsigned)time(NULL)); makeTexture(); diff --git a/demos/HodglimsNeHe/Lesson4.java b/demos/HodglimsNeHe/Lesson4.java index 270b08b..da9eacb 100644 --- a/demos/HodglimsNeHe/Lesson4.java +++ b/demos/HodglimsNeHe/Lesson4.java @@ -240,7 +240,7 @@ public class Lesson4 extends Applet //Swap buffers
glj.gljSwap();
- glj.gljFree();
+ glj.gljFree(true);
}
diff --git a/gl4java/GLContext.java.skel b/gl4java/GLContext.java.skel index eac6bc5..8390bd0 100644 --- a/gl4java/GLContext.java.skel +++ b/gl4java/GLContext.java.skel @@ -29,7 +29,7 @@ import java.security.*; * can/should be loaded right here ! * * <pre> - <a href="GLContext.html#loadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)">loadNativeLibraries</a> + <a href="GLContext.html#doLoadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)">doLoadNativeLibraries</a> <a href="GLContext.html#createGLFunc(java.lang.String)">createGLFunc</a> <a href="GLContext.html#createGLUFunc(java.lang.String)">createGLUFunc</a> <p> @@ -124,7 +124,7 @@ import java.security.*; THIS FUNCTIONS ARE FOR USERS PURPOSES: ====================================== - <a href="GLContext.html#loadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)">loadNativeLibraries</a> + <a href="GLContext.html#doLoadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)">doLoadNativeLibraries</a> <a href="GLContext.html#createGLFunc(java.lang.String)">createGLFunc</a> <a href="GLContext.html#createGLUFunc(java.lang.String)">createGLUFunc</a> <a href="GLContext.html#gljIsInit()">gljIsInit</a> @@ -393,8 +393,6 @@ public class GLContext extends Object */ protected Component _compHeavy = null; - protected Thread awtThread = null; - /** * Variable to tell is where windows or not (X11) * Usally X11 ;-)) @@ -604,7 +602,7 @@ public class GLContext extends Object * * <p> * - * The user must call loadNativeLibrary ! + * The user must call doLoadNativeLibrary ! * E.g. he can add the default loader like this: * <pre> static { @@ -643,7 +641,7 @@ public class GLContext extends Object if(libsLoaded) return true; if(gljClassDebug) - System.out.println("GLContext.loadNativeLibraries will do it !"); + System.out.println("GLContext.doLoadNativeLibraries will do it !"); jvmVendor = java.lang.System.getProperty("java.vendor"); jvmVersion = java.lang.System.getProperty("java.version"); @@ -1145,11 +1143,6 @@ public class GLContext extends Object } else System.out.println("got empty Component"); - awtThread = Thread.currentThread(); - - if(gljThreadDebug) - System.out.println("GLContext: locked awt-Thread: "+awtThread); - if(_comp!=null && _gr!=null) { int i = 0; @@ -2213,7 +2206,7 @@ public class GLContext extends Object Thread thisThread = Thread.currentThread(); - if (ctxThread!=null && ctxThread==thisThread && glContext==gljGetCurrentContext()) + if (ctxThread==thisThread && glContext==gljGetCurrentContext()) return true; return false; @@ -2296,22 +2289,27 @@ public class GLContext extends Object if(gljThreadDebug && !dbgPrinted) { System.out.println("wait-switch: "+thisThread); - System.out.println("\tctxThread="+ctxThread+", next="+nextThread); - dbgPrinted=true; + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); } - /** - * Force freeing this threads context .. to avoid a deadlock .. - * This makes sense, because it is possible, - * that the same thread enters this point twice, - * before calling gljFree ! - */ - if(gljThreadDebug && !dbgPrinted) + if(ctxThread==thisThread) { - System.out.println("wait-current: "+thisThread+" for earmarked: "+nextThread); - System.out.println("\tfreeing context force .. ctxThread="+ctxThread); + /** + * Force freeing this threads context .. to avoid a deadlock .. + * This makes sense, because it is possible, + * that the same thread enters this point twice, + * before calling gljFree ! + */ + if(gljThreadDebug && !dbgPrinted) + { + System.out.println("wait-current: "+thisThread+" for earmarked: "+nextThread); + System.out.println("\tfreeing context force .. ctxThread="+ctxThread); + } + + gljFree(true); // force freeing the context } - gljFree(true); // force freeing the context + + dbgPrinted=true; try { // wait till earmarked nextThread has its chance .. @@ -2335,7 +2333,7 @@ public class GLContext extends Object if(gljThreadDebug && !dbgPrinted) { System.out.println("wait-earmarked: "+thisThread); - System.out.println("\tctxThread="+ctxThread+", next="+nextThread); + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); dbgPrinted=true; } if( _comp instanceof GLRunnable ) @@ -2361,12 +2359,16 @@ public class GLContext extends Object boolean result = false; /* is this thread allready owning the context ? */ - if ( ctxThread==thisThread ) + if ( gljIsCurrent() ) { result = lockJAWT(_comp, windowHandle, gljThreadDebug); if(gljThreadDebug) System.out.println("MakeCurrent: "+thisThread+" no CTX change, allready own, lockJAWT: "+result); return result; + } else if( ctxThread!=null && ctxThread!=thisThread ) { + System.out.println("MakeCurrent: ctxThread ain't zero, funny failure"); + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + return result; } ctxThread = thisThread ; // blocking asap .. @@ -2376,11 +2378,10 @@ public class GLContext extends Object if(nextThread==thisThread) { System.out.println("MakeCurrent: "+thisThread+" <EarMarked Run>"); - System.out.println("\tctxThread="+ctxThread+", next:=NULL"); } else { - System.out.println("MakeCurrent: "+thisThread); - System.out.println("\tctxThread="+ctxThread+", next="+nextThread); + System.out.println("MakeCurrent: "+thisThread+" <New>"); } + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); } /** @@ -2397,7 +2398,14 @@ public class GLContext extends Object */ if(!result) { - ctxThread=null; + if(gljThreadDebug) + { + System.out.println("Native MakeCurrent failed"); + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + Exception e = new Exception(); + e.printStackTrace(); + } + if(hasJAWTSurfaceChanged(windowHandle)) { /** @@ -2570,6 +2578,7 @@ public class GLContext extends Object - the force flag is true - this thread is the AWT thread - the component of this context does _not_ implement GLRunnable + - the calling thread is not the thread, this GLRunnable component holds ! * </pre> * * <p> @@ -2589,7 +2598,21 @@ public class GLContext extends Object boolean result = true; Thread thisThread = Thread.currentThread(); - if( thisThread == awtThread || (_comp instanceof GLRunnable) == false) + if ( ctxThread!=thisThread ) + { + if(gljThreadDebug) + { + System.out.println("gljFree: denied, not holding context ! "); + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + Exception e = new Exception(); + e.printStackTrace(); + } + return true; + } + + if( (_comp instanceof GLRunnable) == false || + ((GLRunnable)_comp).ownsThread(thisThread) == false + ) force=true; /** @@ -2597,23 +2620,28 @@ public class GLContext extends Object * request this context ... * or the force-flag is true */ - if ( force==true || - ( nextThread!=null && nextThread!=thisThread && ctxThread==thisThread ) - ) + if ( force==true || ( nextThread!=null && nextThread!=thisThread ) ) { result = gljFreeNative ( _comp, displayHandle, windowHandle, glContext); + ctxThread = null ; - notifyAll(); + if(gljThreadDebug) - System.out.println("gljFree: "+thisThread+" gljFreeNative result: "+result); + { + System.out.println("gljFree: gljFreeNative result: "+result); + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + } } else { result = unlockJAWT(windowHandle, false); - notifyAll(); if(gljThreadDebug) - System.out.println("gljFree: "+thisThread+" no CTX change, no requests, unlockJAWT: "+result); + { + System.out.println("gljFree: no CTX change, no requests, unlockJAWT: "+result); + System.out.println("\tctxstate thisThread="+thisThread+", ctxThread="+ctxThread+", nextThread="+nextThread+", thisContext="+glContext+", currentContext="+gljGetCurrentContext()); + } } + notifyAll(); return result; } @@ -2682,10 +2710,10 @@ public class GLContext extends Object /** * This functions fetches/dispatches the GL/GLU functions, - * which must be allready loaded via the loadNativeLibraries + * which must be allready loaded via the doLoadNativeLibraries * function ! * - * @see gl4java.GLContext#loadNativeLibraries + * @see gl4java.GLContext#doLoadNativeLibraries */ public final static native boolean gljFetchOSGLFunctions ( String gllibname, String glulibname, boolean force ); diff --git a/gl4java/GLUFunc.java b/gl4java/GLUFunc.java index b69c990..bb0c991 100644 --- a/gl4java/GLUFunc.java +++ b/gl4java/GLUFunc.java @@ -69,6 +69,69 @@ public void gluDeleteNurbsRenderer( long nobj ); public void gluDeleteTess( long tobj ); /** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param obj array of the three obj x,y,z input components + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public int gluProject(double obj[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win); + +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public int gluProject(double objx, + double objy, + double objz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win); + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param win array of the three win x,y,z input components + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public int gluUnProject(double win[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj); + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public int gluUnProject(double winx, + double winy, + double winz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj); + + +/** * C2J Parser Version 2.2 * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . diff --git a/gl4java/GLUFuncJauJNI.java b/gl4java/GLUFuncJauJNI.java index a9b2f22..1b37aa0 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.8.0.0"; } +{ return "2.8.0.4"; } /** @@ -143,6 +143,116 @@ public final native long gluNewNurbsRenderer( ); public final native long gluNewTess( ); /** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param obj array of the three obj x,y,z input components + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public final int gluProject(double obj[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win) +{ + return gluProject( obj[0], obj[1], obj[2], + modelMatrix, projMatrix, viewport, win); +} + +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public final int gluProject(double objx, + double objy, + double objz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win) +{ + double x[] = { 0 }; + double y[] = { 0 }; + double z[] = { 0 }; + + if(win!=null && win.length>=3) + { + x[0]=win[0]; y[0]=win[1]; z[0]=win[2]; + } + + int r = gluProject(objx, objy, objz, modelMatrix, projMatrix, + viewport, x, y, z); + + if(win!=null && win.length>=3) + { + win[0]=x[0]; win[1]=y[0]; win[2]=z[0]; + } + + return r; +} + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param win array of the three win x,y,z input components + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public final int gluUnProject(double win[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj) +{ + return gluUnProject(win[0], win[1], win[2], + modelMatrix, projMatrix, viewport, obj); +} + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public final int gluUnProject(double winx, + double winy, + double winz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj) +{ + double x[] = { 0 }; + double y[] = { 0 }; + double z[] = { 0 }; + + if(obj!=null && obj.length>=3) + { + x[0]=obj[0]; y[0]=obj[1]; z[0]=obj[2]; + } + + int r = gluUnProject(winx, winy, winz, modelMatrix, projMatrix, + viewport, x, y, z); + + if(obj!=null && obj.length>=3) + { + obj[0]=x[0]; obj[1]=y[0]; obj[2]=z[0]; + } + + return r; +} + +/** * C2J Parser Version 2.2 * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . diff --git a/gl4java/GLUFuncJauJNInf.java b/gl4java/GLUFuncJauJNInf.java index 8c017b3..bc40bba 100644 --- a/gl4java/GLUFuncJauJNInf.java +++ b/gl4java/GLUFuncJauJNInf.java @@ -32,7 +32,7 @@ public String getClassVendor ( ) { return "Jausoft - Sven Goethel Software Development"; } public String getClassVersion ( ) -{ return "2.8.0.0"; } +{ return "2.8.0.4"; } /** @@ -143,6 +143,116 @@ public native long gluNewNurbsRenderer( ); public native long gluNewTess( ); /** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param obj array of the three obj x,y,z input components + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public int gluProject(double obj[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win) +{ + return gluProject( obj[0], obj[1], obj[2], + modelMatrix, projMatrix, viewport, win); +} + +/** + * Wrapper for original gluProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (winx[1], winy[1], winz[1]) <-> win[3] + * + * @param win array of the three win x,y,z output components + * @see gl4java.GLUFunc#gluProject + */ +public int gluProject(double objx, + double objy, + double objz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] win) +{ + double x[] = { 0 }; + double y[] = { 0 }; + double z[] = { 0 }; + + if(win!=null && win.length>=3) + { + x[0]=win[0]; y[0]=win[1]; z[0]=win[2]; + } + + int r = gluProject(objx, objy, objz, modelMatrix, projMatrix, + viewport, x, y, z); + + if(win!=null && win.length>=3) + { + win[0]=x[0]; win[1]=y[0]; win[2]=z[0]; + } + + return r; +} + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param win array of the three win x,y,z input components + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public int gluUnProject(double win[], + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj) +{ + return gluUnProject(win[0], win[1], win[2], + modelMatrix, projMatrix, viewport, obj); +} + +/** + * Wrapper for original gluUnProject, + * where the orig. last three arguments are wrapped + * mapped in one array: (objx[1], objy[1], objz[1]) <-> obj[3] + * + * @param obj array of the three obj x,y,z output components + * @see gl4java.GLUFunc#gluUnProject + */ +public int gluUnProject(double winx, + double winy, + double winz, + double[] modelMatrix, + double[] projMatrix, + int[] viewport, + double[] obj) +{ + double x[] = { 0 }; + double y[] = { 0 }; + double z[] = { 0 }; + + if(obj!=null && obj.length>=3) + { + x[0]=obj[0]; y[0]=obj[1]; z[0]=obj[2]; + } + + int r = gluUnProject(winx, winy, winz, modelMatrix, projMatrix, + viewport, x, y, z); + + if(obj!=null && obj.length>=3) + { + obj[0]=x[0]; obj[1]=y[0]; obj[2]=z[0]; + } + + return r; +} + +/** * C2J Parser Version 2.2 * Jausoft - Sven Goethel Software Development * Reading from file: glu-proto-auto.orig.h . . . diff --git a/gl4java/applet/SimpleGLAnimApplet1.java b/gl4java/applet/SimpleGLAnimApplet1.java index 08b85d5..c989834 100644 --- a/gl4java/applet/SimpleGLAnimApplet1.java +++ b/gl4java/applet/SimpleGLAnimApplet1.java @@ -80,12 +80,12 @@ public class SimpleGLAnimApplet1 extends Applet setCheckButtons();
- buttonInfo.addMouseListener(this);
+ buttonInfo.addActionListener(this);
checkUseRepaint.addItemListener(this);
checkUseFpsSleep.addItemListener(this);
checkUseYield.addItemListener(this);
- buttonReStart.addMouseListener(this);
- buttonFps.addMouseListener(this);
+ buttonReStart.addActionListener(this);
+ buttonFps.addActionListener(this);
canvas.addMouseListener(this);
textFps.addActionListener(this);
@@ -99,12 +99,12 @@ public class SimpleGLAnimApplet1 extends Applet {
if(GLContext.gljClassDebug)
System.out.println("SGLApplet stop ..");
- buttonInfo.removeMouseListener(this);
+ buttonInfo.removeActionListener(this);
checkUseRepaint.removeItemListener(this);
checkUseFpsSleep.removeItemListener(this);
checkUseYield.removeItemListener(this);
- buttonReStart.removeMouseListener(this);
- buttonFps.removeMouseListener(this);
+ buttonReStart.removeActionListener(this);
+ buttonFps.removeActionListener(this);
canvas.removeMouseListener(this);
canvas.cvsDispose();
@@ -150,14 +150,13 @@ public class SimpleGLAnimApplet1 extends Applet {
}
- Container _cont = null;
+ Container _origCont = null;
+ Frame _saveFrame = null;
public void mouseClicked( MouseEvent evt )
{
Component comp = evt.getComponent();
- System.out.println("SimpleApplet click: "+evt);
-
if ( ( (evt.getModifiers() & evt.BUTTON1_MASK) != 0 ) &&
evt.getClickCount()==2 )
{
@@ -176,24 +175,24 @@ public class SimpleGLAnimApplet1 extends Applet System.out.println("GLContextNumber: "+
GLContext.getNativeGLContextNumber());
- glcvs.setVisible(true);
-
- if(c instanceof Frame)
+ if(_origCont !=null && c == _saveFrame)
{
- Frame of = (Frame)c;
- of.dispose();
- of=null;
+ _saveFrame.dispose();
+ _saveFrame=null;
- _cont.add(canvas);
- _cont.doLayout();
- } else if(c instanceof Panel)
+ _origCont.add(canvas);
+ _origCont.doLayout();
+ _origCont = null;
+ } else if( _saveFrame ==null && _origCont == null )
{
- _cont=c;
- Frame f = new Frame("EXTRA");
- f.add(glcvs);
- f.pack();
- f.setVisible(true);
+ _origCont = c;
+ _saveFrame = new Frame("EXTRA");
+ _saveFrame.add(glcvs);
+ _saveFrame.pack();
+ _saveFrame.setVisible(true);
}
+ glcvs.setVisible(true);
+ glcvs.repaint();
glcvs.start();
System.out.println("\nadded+started: "+glcvs);
@@ -203,29 +202,6 @@ public class SimpleGLAnimApplet1 extends Applet }
return;
}
-
- if( canvas!=null && comp.equals(buttonFps) )
- {
- double fps = 0;
- int a1;
-
- canvas.stopFpsCounter();
- fps=canvas.getFps();
- a1=(int)(fps*100.0);
- fps=(double)a1/100.0;
- textFps.setText(String.valueOf(fps));
- canvas.resetFpsCounter();
- } else if( comp.equals(buttonInfo) )
- {
- if(fInfo==null && canvas!=null && canvas.getGLContext()!=null)
- fInfo = showGLInfo();
- }
- else if( comp.equals(buttonReStart) )
- {
- canvas.setSuspended(!canvas.isSuspended(),
- evt.getClickCount()>1 // -> ReInit
- );
- }
}
public void itemStateChanged( ItemEvent evt )
@@ -266,8 +242,8 @@ public class SimpleGLAnimApplet1 extends Applet {
Object source = event.getSource();
- if ( source == textFps)
- {
+ if ( source == textFps)
+ {
try {
double FramesPerSec=
Double.valueOf(textFps.getText()).doubleValue();
@@ -279,8 +255,26 @@ public class SimpleGLAnimApplet1 extends Applet } catch (NumberFormatException s) {
System.out.println("wrong fps format, use float ..");
}
+ } else if( canvas!=null && source.equals(buttonFps) )
+ {
+ double fps = 0;
+ int a1;
- }
+ canvas.stopFpsCounter();
+ fps=canvas.getFps();
+ a1=(int)(fps*100.0);
+ fps=(double)a1/100.0;
+ textFps.setText(String.valueOf(fps));
+ canvas.resetFpsCounter();
+ } else if( source.equals(buttonInfo) )
+ {
+ if(fInfo==null && canvas!=null && canvas.getGLContext()!=null)
+ fInfo = showGLInfo();
+ }
+ else if( canvas!=null && source.equals(buttonReStart) )
+ {
+ canvas.setSuspended(!canvas.isSuspended(), false);
+ }
}
public void windowOpened(WindowEvent e)
diff --git a/gl4java/awt/GLAnimCanvas.java b/gl4java/awt/GLAnimCanvas.java index 9268db8..b35f765 100644 --- a/gl4java/awt/GLAnimCanvas.java +++ b/gl4java/awt/GLAnimCanvas.java @@ -26,9 +26,9 @@ import java.lang.Math; * </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. + * There are two ways of using a GLAnimCanvas: + * 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 gl4java.awt.GLCanvas#init}, * {@link gl4java.awt.GLCanvas#display}, * {@link gl4java.awt.GLCanvas#reshape} and @@ -412,7 +412,7 @@ public class GLAnimCanvas extends GLCanvas private boolean _fDelayRun=false; /** - * Forcec this thread to release it's GLContext ! + * Force this thread to release it's GLContext ! * * To ensure this, this thread enables itself, * and calls gljFree(true) to force the release ! diff --git a/gl4java/drawable/GLDrawable.java b/gl4java/drawable/GLDrawable.java index 55c1311..2ec134c 100644 --- a/gl4java/drawable/GLDrawable.java +++ b/gl4java/drawable/GLDrawable.java @@ -34,7 +34,7 @@ public interface GLDrawable *
* This is the rendering-method called by
* e.g.: {@link gl4java.awt.GLCanvas#display} or by
- * {@link gl4java.GLThread#run}.
+ * {@link gl4java.GLRunnable#run}.
*
* <p>
* The default implementation of display() sends
@@ -86,6 +86,16 @@ public interface GLDrawable public void display();
/**
+ * this function can be called to force a repaint
+ *
+ * Repaints this component.
+ *
+ * This method causes a call to this component's update method
+ * as soon as possible.
+ */
+ public void repaint();
+
+ /**
* the components listener's should be implemented also !
* since JDK 1.1
*/
diff --git a/gl4java/drawable/GLEventListener.java b/gl4java/drawable/GLEventListener.java index feb388d..4ca0ba2 100644 --- a/gl4java/drawable/GLEventListener.java +++ b/gl4java/drawable/GLEventListener.java @@ -86,7 +86,7 @@ public interface GLEventListener call to {@link gl4java.GLFunc#glViewport}; note that for
convenience the component has already called {@link
gl4java.GLContext#gljResize}(width, height) and {@link
- gl4java.GLFunc.glViewport}(0, 0, width, height) when this method
+ gl4java.GLFunc#glViewport}(0, 0, width, height) when this method
is called, so the client may not have to do anything in this
method. At the time this method is called, the drawable has
already made its associated GLContext current by a call to
diff --git a/gl4java/jau/awt/macintosh/MacHandleAccess.java b/gl4java/jau/awt/macintosh/MacHandleAccess.java index 853662d..f8b135a 100644 --- a/gl4java/jau/awt/macintosh/MacHandleAccess.java +++ b/gl4java/jau/awt/macintosh/MacHandleAccess.java @@ -18,7 +18,7 @@ import java.awt.*; * context * * - * @see WinHandleAccess + * @see gl4java.jau.awt.WinHandleAccess * @version 0.1, 7. JULY 1998 * @author Sven Goethel * @author ported to Mac by gerard ziemski diff --git a/gl4java/jau/awt/motif/X11HandleAccess.java b/gl4java/jau/awt/motif/X11HandleAccess.java index 8d6b27e..f9e5c23 100644 --- a/gl4java/jau/awt/motif/X11HandleAccess.java +++ b/gl4java/jau/awt/motif/X11HandleAccess.java @@ -17,7 +17,7 @@ import sun.awt.DrawingSurfaceInfo; * variables that we need to set up the OpenGL drawing
* ontext
*
- * @see WinHandleAccess
+ * @see gl4java.jau.awt.WinHandleAccess
* @version 0.1, 7. JULY 1998
* @author Sven Goethel
*
diff --git a/gl4java/jau/awt/windows/MSWin32HandleAccess.java b/gl4java/jau/awt/windows/MSWin32HandleAccess.java index 76809f3..efba52d 100644 --- a/gl4java/jau/awt/windows/MSWin32HandleAccess.java +++ b/gl4java/jau/awt/windows/MSWin32HandleAccess.java @@ -16,7 +16,7 @@ import com.ms.awt.GraphicsX; * variables that we need to set up the OpenGL drawing
* ontext
*
- * @see WinHandleAccess
+ * @see gl4java.jau.awt.WinHandleAccess
* @version 0.1, 3. JULY 1999
* @author Ron Cemer
*
diff --git a/gl4java/jau/awt/windows/Win32HandleAccess.java b/gl4java/jau/awt/windows/Win32HandleAccess.java index d4a698f..4e929f5 100644 --- a/gl4java/jau/awt/windows/Win32HandleAccess.java +++ b/gl4java/jau/awt/windows/Win32HandleAccess.java @@ -17,7 +17,7 @@ import sun.awt.DrawingSurfaceInfo; * variables that we need to set up the OpenGL drawing
* ontext
*
- * @see WinHandleAccess
+ * @see gl4java.jau.awt.WinHandleAccess
* @version 0.1, 7. JULY 1998
* @author Sven Goethel
*
diff --git a/gl4java/swing/GLAnimJPanel.java b/gl4java/swing/GLAnimJPanel.java index bdbdd94..3bd8ebf 100644 --- a/gl4java/swing/GLAnimJPanel.java +++ b/gl4java/swing/GLAnimJPanel.java @@ -27,7 +27,7 @@ import java.lang.Math; * * <p> * There are two ways of using a GLAnimJPanel: the {@link - * gl4java.GLEventListener} model or the subclassing model. Earlier + * gl4java.drawable.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} @@ -154,7 +154,7 @@ public class GLAnimJPanel extends GLJPanel protected boolean threadSuspended = false; static { - if(GLContext.loadNativeLibraries(null, null, null)==false) + if(GLContext.doLoadNativeLibraries(null, null, null)==false) System.out.println("GLAnimJPanel could not load def. native libs."); } diff --git a/gl4java/swing/GLJPanel.java b/gl4java/swing/GLJPanel.java index bc385c6..d13cc89 100644 --- a/gl4java/swing/GLJPanel.java +++ b/gl4java/swing/GLJPanel.java @@ -26,7 +26,7 @@ import javax.swing.*; * <p>
*
* There are two ways of using a GLJPanel: the {@link
- * gl4java.GLEventListener} model or the subclassing model. Earlier
+ * gl4java.drawable.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}
@@ -657,7 +657,7 @@ public class GLJPanel extends JPanel *
* <p>
* The default implementation of display() sends display events to
- * all {@link gl4java.GLEventListener}s associated with this
+ * all {@link gl4java.drawable.GLEventListener}s associated with this
* GLJPanel, and automatically calls {@link
* gl4java.GLContext#gljMakeCurrent} and {@link
* gl4java.GLContext#gljFree} as necessary.
diff --git a/gl4java/utils/textures/TextureGrabber.java b/gl4java/utils/textures/TextureGrabber.java index d7d3bff..0c0c741 100644 --- a/gl4java/utils/textures/TextureGrabber.java +++ b/gl4java/utils/textures/TextureGrabber.java @@ -11,8 +11,8 @@ import java.net.*; * The TextureGrabber's implementations are used to * save the pixels of the GL Context to a file ! * - * @see TextureTool - * @see GLImageCanvas + * @see gl4java.utils.textures.TextureTool + * @see gl4java.awt.GLImageCanvas */ public abstract class TextureGrabber implements GLEnum, GLUEnum diff --git a/gl4java/utils/textures/TextureLoader.java b/gl4java/utils/textures/TextureLoader.java index 36a8cfe..92f9536 100644 --- a/gl4java/utils/textures/TextureLoader.java +++ b/gl4java/utils/textures/TextureLoader.java @@ -14,8 +14,8 @@ import java.net.*; * This abstract Class defines the interface
* for ALL texture loaders !
*
- * @see TextureTool
- * @see GLImageCanvas
+ * @see gl4java.utils.textures.TextureTool
+ * @see gl4java.awt.GLImageCanvas
*/
public abstract class TextureLoader
extends TextureTool
diff --git a/gl4java/utils/textures/TextureTool.java b/gl4java/utils/textures/TextureTool.java index a842d1f..574299a 100755 --- a/gl4java/utils/textures/TextureTool.java +++ b/gl4java/utils/textures/TextureTool.java @@ -13,7 +13,8 @@ import java.net.*; * This Class implements basic functions, * which are used by all TextureLoader implementations ! * - * @see TextureLoader + * @see gl4java.utils.textures.TextureTool + * @see gl4java.awt.GLImageCanvas */ public abstract class TextureTool implements GLEnum, GLUEnum @@ -156,6 +157,12 @@ implements GLEnum, GLUEnum } while (format[0]==0 && /* format[0]!=glFormat && */ textWidth>1 && textHeight>1); + if(format[0]==0) + { + System.out.println("GL-ERROR: text size cannot be negotiated !\n"); + error=true; + } + } /** @@ -241,6 +248,7 @@ implements GLEnum, GLUEnum { // glu failure error=true; + System.out.println("GL-ERROR: cannot gluScaleImage !\n"); } else { pixel = buffer; } @@ -365,6 +373,7 @@ implements GLEnum, GLUEnum { // glu failure error=true; + System.out.println("GL-ERROR: cannot gluScaleImage !\n"); } else { pixel = buffer; imageWidth=w; @@ -100,7 +100,7 @@ CNATIVEDIR = CNativeCode LIBMAJOR = 2 LIBMINOR = 8 LIBBUGFIX = 0 -RELEASE = 0 +RELEASE = 5 # # The demo release number @@ -239,6 +239,7 @@ FILES.java = $(PACKAGEDIR)/GL4JavaInitException.java \ $(PACKAGEDIR)/awt/GLCanvas.java \ $(PACKAGEDIR)/awt/GLAnimCanvas.java \ $(PACKAGEDIR)/awt/GLImageCanvas.java \ + $(PACKAGEDIR)/applet/SimpleGLApplet1.java \ $(PACKAGEDIR)/applet/SimpleGLAnimApplet1.java \ $(PACKAGEDIR)/swing/GLJPanel.java \ $(PACKAGEDIR)/swing/GLAnimJPanel.java \ diff --git a/symbols.mak.linux-java2-xf86-x86-32bit b/symbols.mak.linux-java2-xf86-x86-32bit index 262e414..70162ba 100644 --- a/symbols.mak.linux-java2-xf86-x86-32bit +++ b/symbols.mak.linux-java2-xf86-x86-32bit @@ -19,11 +19,12 @@ JAVAOSLIB = $(JDK_HOME)/jre/lib/i386 JAR_DESTS = /usr/local/lib/jdk1.2.2-FCS-blackdown/jre/lib/ext \ /usr/local/lib/jdk1.3.0-FCS-blackdown/jre/lib/ext \ + /usr/local/lib/jdk1.3.1-FCS-blackdown/jre/lib/ext \ /usr/local/lib/jdk1.2.2-sun/jre/lib/ext \ /usr/local/lib/jdk1.3.0_02-sun/jre/lib/ext \ /usr/local/lib/jdk1.3.0-ibm/jre/lib/ext \ /usr/local/lib/jdk1.3.1-sun/jre/lib/ext \ - /usr/local/lib/jdk1.4.0-beta1-sun/jre/lib/ext + /usr/local/lib/jdk1.4.0-beta-sun/jre/lib/ext CC = gcc MKLIB = mklibs/mkslib.linux |