aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-16 21:18:03 +0200
committerSven Gothel <[email protected]>2012-04-16 21:18:03 +0200
commit35beeabffed61e1597aaffc0c5926ab5ef86d32e (patch)
tree6a7e91c07e7d61613b03f35a17486faf01b211fc /src/newt/native
parent2f0583aad39f93a934629c21beac66a758373249 (diff)
TextureSequence Shader Support; GLMediaPlayer uses 'int' where possible; General enhancments.
For details about TextureSequence/GLMediaPlayer shader collaboration w/ your own shader source, see TextureSequence and TexCubeES2 / MovieSimple demo. TextureSequence allows implementations to provide their own texture lookup function which may provide color space conversion (YUV) .. or other runtime hw-accel features. Have a look at the next commit, which provides an Libav/FFMpeg implementation w/ YUV/RGB shader conversion. MovieCube adds keyboard control (Android: firm touch on display to launch keyboard, don't break it though :)
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/NewtCommon.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/newt/native/NewtCommon.h b/src/newt/native/NewtCommon.h
index 33aba64ae..f5ca73b74 100644
--- a/src/newt/native/NewtCommon.h
+++ b/src/newt/native/NewtCommon.h
@@ -39,6 +39,42 @@ jchar* NewtCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str);
void NewtCommon_FatalError(JNIEnv *env, const char* msg, ...);
void NewtCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...);
+/**
+ *
+ * 1) Store jvmHandle and jvmVersion
+
+ JavaVM *jvmHandle = NULL;
+ int jvmVersion = 0;
+
+ if(0 != (*env)->GetJavaVM(env, &jvmHandle)) {
+ jvmHandle = NULL;
+ } else {
+ jvmVersion = (*env)->GetVersion(env);
+ }
+
+ *
+ * 2) Use current thread JNIEnv or attach current thread to JVM, generating new JNIEnv
+ *
+
+ int shallBeDetached = 0;
+ JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, jvmVersion, &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
+ *
+ if (shallBeDetached) {
+ (*jvmHandle)->DetachCurrentThread(jvmHandle);
+ }
+ */
JNIEnv* NewtCommon_GetJNIEnv (JavaVM * jvmHandle, int jvmVersion, int * shallBeDetached);
#endif