aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/native/JoglCommon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/native/JoglCommon.c')
-rw-r--r--src/jogl/native/JoglCommon.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/jogl/native/JoglCommon.c b/src/jogl/native/JoglCommon.c
index 16f60e4e7..c1d6ad181 100644
--- a/src/jogl/native/JoglCommon.c
+++ b/src/jogl/native/JoglCommon.c
@@ -1,6 +1,10 @@
+#include "jogamp_opengl_GLContextImpl.h"
#include "JoglCommon.h"
+#include <assert.h>
+#include <KHR/khrplatform.h>
+
static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException";
static jclass runtimeExceptionClz=NULL;
@@ -53,3 +57,20 @@ jchar* JoglCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str)
return strChars;
}
+/*
+ * Class: jogamp_opengl_GLContextImpl
+ * Method: glGetStringInt
+ * Signature: (IJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_jogamp_opengl_GLContextImpl_glGetStringInt(JNIEnv *env, jclass _unused, jint name, jlong procAddress) {
+ typedef const khronos_uint8_t * (KHRONOS_APIENTRY*_local_PFNGLGETSTRINGPROC)(unsigned int name);
+ _local_PFNGLGETSTRINGPROC ptr_glGetString;
+ const khronos_uint8_t * _res;
+ ptr_glGetString = (_local_PFNGLGETSTRINGPROC) (intptr_t) procAddress;
+ assert(ptr_glGetString != NULL);
+ _res = (* ptr_glGetString) ((unsigned int) name);
+ if (NULL == _res) return NULL;
+ return (*env)->NewStringUTF(env, _res);
+}
+