Added releaseContext to BaseGL.java (and native for linux)
This commit is contained in:
parent
c13797bae2
commit
139e7b4cfb
|
@ -165,6 +165,16 @@ abstract class BaseGL {
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free the context from the current thread.
|
||||||
|
*/
|
||||||
|
public final void releaseContext() {
|
||||||
|
assert created : "GL has not been created yet.";
|
||||||
|
renderThread = null;
|
||||||
|
currentContext = null;
|
||||||
|
nReleaseContext();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make this the current context for the current thread.
|
* Make this the current context for the current thread.
|
||||||
*/
|
*/
|
||||||
|
@ -180,6 +190,11 @@ abstract class BaseGL {
|
||||||
*/
|
*/
|
||||||
public native void swapBuffers();
|
public native void swapBuffers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Native method to free the context
|
||||||
|
*/
|
||||||
|
private native void nReleaseContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method to make this the current thread
|
* Native method to make this the current thread
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,7 +9,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/* Inaccessible static: _00024assertionsDisabled */
|
/* Inaccessible static: _00024assertionsDisabled */
|
||||||
/* Inaccessible static: currentContext */
|
/* Inaccessible static: currentContext */
|
||||||
/* Inaccessible static: class_000240 */
|
/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024BaseGL */
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_opengl_BaseGL
|
* Class: org_lwjgl_opengl_BaseGL
|
||||||
* Method: nCreate
|
* Method: nCreate
|
||||||
|
@ -34,6 +34,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers
|
||||||
(JNIEnv *, jobject);
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_lwjgl_opengl_BaseGL
|
||||||
|
* Method: nReleaseContext
|
||||||
|
* Signature: ()V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nReleaseContext
|
||||||
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_opengl_BaseGL
|
* Class: org_lwjgl_opengl_BaseGL
|
||||||
* Method: nMakeCurrent
|
* Method: nMakeCurrent
|
||||||
|
|
|
@ -51,6 +51,10 @@ void makeCurrent(void) {
|
||||||
glXMakeCurrent(disp, win, context);
|
glXMakeCurrent(disp, win, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void releaseContext(void) {
|
||||||
|
glXMakeCurrent(disp, None, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_opengl_BaseGL
|
* Class: org_lwjgl_opengl_BaseGL
|
||||||
* Method: nCreate
|
* Method: nCreate
|
||||||
|
@ -92,8 +96,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
|
||||||
(JNIEnv * env, jobject obj)
|
(JNIEnv * env, jobject obj)
|
||||||
{
|
{
|
||||||
glXMakeCurrent(disp, None, NULL);
|
releaseContext();
|
||||||
|
|
||||||
// Delete the rendering context
|
// Delete the rendering context
|
||||||
if (context != NULL)
|
if (context != NULL)
|
||||||
glXDestroyContext(disp, context);
|
glXDestroyContext(disp, context);
|
||||||
|
@ -120,3 +123,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nMakeCurrent
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* * Class: org_lwjgl_opengl_BaseGL
|
||||||
|
* * Method: nFreeContext
|
||||||
|
* * Signature: ()V
|
||||||
|
* */
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nReleaseContext
|
||||||
|
(JNIEnv *, jobject)
|
||||||
|
{
|
||||||
|
releaseContext();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue