diff options
author | Sven Gothel <[email protected]> | 2013-11-05 11:03:33 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-11-05 11:03:33 +0100 |
commit | cf1163fc88976e7087d3a17524a49139e35a4708 (patch) | |
tree | 995f53dac2999615098994860e859e2e1fb2d25b /make/config/jogl/egl-CustomCCode.c | |
parent | 613e33ee8ffc1f2b9c5db1e1b5bb5253a159ed6d (diff) |
Bug 888 / Bug 891 - Enhance GLCapabilities-Query: Apply changes of commit 613e33ee8ffc1f2b9c5db1e1b5bb5253a159ed6d to EGL and WGL.
Note: WGL config query is already performed as a bulk operation.
Note: OSX does not perform such queries.
Diffstat (limited to 'make/config/jogl/egl-CustomCCode.c')
-rw-r--r-- | make/config/jogl/egl-CustomCCode.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/make/config/jogl/egl-CustomCCode.c b/make/config/jogl/egl-CustomCCode.c new file mode 100644 index 000000000..0163c6742 --- /dev/null +++ b/make/config/jogl/egl-CustomCCode.c @@ -0,0 +1,26 @@ +#include <stdio.h> /* android */ +#include <gluegen_stdint.h> +#include <gluegen_stddef.h> +#include <EGL/egl.h> + +/* Java->C glue code: + * Java package: jogamp.opengl.egl.EGL + * Java method: void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) + */ +Java_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) { + typedef EGLBoolean (EGLAPIENTRY*_local_PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); + _local_PFNEGLGETCONFIGATTRIBPROC ptr_eglGetConfigAttrib = (_local_PFNEGLGETCONFIGATTRIBPROC) (intptr_t) procAddress; + assert(ptr_eglGetConfigAttrib != NULL); + + if ( attributeCount > 0 && NULL != attributes ) { + int i; + int * attributes_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attributes)) + attributes_byte_offset); + EGLint * values_ptr = (EGLint *) (((char*) (*env)->GetDirectBufferAddress(env, values)) + values_byte_offset); + for(i=0; i<attributeCount; i++) { + if( 0 == (* ptr_eglGetConfigAttrib) ((EGLDisplay) (intptr_t) dpy, (EGLConfig) (intptr_t) config, (EGLint) attributes_ptr[i], (EGLint *) &values_ptr[i]) ) { + attributes_ptr[i] = 0; + } + } + } +} + |