equal
deleted
inserted
replaced
37 /* |
37 /* |
38 * Must be executed in UI thread |
38 * Must be executed in UI thread |
39 */ |
39 */ |
40 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Interface__1ctor(JNIEnv* aEnv, jclass) |
40 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Interface__1ctor(JNIEnv* aEnv, jclass) |
41 { |
41 { |
|
42 EGLDisplay oldDisplay = eglGetCurrentDisplay(); |
|
43 EGLSurface oldDrawSurface = eglGetCurrentSurface(EGL_DRAW); |
|
44 EGLSurface oldReadSurface = eglGetCurrentSurface(EGL_READ); |
|
45 EGLContext oldContext = eglGetCurrentContext(); |
|
46 EGLenum oldAPI = eglQueryAPI(); |
|
47 eglMakeCurrent( EGL_DEFAULT_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); |
|
48 eglBindAPI( EGL_OPENGL_ES_API ); |
|
49 |
42 M3Gparams cs; |
50 M3Gparams cs; |
43 memset(&cs, 0, sizeof(cs)); |
51 memset(&cs, 0, sizeof(cs)); |
44 cs.mallocFunc = malloc; |
52 cs.mallocFunc = malloc; |
45 cs.freeFunc = free; |
53 cs.freeFunc = free; |
46 cs.errorFunc = errorHandler; |
54 cs.errorFunc = errorHandler; |
49 /* Call to the Eventserver side */ |
57 /* Call to the Eventserver side */ |
50 //CJavaM3GEventSource* eventSource = JavaUnhand<CJavaM3GEventSource>(aEventSourceHandle); |
58 //CJavaM3GEventSource* eventSource = JavaUnhand<CJavaM3GEventSource>(aEventSourceHandle); |
51 //jint handle = eventSource->Execute(&createInterface, &cs); |
59 //jint handle = eventSource->Execute(&createInterface, &cs); |
52 jint handle = (unsigned)m3gCreateInterface(&cs); |
60 jint handle = (unsigned)m3gCreateInterface(&cs); |
53 M3G_DO_UNLOCK(aEnv); |
61 M3G_DO_UNLOCK(aEnv); |
|
62 |
|
63 eglMakeCurrent( EGL_DEFAULT_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); |
|
64 eglBindAPI( oldAPI ); |
|
65 eglMakeCurrent( oldDisplay, oldDrawSurface, oldReadSurface, oldContext ); |
54 return handle; |
66 return handle; |
55 } |
67 } |
56 |
68 |
57 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Interface__1getClassID |
69 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Interface__1getClassID |
58 (JNIEnv* aEnv, jclass, jint aHObject) |
70 (JNIEnv* aEnv, jclass, jint aHObject) |