Fixes bug #1889, allows for GL Context deletion/recreation on Android
Thanks ny00!
This commit is contained in:
parent
a99dfca578
commit
2a6b235190
3 changed files with 41 additions and 14 deletions
|
@ -71,6 +71,7 @@ static jclass mActivityClass;
|
|||
|
||||
// method signatures
|
||||
static jmethodID midCreateGLContext;
|
||||
static jmethodID midDeleteGLContext;
|
||||
static jmethodID midFlipBuffers;
|
||||
static jmethodID midAudioInit;
|
||||
static jmethodID midAudioWriteShortBuffer;
|
||||
|
@ -120,6 +121,8 @@ void SDL_Android_Init(JNIEnv* mEnv, jclass cls)
|
|||
|
||||
midCreateGLContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
|
||||
"createGLContext","(II[I)Z");
|
||||
midDeleteGLContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
|
||||
"deleteGLContext","()V");
|
||||
midFlipBuffers = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
|
||||
"flipBuffers","()V");
|
||||
midAudioInit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
|
||||
|
@ -361,6 +364,13 @@ SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion,
|
|||
return success ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_bool Android_JNI_DeleteContext(SDL_GLContext context)
|
||||
{
|
||||
/* There's only one context, so the parameter is ignored for now */
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
(*env)->CallStaticBooleanMethod(env, mActivityClass, midDeleteGLContext);
|
||||
}
|
||||
|
||||
void Android_JNI_SwapWindow()
|
||||
{
|
||||
JNIEnv *mEnv = Android_JNI_GetEnv();
|
||||
|
|
|
@ -119,7 +119,9 @@ Android_GL_SwapWindow(_THIS, SDL_Window * window)
|
|||
void
|
||||
Android_GL_DeleteContext(_THIS, SDL_GLContext context)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n");
|
||||
if (context) {
|
||||
Android_JNI_DeleteContext(context);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_ANDROID */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue