aboutsummaryrefslogtreecommitdiffstats
path: root/CNativeCode/OpenGL_Win32_jawt.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2001-07-24 12:07:18 +0000
committerSven Gothel <[email protected]>2001-07-24 12:07:18 +0000
commit3583101e586a6fe3306f84d4d34ee764596e0632 (patch)
treed5c228654f882fa0f0c6214e6d4866ce44181b89 /CNativeCode/OpenGL_Win32_jawt.c
parentc9eae90cb823d918ecc4bf5afa73ce3a0859d578 (diff)
optimized context switchingrel-2-8-0-0-prerelease-3
Diffstat (limited to 'CNativeCode/OpenGL_Win32_jawt.c')
-rwxr-xr-xCNativeCode/OpenGL_Win32_jawt.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/CNativeCode/OpenGL_Win32_jawt.c b/CNativeCode/OpenGL_Win32_jawt.c
index 5eefec3..2f69ad7 100755
--- a/CNativeCode/OpenGL_Win32_jawt.c
+++ b/CNativeCode/OpenGL_Win32_jawt.c
@@ -92,6 +92,71 @@ Java_gl4java_GLContext_hasJAWTSurfaceChanged( JNIEnv *env, jobject obj,
}
JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_lockJAWT( JNIEnv *env, jobject obj,
+ jobject canvas,
+ jlong thisWin, jboolean verbose
+ )
+{
+ jboolean ret = JNI_TRUE;
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+
+ if(pData==0)
+ {
+ fprintf(stderr, "GL4Java ERROR: LockAWT NO JAWT Holder exist ! (pData=%p, thisWin=%lX) ...\n", pData, (long)thisWin);
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ if(jawt_open(env, canvas, pData, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: LockAWT 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: LockAWT could not lock JAWT reference!\n");
+ fflush(stderr);
+ }
+ ret=JNI_FALSE;
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return ret;
+ }
+ return ret;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_unlockJAWT( JNIEnv *env, jobject obj,
+ jlong thisWin, jboolean verbose
+ )
+{
+ jboolean ret = JNI_TRUE;
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+
+ jawt_close_unlock(env, pData, verbose);
+
+ return ret;
+}
+
+
+JNIEXPORT jboolean JNICALL
Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
jobject canvas)
{
@@ -489,7 +554,7 @@ Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj,
}
if(pData!=NULL)
- jawt_close_unlock(env, pData, verbose);
+ jawt_close_unlock(env, pData, JNI_FALSE);
return ret;
}
@@ -642,7 +707,7 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj,
gc = 0;
thisWin = 0;
- jawt_free_close_unlock(env, &pData, verbose);
+ jawt_free_close_unlock(env, &pData, JNI_FALSE);
pData=0;
ret=JNI_TRUE; // force ..