From cf1163fc88976e7087d3a17524a49139e35a4708 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 5 Nov 2013 11:03:33 +0100 Subject: 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. --- make/config/jogl/egl-CustomJavaCode.java | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 make/config/jogl/egl-CustomJavaCode.java (limited to 'make/config/jogl/egl-CustomJavaCode.java') diff --git a/make/config/jogl/egl-CustomJavaCode.java b/make/config/jogl/egl-CustomJavaCode.java new file mode 100644 index 000000000..15689b5d8 --- /dev/null +++ b/make/config/jogl/egl-CustomJavaCode.java @@ -0,0 +1,45 @@ + + private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver()); + public static void resetProcAddressTable(DynamicLookupHelper lookup) { + _table.reset(lookup); + } + + // There are some #defines in egl.h that GlueGen and PCPP don't currently handle + public static final long EGL_DEFAULT_DISPLAY = 0; + public static final long EGL_NO_CONTEXT = 0; + public static final long EGL_NO_DISPLAY = 0; + public static final long EGL_NO_SURFACE = 0; + public static final int EGL_DONT_CARE = -1; + public static final int EGL_UNKNOWN = -1; + + protected static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname) + { + if (eglGetProcAddressHandle == 0) { + throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); + } + return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle); + } + + + /** + * In case of an error on a particualr attribute, the attribute in the attributes-buffer is set to 0. + *

+ * Entry point to C language function: EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value);
Part of EGL_VERSION_1_X + *

+ */ + public static void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) { + if( attributes == null || values == null ) { + throw new RuntimeException("arrays buffers are null"); + } + if( !Buffers.isDirect(attributes) || !Buffers.isDirect(values) ) { + throw new RuntimeException("arrays buffers are not direct"); + } + if( attributes.remaining() > values.remaining() ) { + throw new RuntimeException("not enough values "+values+" for attributes "+attributes); + } + final long __addr = _table._addressof_eglGetConfigAttrib; + dispatch_eglGetConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes), + values, Buffers.getDirectBufferByteOffset(values), __addr); + } + private static native void dispatch_eglGetConfigAttributes(long dpy, long config, int attributeCount, Object attributes, int attributes_byte_offset, Object values, int valuesOffset, long procAddr); + -- cgit v1.2.3