diff options
Diffstat (limited to 'src/jogl/native/JoglCommon.h')
-rw-r--r-- | src/jogl/native/JoglCommon.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/jogl/native/JoglCommon.h b/src/jogl/native/JoglCommon.h index d82b445ce..b988336fa 100644 --- a/src/jogl/native/JoglCommon.h +++ b/src/jogl/native/JoglCommon.h @@ -7,9 +7,42 @@ void JoglCommon_init(JNIEnv *env); +/** Set by JoglCommon_init */ +JavaVM *JoglCommon_GetJVMHandle(); + +/** Set by JoglCommon_init */ +int JoglCommon_GetJVMVersion(); + jchar* JoglCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str); void JoglCommon_FatalError(JNIEnv *env, const char* msg, ...); void JoglCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...); +/** + * + * 1) Store jvmHandle and jvmVersion is done by 'JoglCommon_init(JNIEnv*)' + * and internally used by 'JoglCommon_GetJNIEnv(..)' and 'JoglCommon_ReleaseJNIEnv(..)'. + * + * 2) Use current thread JNIEnv or attach current thread to JVM, generating new JNIEnv + * + int shallBeDetached = 0; + JNIEnv* env = NewtCommon_GetJNIEnv(&shallBeDetached); + if(NULL==env) { + DBG_PRINT("drawRect: null JNIEnv\n"); + return; + } + + * + * 3) Use JNIEnv .. + * + .. your JNIEnv code here .. + + * + * 4) Detach thread from JVM, if required + * + JoglCommon_ReleaseJNIEnv (shallBeDetached); + */ +JNIEnv* JoglCommon_GetJNIEnv (int * shallBeDetached); +void JoglCommon_ReleaseJNIEnv (int shallBeDetached); + #endif |