diff options
Diffstat (limited to 'make/config/jogl')
78 files changed, 2781 insertions, 1329 deletions
diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java index 31d1961fc..cc1fefd1a 100644 --- a/make/config/jogl/cg-common-CustomJavaCode.java +++ b/make/config/jogl/cg-common-CustomJavaCode.java @@ -6,7 +6,11 @@ static { if(null==cgProcAddressTable) { throw new RuntimeException("Couldn't instantiate CgProcAddressTable"); } - cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo()); + + cgDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() { + public DynamicLibraryBundle run() { + return new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo()); + } } ); if(null==cgDynamicLookupHelper) { throw new RuntimeException("Null CgDynamicLookupHelper"); } diff --git a/make/config/jogl/cg-common.cfg b/make/config/jogl/cg-common.cfg index 35805bf01..d6a5367a6 100644 --- a/make/config/jogl/cg-common.cfg +++ b/make/config/jogl/cg-common.cfg @@ -105,6 +105,8 @@ Import jogamp.opengl.* Import com.jogamp.common.os.DynamicLookupHelper Import com.jogamp.common.os.DynamicLibraryBundle Import com.jogamp.opengl.cg.CgDynamicLibraryBundleInfo +Import java.security.PrivilegedAction +Import java.security.AccessController # # NIODirectOnly directives for routines requiring them for semantic reasons diff --git a/make/config/jogl/cgl-macosx-CustomJavaCode.java b/make/config/jogl/cgl-macosx-CustomJavaCode.java new file mode 100644 index 000000000..fc3ce1c57 --- /dev/null +++ b/make/config/jogl/cgl-macosx-CustomJavaCode.java @@ -0,0 +1,37 @@ + +/** + * Creates the NSOpenGLLayer for FBO/PBuffer w/ optional GL3 shader program + * <p> + * The NSOpenGLLayer will immediatly create a OpenGL context sharing the given ctx, + * which will be used to render the texture offthread. + * </p> + * <p> + * The NSOpenGLLayer starts in enabled mode, + * you may enable/disable it via {@link #setNSOpenGLLayerEnabled(long, boolean)}. + * </p> + */ +public static long createNSOpenGLLayer(final long ctx, final int gl3ShaderProgramName, final long fmt, final long p, + final int texID, final boolean opaque, + final int texWidth, final int texHeight, + final int winWidth, final int winHeight) { + return createNSOpenGLLayerImpl(ctx, gl3ShaderProgramName, fmt, p, texID, opaque, texWidth, texHeight, winWidth, winHeight); +} + +/** + * Enable or disable NSOpenGLLayer. + * + * <p> + * If disabled, the NSOpenGLLayer will not be displayed, i.e. rendered. + * </p> + */ +public static void setNSOpenGLLayerEnabled(final long nsOpenGLLayer, final boolean enable) { + setNSOpenGLLayerEnabledImpl(nsOpenGLLayer, enable); +} + +/** + * Releases the NSOpenGLLayer + */ +public static void releaseNSOpenGLLayer(final long nsOpenGLLayer) { + releaseNSOpenGLLayerImpl(nsOpenGLLayer); +} + diff --git a/make/config/jogl/cgl-macosx.cfg b/make/config/jogl/cgl-macosx.cfg index 7d17c4aff..a67ee8087 100644 --- a/make/config/jogl/cgl-macosx.cfg +++ b/make/config/jogl/cgl-macosx.cfg @@ -10,6 +10,10 @@ Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + GLHeader GL/cglext.h Opaque long void * @@ -27,9 +31,18 @@ Opaque long NSOpenGLView * Opaque long NSOpenGLPixelBuffer * Opaque long NSOpenGLLayer * -CustomCCode #include </usr/include/machine/types.h> +CustomCCode #include <machine/types.h> CustomCCode #include "macosx-window-system.h" +AccessControl createNSOpenGLLayerImpl PRIVATE +AccessControl setNSOpenGLLayerEnabledImpl PRIVATE +AccessControl releaseNSOpenGLLayerImpl PRIVATE +RenameJavaMethod createNSOpenGLLayer createNSOpenGLLayerImpl +RenameJavaMethod setNSOpenGLLayerEnabled setNSOpenGLLayerEnabledImpl +RenameJavaMethod releaseNSOpenGLLayer releaseNSOpenGLLayerImpl + +IncludeAs CustomJavaCode CGL cgl-macosx-CustomJavaCode.java + # Implement the first argument to getProcAddress as String instead # of byte[] ArgumentIsString getProcAddress 0 @@ -49,3 +62,5 @@ DropUniqVendorExtensions SGIX DropUniqVendorExtensions SUN DropUniqVendorExtensions WIN +Import com.jogamp.common.util.Function +Import jogamp.nativewindow.macosx.OSXUtil diff --git a/make/config/jogl/cglext.cfg b/make/config/jogl/cglext.cfg index 34a59dda3..3c6708460 100644 --- a/make/config/jogl/cglext.cfg +++ b/make/config/jogl/cglext.cfg @@ -14,6 +14,10 @@ ImplJavaClass CGLExtImpl Include gl-common.cfg Include gl-desktop.cfg +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + GLHeader GL/cglext.h EmitProcAddressTable true 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; + } + } + } +} + 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. + * <p> + * Entry point to C language function: <code> EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); </code> <br>Part of <code>EGL_VERSION_1_X</code> + * </p> + */ + 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); + diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg index ee74b46e6..94b67951d 100644 --- a/make/config/jogl/egl.cfg +++ b/make/config/jogl/egl.cfg @@ -9,6 +9,10 @@ Style AllStatic # Shouldn't matter which one of these we pick up Include egl-common.cfg +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + HierarchicalNativeOutput false # Use a ProcAddressTable so we dynamically look up the routines @@ -21,31 +25,7 @@ GetProcAddressTableExpr _table ArgumentIsString eglGetProcAddress 0 ReturnsString eglQueryString -CustomCCode #include <stdio.h> /* android */ -CustomCCode #include <gluegen_stdint.h> -CustomCCode #include <gluegen_stddef.h> -CustomCCode #include <EGL/egl.h> - -CustomJavaCode EGL private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver()); -CustomJavaCode EGL public static void resetProcAddressTable(DynamicLookupHelper lookup) { -CustomJavaCode EGL _table.reset(lookup); -CustomJavaCode EGL } - -# There are some #defines in egl.h that GlueGen and PCPP don't currently handle -CustomJavaCode EGL public static final long EGL_DEFAULT_DISPLAY = 0; -CustomJavaCode EGL public static final long EGL_NO_CONTEXT = 0; -CustomJavaCode EGL public static final long EGL_NO_DISPLAY = 0; -CustomJavaCode EGL public static final long EGL_NO_SURFACE = 0; -CustomJavaCode EGL public static final int EGL_DONT_CARE = -1; -CustomJavaCode EGL public static final int EGL_UNKNOWN = -1; -CustomJavaCode EGL -CustomJavaCode EGL protected static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname) -CustomJavaCode EGL { -CustomJavaCode EGL if (eglGetProcAddressHandle == 0) { -CustomJavaCode EGL throw new GLException("Passed null pointer for method \"eglGetProcAddress\""); -CustomJavaCode EGL } -CustomJavaCode EGL return dispatch_eglGetProcAddress1(procname, eglGetProcAddressHandle); -CustomJavaCode EGL } - +IncludeAs CustomJavaCode EGL egl-CustomJavaCode.java +IncludeAs CustomCCode egl-CustomCCode.c Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg index 2e422ff72..7fccce716 100644 --- a/make/config/jogl/eglext.cfg +++ b/make/config/jogl/eglext.cfg @@ -11,8 +11,14 @@ ImplJavaClass EGLExtImpl # Shouldn't matter which one of these we pick up Include egl-common.cfg +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/egl/EGL.java +IgnoreExtension EGL_VERSION_1_X + HierarchicalNativeOutput false # Use a ProcAddressTable so we dynamically look up the routines diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg index 6631e035d..a723a9fd8 100644 --- a/make/config/jogl/gl-common-extensions.cfg +++ b/make/config/jogl/gl-common-extensions.cfg @@ -20,6 +20,7 @@ DropUniqVendorExtensions WIN # Drop some obsolete or mostly-integrated vendor extensions that the above directives let in # Note that some of these are in LWJGL, so perhaps there is justification for leaving them in +IgnoreExtension GL_APPLE_sync IgnoreExtension GL_APPLE_element_array IgnoreExtension GL_APPLE_vertex_array_object IgnoreExtension GL_ATI_element_array @@ -46,6 +47,7 @@ IgnoreExtension GL_NV_texture_rectangle IgnoreExtension GL_NV_vertex_program # This one would require more work -- has associated GLX and WGL bindings IgnoreExtension GL_NV_present_video +IgnoreExtension GL_OES_fixed_point # For the time being, ignore these extensions which are in the ES 2.0 spec IgnoreExtension GL_NV_framebuffer_vertex_attrib_array @@ -86,25 +88,11 @@ RenameExtensionIntoCore GL_NV_draw_buffers RenameExtensionIntoCore GL_NV_fbo_color_attachments RenameExtensionIntoCore GL_EXT_packed_float RenameExtensionIntoCore GL_EXT_texture_format_BGRA8888 - -# A mess w/ the ES2 definition .. sadly -# RenameExtensionIntoCore GL_EXT_texture_storage -RenameJavaSymbol glTexStorage1DEXT glTexStorage1D -RenameJavaSymbol glTexStorage2DEXT glTexStorage2D -RenameJavaSymbol glTexStorage3DEXT glTexStorage3D -RenameJavaSymbol GL_TEXTURE_IMMUTABLE_FORMAT_EXT GL_TEXTURE_IMMUTABLE_FORMAT -RenameJavaSymbol GL_RGBA32F_EXT GL_RGBA32F -RenameJavaSymbol GL_RGB32F_EXT GL_RGB32F -RenameJavaSymbol GL_ALPHA32F_EXT GL_ALPHA32F_ARB -RenameJavaSymbol GL_LUMINANCE32F_EXT GL_LUMINANCE32F_ARB -RenameJavaSymbol GL_LUMINANCE_ALPHA32F_EXT GL_LUMINANCE_ALPHA32F_ARB -RenameJavaSymbol GL_RGB16F_EXT GL_RGB16F -RenameJavaSymbol GL_ALPHA16F_EXT GL_ALPHA16F_ARB -RenameJavaSymbol GL_LUMINANCE16F_EXT GL_LUMINANCE16F_ARB -RenameJavaSymbol GL_LUMINANCE_ALPHA16F_EXT GL_LUMINANCE_ALPHA16F_ARB -RenameJavaSymbol GL_RGB10_A2_EXT GL_RGB10_A2 -RenameJavaSymbol GL_RGB10_EXT GL_RGB10 - +RenameExtensionIntoCore GL_OES_single_precision +RenameExtensionIntoCore GL_EXT_draw_buffers +RenameExtensionIntoCore GL_EXT_texture_storage +RenameExtensionIntoCore GL_ARB_texture_storage +RenameExtensionIntoCore GL_EXT_map_buffer_range # The following extensions have some differences requiring us to # manually rename some symbols and leave others alone for best diff --git a/make/config/jogl/gl-common-gpubufferonly.cfg b/make/config/jogl/gl-common-gpubufferonly.cfg new file mode 100644 index 000000000..9370d9502 --- /dev/null +++ b/make/config/jogl/gl-common-gpubufferonly.cfg @@ -0,0 +1,51 @@ + +# +# For core GL spec >= 3.1 and ES >= 3.0 +# source can only be a buffer object! +# +# See Bug 852 +# +# OpenGL 3.1 core spec 2.10 p41 +# Vertex Array Objects - *Pointer commands +# +# OpenGL 3.2 core spec 2.9.7 p45 +# Draw* commands -w/ "Array Indices in Buffer Objects" +# +# OpenGL 4.0 core spec 2.9.8 p51: +# Draw* Indirect Commands .. +# + +BufferObjectOnly glColorPointer +BufferObjectOnly glEdgeFlagPointer +BufferObjectOnly glElementPointerATI +BufferObjectOnly glFogCoordPointer +BufferObjectOnly glFogCoordPointerEXT +BufferObjectOnly glInterleavedArrays +BufferObjectOnly glMatrixIndexPointerARB +BufferObjectOnly glNormalPointer +BufferObjectOnly glSecondaryColorPointer +BufferObjectOnly glSecondaryColorPointerEXT +BufferObjectOnly glTexCoordPointer +BufferObjectOnly glVariantPointerEXT +BufferObjectOnly glVertexPointer +BufferObjectOnly glVertexAttribPointer +BufferObjectOnly glVertexAttribPointerARB +BufferObjectOnly glVertexAttribPointerNV +BufferObjectOnly glVertexAttribIPointer +BufferObjectOnly glVertexAttribLPointer +BufferObjectOnly glVertexWeightPointerEXT +BufferObjectOnly glWeightPointerARB + +BufferObjectOnly glDrawElements +BufferObjectOnly glDrawElementsBaseVertex +BufferObjectOnly glDrawElementsInstanced +BufferObjectOnly glDrawElementsInstancedBaseInstance +BufferObjectOnly glDrawElementsInstancedBaseVertex +BufferObjectOnly glDrawElementsInstancedBaseVertexBaseInstance +BufferObjectOnly glDrawRangeElements +BufferObjectOnly glDrawRangeElementsBaseVertex +BufferObjectOnly glMultiDrawArraysIndirect + +BufferObjectOnly glDrawArraysIndirect +BufferObjectOnly glDrawElementsIndirect + diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg index 9c5467583..d5c45314e 100644 --- a/make/config/jogl/gl-common.cfg +++ b/make/config/jogl/gl-common.cfg @@ -7,6 +7,20 @@ HierarchicalNativeOutput false RuntimeExceptionType GLException UnsupportedExceptionType GLException +# Inform the glue code generator of the association between #defines +# and functions and the extensions in which they are defined +GLHeader GL/gl.h +GLHeader GL/glext.h +GLHeader GL/glcorearb.h +GLHeader GL/glcorearbext.h +GLHeader GLES/gl.h +GLHeader GLES/glext.h +GLHeader GLES2/gl2.h +GLHeader GLES2/gl2ext.h +GLHeader GLES3/gl3.h +GLHeader GLES3/gl3ext.h +GLHeader GL/glext-20130207.h + # Imports needed by all glue code Import java.util.* Import javax.media.opengl.* @@ -37,14 +51,71 @@ Ignore glGetVertexAttribPointerv Ignore glGetVertexAttribPointervARB Ignore glGetVertexAttribPointervNV Ignore glTracePointerRangeMESA -Ignore glMultiDrawElementsBaseVertex -Ignore glDebugMessageCallbackARB Ignore glDebugMessageCallbackAMD +Ignore glDebugMessageCallbackARB +Ignore glDebugMessageCallbackKHR +Ignore glDebugMessageCallback + +# +# Manually implement following GL functions to be redirected +# to GLBufferObjectTracker. +# +ManuallyImplement glBufferData +ForceProcAddressGen glBufferData +MethodJavadoc glBufferData * <p> +MethodJavadoc glBufferData * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. +MethodJavadoc glBufferData * </p> +MethodJavadoc glBufferData * <p> +MethodJavadoc glBufferData * @throws GLException if buffer is not bound to target +MethodJavadoc glBufferData * @throws GLException if size is less-than zero +MethodJavadoc glBufferData * @throws GLException if a native GL-Error occurs +MethodJavadoc glBufferData * </p> + +# FIXME: Add for OpenGL 4.4 +#Ignore glBufferStorage +#ManuallyImplement glBufferStorage +#ForceProcAddressGen glBufferStorage +#MethodJavadoc glBufferStorage * <p> +#MethodJavadoc glBufferStorage * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. +#MethodJavadoc glBufferStorage * </p> +#MethodJavadoc glBufferStorage * <p> +#MethodJavadoc glBufferStorage * @throws GLException if buffer is not bound to target +#MethodJavadoc glBufferStorage * @throws GLException if size is less-or-equal zero +#MethodJavadoc glBufferStorage * @throws GLException if a native GL-Error occurs +#MethodJavadoc glBufferStorage * </p> -# Manually implement glMapBuffer as the size of the returned buffer -# can only be computed by calling another routine ManuallyImplement glMapBuffer ForceProcAddressGen glMapBuffer +MethodJavadoc glMapBuffer * <p> +MethodJavadoc glMapBuffer * Throws a {@link GLException} if GL-function constraints are not met. +MethodJavadoc glMapBuffer * </p> +MethodJavadoc glMapBuffer * <p> +MethodJavadoc glMapBuffer * Returns {@link GL#mapBuffer(int, int)}'s {@link GLBufferStorage#getMappedBuffer()}. +MethodJavadoc glMapBuffer * </p> +MethodJavadoc glMapBuffer * @throws GLException if buffer is not bound to target +MethodJavadoc glMapBuffer * @throws GLException if buffer is not tracked +MethodJavadoc glMapBuffer * @throws GLException if buffer is already mapped +MethodJavadoc glMapBuffer * @throws GLException if buffer has invalid store size, i.e. less-than zero +MethodJavadoc glMapBuffer * </p> + +ManuallyImplement glMapBufferRange +ForceProcAddressGen glMapBufferRange +MethodJavadoc glMapBufferRange * <p> +MethodJavadoc glMapBufferRange * Throws a {@link GLException} if GL-function constraints are not met. +MethodJavadoc glMapBufferRange * </p> +MethodJavadoc glMapBufferRange * <p> +MethodJavadoc glMapBufferRange * Returns {@link GL#mapBufferRange(int, long, long, int)}'s {@link GLBufferStorage#getMappedBuffer()}. +MethodJavadoc glMapBufferRange * </p> +MethodJavadoc glMapBufferRange * <p> +MethodJavadoc glMapBufferRange * @throws GLException if buffer is not bound to target +MethodJavadoc glMapBufferRange * @throws GLException if buffer is not tracked +MethodJavadoc glMapBufferRange * @throws GLException if buffer is already mapped +MethodJavadoc glMapBufferRange * @throws GLException if buffer has invalid store size, i.e. less-than zero +MethodJavadoc glMapBufferRange * @throws GLException if buffer mapping range does not fit, incl. offset +MethodJavadoc glMapBufferRange * </p> + +ManuallyImplement glUnmapBuffer +ForceProcAddressGen glUnmapBuffer # Ignore the ATI_map_object_buffer extension for now unless someone # claims they need it, as it will undoubtedly require a similar @@ -250,7 +321,7 @@ RenameExtensionIntoCore GL_EXT_draw_buffers2 RenameExtensionIntoCore GL_ARB_texture_compression_rgtc IgnoreExtension GL_EXT_texture_compression_rgtc -RenameExtensionIntoCore GL_EXT_transform_feedback +IgnoreExtension GL_EXT_transform_feedback IgnoreExtension GL_NV_transform_feedback # gl.h uses GL_ARB_vertex_array_object @@ -278,6 +349,8 @@ IgnoreExtension GL_EXT_texture_buffer_object RenameExtensionIntoCore GL_EXT_texture_rectangle IgnoreExtension GL_NV_texture_rectangle RenameExtensionIntoCore GL_ARB_uniform_buffer_object +# Use Manual definition, otherwise GlueGen uses 'long' type +Ignore GL_INVALID_INDEX # <<< OpenGL 3.1 # >>> OpenGL 3.2 @@ -340,6 +413,17 @@ RenameExtensionIntoCore GL_ARB_viewport_array # Rename extension suffices (if exist) subsumed in OpenGL 4.2 (from OpenGL 4.2 spec, Appendix L.1) # <<< OpenGL 4.2 +# >>> OpenGL 4.3 +# Rename extension suffices (if exist) subsumed in OpenGL 4.3 (from OpenGL 4.3 spec, Appendix ?.1) +RenameExtensionIntoCore GL_ARB_debug_output +# <<< OpenGL 4.3 + +# >>> OpenGL ES 2.0 +# <<< OpenGL ES 2.0 + +# >>> OpenGL ES 3.0 +# <<< OpenGL ES 3.0 + # Ignore a few obsolete versions of extensions that have been subsumed into the core or ARB extensions IgnoreExtension GL_EXT_multisample IgnoreExtension GL_EXT_point_parameters @@ -353,6 +437,8 @@ IgnoreExtension GL_EXT_shader_image_load_store Opaque boolean GLboolean Opaque long GLsync Opaque long GLeglImageOES +Opaque long cl_context +Opaque long cl_event ReturnsString glGetString ReturnsString glGetStringi @@ -360,57 +446,68 @@ ReturnsString glGetStringi # NIOOnly __ALL__ # -# NIODirectOnly directives for vertex arrays and other core routines +# NIODirectOnly directives for pointer functions +# essential where memory needs to be kept pinpointed after the function call. # essential where the buffer lifecycle extends the function call. # -# Note: API calls like glColorPointer(..) will not be exploded to -# multiple primitive arrays, since the pointer argument is 'void *'. -# - -#NIO Review: No technical reason to constrain array access for these: -#NIODirectOnly glColorPointer -#NIODirectOnly glEdgeFlagPointer -#NIODirectOnly glIndexPointer -#NIODirectOnly glNormalPointer -#NIODirectOnly glTexCoordPointer -#NIODirectOnly glVertexPointer -#NIODirectOnly glVertexAttribPointer -#NIODirectOnly glFogCoordPointer -#NIODirectOnly glSecondaryColorPointer - -#Return values -#NIODirectOnly glGenBuffers -#NIODirectOnly glGetPointerv -#NIODirectOnly glFeedbackBuffer -#NIODirectOnly glSelectBuffer -#NIODirectOnly glGetBufferSubData - +# Note-1: API calls like glColorPointer(..) will not be exploded to +# multiple primitive arrays, since the pointer argument is 'void *'. # -# NIODirectOnly directives for other extensions +# Note-2: It may be possible to track the primitive non-direct NIO backed arrays and pinpoint them. +# JNI's Get*ArrayElements may be able to pinpoint, however it could result +# in a copy of the data, which would render this feature non performant. +# The tracking itself may be another no-go, since it would add up complexity +# and failing to free resources would be another negative sideeffect. # -#NIO Review: No technical reason to constrain array access for these: -#NIODirectOnly glMatrixIndexPointerARB +NIODirectOnly glColorPointer +NIODirectOnly glEdgeFlagPointer +NIODirectOnly glFeedbackBuffer +NIODirectOnly glFogCoordPointer +NIODirectOnly glGetBufferSubData NIODirectOnly glGetProgramStringARB +NIODirectOnly glIndexPointer +NIODirectOnly glMatrixIndexPointerARB +NIODirectOnly glMultiTexCoordPointerEXT +NIODirectOnly glNormalPointer NIODirectOnly glPixelDataRangeNV +NIODirectOnly glSecondaryColorPointer +NIODirectOnly glSelectBuffer +NIODirectOnly glTangentPointerEXT +NIODirectOnly glTexCoordPointer +NIODirectOnly glVariantPointerEXT NIODirectOnly glVertexArrayRangeNV NIODirectOnly glVertexArrayRangeApple +NIODirectOnly glVertexAttribIPointer +NIODirectOnly glVertexAttribLPointer +NIODirectOnly glVertexAttribPointer +NIODirectOnly glVertexPointer +NIODirectOnly glVertexWeightPointerEXT +NIODirectOnly glWeightPointerARB NIODirectOnly wglFreeMemoryNV NIODirectOnly glXFreeMemoryNV +# Native PointerBuffer usage: +NIODirectOnly glMultiDrawElements +NIODirectOnly glMultiDrawElementsBaseVertex +NIODirectOnly glVDPAUMapSurfacesNV +NIODirectOnly glVDPAUUnmapSurfacesNV +NIODirectOnly glExtGetBufferPointervQCOM + +#NIO Review: No technical reason to constrain array access for these: +#Return values +#NIODirectOnly glGenBuffers +#NIODirectOnly glGetPointerv + # -# NIOOnly for a few API calls .. +# NIODirectOnly directives for other extensions # -NIOOnly glVertexAttribPointerNV -NIOOnly glVertexWeightPointerEXT +#NIO Review: No technical reason to constrain array access for these: # Capacity of wglAllocateMemoryNV/glXAllocateMemoryNV return value is # same as value of first argument ReturnValueCapacity wglAllocateMemoryNV {0} ReturnValueCapacity glXAllocateMemoryNV {0} -ReturnValueCapacity glMapBufferRange {2} -ReturnValueCapacity glMapNamedBufferRangeEXT {2} - # Pass arguments to ARB_vertex_program, ARB_fragment_program, # ARB_shader_objects, NV_vertex_program, NV_fragment_program, and # ARB_vertex_shader as Strings @@ -431,6 +528,7 @@ ArgumentIsString glProgramNamedParameter4fvNV 2 ArgumentIsString glProgramNamedParameter4dvNV 2 ArgumentIsString glShaderSource 2 ArgumentIsString glShaderSourceARB 2 +ArgumentIsString glCreateShaderProgramv 2 ArgumentIsString glBindFragDataLocation 2 ArgumentIsString glGetFragDataLocation 1 @@ -459,7 +557,7 @@ ArgumentIsString glGetFragDataIndex 1 ArgumentIsString glGetSubroutineIndex 2 ArgumentIsString glGetSubroutineUniformLocation 2 -ArgumentIsString glDebugMessageInsertARB 5 +ArgumentIsString glDebugMessageInsert 5 ArgumentIsString glDebugMessageInsertAMD 4 ArgumentIsString glNamedStringARB 2 4 @@ -506,13 +604,18 @@ JavaEpilogue glBindFramebuffer _context.setBoundFramebuffer(target, framebuffer # JavaPrologue glBegin inBeginEndPair = true; JavaEpilogue glEnd inBeginEndPair = false; -JavaEpilogue glBindBuffer bufferStateTracker.setBoundBufferObject({0}, {1}); -JavaEpilogue glBindBufferARB bufferStateTracker.setBoundBufferObject({0}, {1}); -JavaEpilogue glPushClientAttrib bufferStateTracker.clearBufferObjectState(); -JavaEpilogue glPushClientAttrib glStateTracker.pushAttrib(mask); -JavaEpilogue glPopClientAttrib bufferStateTracker.clearBufferObjectState(); -JavaEpilogue glPopClientAttrib glStateTracker.popAttrib(); -JavaEpilogue glBufferData bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1}); + +JavaEpilogue glBindBuffer bufferStateTracker.setBoundBufferObject({0}, {1}); +JavaEpilogue glBindBufferARB bufferStateTracker.setBoundBufferObject({0}, {1}); +JavaEpilogue glBindBufferBase bufferStateTracker.setBoundBufferObject({0}, {2}); +JavaEpilogue glBindBufferRange bufferStateTracker.setBoundBufferObject({0}, {2}); +JavaEpilogue glBindVertexArray bufferStateTracker.setBoundBufferObject(GL2GL3.GL_VERTEX_ARRAY_BINDING, {0}); +JavaEpilogue glPushClientAttrib bufferStateTracker.clear(); +JavaEpilogue glPushClientAttrib glStateTracker.pushAttrib(mask); +JavaEpilogue glPopClientAttrib bufferStateTracker.clear(); +JavaEpilogue glPopClientAttrib glStateTracker.popAttrib(); + +JavaPrologue glDeleteBuffers bufferObjectTracker.notifyBuffersDeleted({0}, {1}); BufferObjectKind Array glColorPointer BufferObjectKind Array glEdgeFlagPointer @@ -532,12 +635,23 @@ BufferObjectKind Array glVertexPointer BufferObjectKind Array glVertexAttribPointer BufferObjectKind Array glVertexAttribPointerARB BufferObjectKind Array glVertexAttribPointerNV +BufferObjectKind Array glVertexAttribIPointer +BufferObjectKind Array glVertexAttribLPointer BufferObjectKind Array glVertexWeightPointerEXT BufferObjectKind Array glWeightPointerARB BufferObjectKind Element glDrawElements +BufferObjectKind Element glDrawElementsBaseVertex +BufferObjectKind Element glDrawElementsInstanced +BufferObjectKind Element glDrawElementsInstancedBaseInstance +BufferObjectKind Element glDrawElementsInstancedBaseVertex +BufferObjectKind Element glDrawElementsInstancedBaseVertexBaseInstance BufferObjectKind Element glDrawRangeElements -BufferObjectKind Element glDrawRangeElementsEXT +BufferObjectKind Element glDrawRangeElementsBaseVertex + +BufferObjectKind Indirect glDrawArraysIndirect +BufferObjectKind Indirect glDrawElementsIndirect +BufferObjectKind Indirect glMultiDrawArraysIndirect # There are no PBOs in the embedded OpenGL variants right now BufferObjectKind UnpackPixel glBitmap @@ -588,9 +702,20 @@ BufferObjectKind PackPixel glReadPixels # FIXME: some of these are really the bare minimum and won't catch # many classes of errors. Should extend the DebugGL to perform much # more error checking with e.g. glDrawElements. -RangeCheck glColorPointer 3 1 -RangeCheck glDrawElements 3 {1} -RangeCheck glDrawRangeElements 5 {3} +RangeCheck glColorPointer 3 1 + +RangeCheck glDrawElements 3 {1} +RangeCheck glDrawElementsBaseVertex 3 {1} +RangeCheck glDrawElementsInstanced 3 {1} +RangeCheck glDrawElementsInstancedBaseInstance 3 {1} +RangeCheck glDrawElementsInstancedBaseVertex 3 {1} +RangeCheck glDrawElementsInstancedBaseVertexBaseInstance 3 {1} +RangeCheck glDrawRangeElements 5 {3} +RangeCheck glDrawRangeElementsBaseVertex 5 {3} + +RangeCheck glDrawArraysIndirect 1 1 +RangeCheck glDrawElementsIndirect 2 1 + RangeCheck glEdgeFlagPointer 1 1 RangeCheck glElementPointerATI 1 1 RangeCheck glFogCoordPointer 2 1 @@ -604,6 +729,8 @@ RangeCheck glTexCoordPointer 3 1 RangeCheck glVariantPointerEXT 3 1 RangeCheck glVertexPointer 3 1 RangeCheck glVertexAttribPointer 5 1 +RangeCheck glVertexAttribIPointer 4 1 +RangeCheck glVertexAttribLPointer 4 1 RangeCheck glVertexAttribPointerARB 5 1 RangeCheck glWeightPointerARB 3 1 @@ -670,78 +797,107 @@ RangeCheck glDeleteVertexArraysAPPLE 1 {0} # Javadoc for the GL class ClassJavadoc GL /** -ClassJavadoc GL * <P> Common interface containing the subset of all profiles, GL3bc, GL3, GL2, GLES1 and GLES2.<br> -ClassJavadoc GL * This interface reflects common data types, texture and framebuffer functionality.</P> +ClassJavadoc GL * <p> Common interface containing the subset of all profiles, GL3bc, GL3, GL2, GLES1 and GLES2.<br/> +ClassJavadoc GL * This interface reflects common data types, texture and framebuffer functionality.</p> ClassJavadoc GL */ ClassJavadoc GL2ES1 /** -ClassJavadoc GL2ES1 * <P> -ClassJavadoc GL2ES1 * Interface containing the common subset of GL2 and GLES1.<br> -ClassJavadoc GL2ES1 * This interface reflects only the fixed functionality of OpenGL<br> -ClassJavadoc GL2ES1 * </P> +ClassJavadoc GL2ES1 * <p> +ClassJavadoc GL2ES1 * Interface containing the common subset of GL2 and GLES1.<br/> +ClassJavadoc GL2ES1 * This interface reflects only the fixed functionality of OpenGL<br/> +ClassJavadoc GL2ES1 * </p> ClassJavadoc GL2ES1 */ ClassJavadoc GL2ES2 /** -ClassJavadoc GL2ES2 * <P> -ClassJavadoc GL2ES2 * Interface containing the common subset of GL3, GL2 and GLES2.<br> -ClassJavadoc GL2ES2 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br> -ClassJavadoc GL2ES2 * </P> +ClassJavadoc GL2ES2 * <p> +ClassJavadoc GL2ES2 * Interface containing the common subset of GL3, GL2 and GLES2.<br/> +ClassJavadoc GL2ES2 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> +ClassJavadoc GL2ES2 * This interface is almost GLES2 complete.<br/> +ClassJavadoc GL2ES2 * </p> ClassJavadoc GL2ES2 */ +ClassJavadoc GL2ES3 /** +ClassJavadoc GL2ES3 * <p> +ClassJavadoc GL2ES3 * Interface containing the common subset of core GL2 and GLES3 (OpenGL ES 3.0).<br/> +ClassJavadoc GL2ES3 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> +ClassJavadoc GL2ES3 * This interface is not GLES3 complete and merely exist to avoid duplicated definitions.<br/> +ClassJavadoc GL2ES3 * </p> +ClassJavadoc GL2ES3 */ + +ClassJavadoc GL3ES3 /** +ClassJavadoc GL3ES3 * <p> +ClassJavadoc GL3ES3 * Interface containing the common subset of core GL3 (OpenGL 3.1+) and GLES3 (OpenGL ES 3.0).<br/> +ClassJavadoc GL3ES3 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> +ClassJavadoc GL3ES3 * This interface is almost GLES3 complete, lacking <code>GL_ARB_ES3_compatibility</code> extension.<br/> +ClassJavadoc GL3ES3 * </p> +ClassJavadoc GL3ES3 */ + +ClassJavadoc GL4ES3 /** +ClassJavadoc GL4ES3 * <p> +ClassJavadoc GL4ES3 * Interface containing the common subset of core GL4 (OpenGL 4.0+) and GLES3 (OpenGL ES 3.0).<br/> +ClassJavadoc GL4ES3 * This interface reflects only the programmable shader functionality of desktop and embedded OpenGL<br/> +ClassJavadoc GL4ES3 * This interface is GLES3 complete w/o vendor extensions.<br/> +ClassJavadoc GL4ES3 * </p> +ClassJavadoc GL4ES3 */ + ClassJavadoc GL2GL3 /** -ClassJavadoc GL2GL3 * <P> -ClassJavadoc GL2GL3 * Interface containing the common subset of core GL3 (OpenGL 3.1+) and GL2 (OpenGL 3.0), -ClassJavadoc GL2GL3 * also known as the OpenGL 3.0 forward compatible, non deprecated subset.<br> -ClassJavadoc GL2GL3 * This interface reflects only the programmable shader functionality of desktop OpenGL<br> -ClassJavadoc GL2GL3 * </P> +ClassJavadoc GL2GL3 * <p> +ClassJavadoc GL2GL3 * Interface containing the common subset of core GL3 (OpenGL 3.1+) and GL2, +ClassJavadoc GL2GL3 * also known as the OpenGL 3.0 forward compatible, non deprecated subset.<br/> +ClassJavadoc GL2GL3 * This interface reflects only the programmable shader functionality of desktop OpenGL<br/> +ClassJavadoc GL2GL3 * </p> ClassJavadoc GL2GL3 */ ClassJavadoc GL2 /** -ClassJavadoc GL2 * <P> -ClassJavadoc GL2 * This interface contains all core desktop OpenGL methods through -ClassJavadoc GL2 * version 3.0, inclusive, as well as most of it's extensions defined at the -ClassJavadoc GL2 * time of this specification. Early OpenGL extensions whose functionality -ClassJavadoc GL2 * was incorporated into core OpenGL by version 3.0, inclusive, are specifically -ClassJavadoc GL2 * excluded.<br> -ClassJavadoc GL2 * Note: OpenGL 3.0 is the last subsumed version in the specification. -ClassJavadoc GL2 * You need to use a {@link GL3} or {@link GL3bc} OpenGL 3.1+ context to benefit -ClassJavadoc GL2 * from new functionality and versions. -ClassJavadoc GL2 * </P> +ClassJavadoc GL2 * <p> +ClassJavadoc GL2 * This interface contains all OpenGL [ 1.0 .. 3.0 ] methods, +ClassJavadoc GL2 * as well as most of it's extensions defined at the time of this specification. +ClassJavadoc GL2 * </p> +ClassJavadoc GL2 * <p> +ClassJavadoc GL2 * OpenGL extensions whose functionality was incorporated into core OpenGL ≤ 3.0, +ClassJavadoc GL2 * are subsumed into the core namespace.</p> +ClassJavadoc GL2 * </p> ClassJavadoc GL2 */ +ClassJavadoc GL3 /** +ClassJavadoc GL3 * <p>This interface contains all OpenGL [ 3.1 .. 3.3 ] <i>core</i> methods, +ClassJavadoc GL3 * as well as most of it's extensions defined at the time of this specification.</p> +ClassJavadoc GL3 * <p>Note: OpenGL [ 3.1 .. 3.3 ] core profile does not includes fixed point functionality.</p> +ClassJavadoc GL3 */ + ClassJavadoc GL3bc /** -ClassJavadoc GL3bc * <P> -ClassJavadoc GL3bc * This interface contains the OpenGL 3.x compatibility profile, ie includes all methods -ClassJavadoc GL3bc * as defined in {@link GL2} and {@link GL3}.<br> -ClassJavadoc GL3bc * </P> +ClassJavadoc GL3bc * <p>This interface contains all OpenGL [ 3.1 .. 3.3 ] <i>compatibility</i> methods, +ClassJavadoc GL3bc * as well as most of it's extensions defined at the time of this specification.</p> +ClassJavadoc GL3bc * <p>Note: OpenGL [ 3.1 .. 3.3 ] compatibility profile does includes fixed point functionality.</p> ClassJavadoc GL3bc */ -ClassJavadoc GL3 /** -ClassJavadoc GL3 * <P> -ClassJavadoc GL3 * This interface contains all core, forward compatible, OpenGL methods starting from 3.1, -ClassJavadoc GL3 * inclusive, as well as most of it's extensions defined at the time of this specification.<br> -ClassJavadoc GL3 * Note: OpenGL 3.0 forward compatible, non deprecated functionality is included in the -ClassJavadoc GL3 * 3.1 specification, hence the {@link GL2GL3} implemented interface.<br> -ClassJavadoc GL3 * Note: OpenGL 3.1 forward compatible no more includes fixed point functionality. -ClassJavadoc GL3 * </P> -ClassJavadoc GL3 */ +ClassJavadoc GL4 /** +ClassJavadoc GL4 * <p>This interface contains all OpenGL [ 4.0 .. 4.3 ] <i>core</i> methods, +ClassJavadoc GL4 * as well as most of it's extensions defined at the time of this specification.</p> +ClassJavadoc GL4 * <p>Note: OpenGL [ 4.0 .. 4.3 ] core profile does not includes fixed point functionality.</p> +ClassJavadoc GL4 */ + +ClassJavadoc GL4bc /** +ClassJavadoc GL4bc * <p>This interface contains all OpenGL [ 4.0 .. 4.3 ] <i>compatibility</i> profile, +ClassJavadoc GL4bc * as well as most of it's extensions defined at the time of this specification.</p> +ClassJavadoc GL4bc * <p>Note: OpenGL [ 4.0 .. 4.3 ] compatibility profile does includes fixed point functionality.</p> +ClassJavadoc GL4bc */ ClassJavadoc GLES1 /** -ClassJavadoc GLES1 * <P> -ClassJavadoc GLES1 * This interface contains all core embedded OpenGL methods of ES 1.x, with x >= 0, -ClassJavadoc GLES1 * inclusive, as well as most of it's extensions defined at the -ClassJavadoc GLES1 * time of this specification. -ClassJavadoc GLES1 * </P> +ClassJavadoc GLES1 * <p>This interface contains all OpenGL ES [ 1.0 .. 1.1 ] methods, +ClassJavadoc GLES1 * as well as most of it's extensions defined at the time of this specification.</p> ClassJavadoc GLES1 */ ClassJavadoc GLES2 /** -ClassJavadoc GLES2 * <P> -ClassJavadoc GLES2 * This interface contains all core embedded OpenGL methods of ES 2.x, with x >= 0, -ClassJavadoc GLES2 * inclusive, as well as most of it's extensions defined at the -ClassJavadoc GLES2 * time of this specification. -ClassJavadoc GLES2 * </P> +ClassJavadoc GLES2 * <p>This interface contains all OpenGL ES 2.0 methods, +ClassJavadoc GLES2 * as well as most of it's extensions defined at the time of this specification.</p> ClassJavadoc GLES2 */ +ClassJavadoc GLES3 /** +ClassJavadoc GLES3 * <p>This interface contains all OpenGL ES 3.0 methods, +ClassJavadoc GLES3 * as well as most of it's extensions defined at the time of this specification.</p> +ClassJavadoc GLES3 */ + # Javadoc for the EGL class ClassJavadoc EGL /** ClassJavadoc EGL * Provides access to the embedded-specific OpenGL vendor extensions. @@ -773,11 +929,3 @@ ClassJavadoc XVisualInfo * extensions. No other access is provided to these dat ClassJavadoc XVisualInfo * this wrapper is not useful to end users, though it is used in the implementation. ClassJavadoc XVisualInfo */ -# Custom code for querying extensions and exposing -# wglAllocateMemoryNV/glXAllocateMemoryNV -CustomJavaCode GL2GL3 /** -CustomJavaCode GL2GL3 * Provides platform-independent access to the <code>wglAllocateMemoryNV</code> / -CustomJavaCode GL2GL3 * <code>glXAllocateMemoryNV</code> extension. -CustomJavaCode GL2GL3 */ -CustomJavaCode GL2GL3 public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3); - diff --git a/make/config/jogl/gl-desktop.cfg b/make/config/jogl/gl-desktop.cfg index a91f5ac5b..244271468 100644 --- a/make/config/jogl/gl-desktop.cfg +++ b/make/config/jogl/gl-desktop.cfg @@ -1,11 +1,6 @@ # This .cfg file provides common options used by the desktop OpenGL # implementation on all platforms. -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -GLHeader GL/gl.h -GLHeader GL/glext.h - #Include gl-desktop-tracker.cfg diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg index 2a7b64dd3..b73b1a731 100644 --- a/make/config/jogl/gl-es1.cfg +++ b/make/config/jogl/gl-es1.cfg @@ -30,13 +30,6 @@ EmitProcAddressTable true ProcAddressTableClassName GLES1ProcAddressTable GetProcAddressTableExpr ((GLES1ProcAddressTable)_context.getGLProcAddressTable()) -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -GLHeader GLES/gl.h -GLHeader GLES/glext.h -GLHeader GL/gl.h -GLHeader GL/glext.h - # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or # depend on the presence of an import library for a particular device @@ -49,11 +42,6 @@ LocalProcAddressCallingConvention __ALL__ GL_APIENTRY # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true -# Ignore certain extensions that will be picked up by the dynamic -# lookup mechanism anyway if they are present -IgnoreExtension GL_OES_fixed_point -IgnoreExtension GL_OES_single_precision - # Add PixelStorei StateTracker # # Add input validation to glPixelStorei, just to be sure. diff --git a/make/config/jogl/gl-es2.cfg b/make/config/jogl/gl-es3-impl.cfg index 8b6152bd0..9682e49af 100644 --- a/make/config/jogl/gl-es2.cfg +++ b/make/config/jogl/gl-es3-impl.cfg @@ -1,40 +1,38 @@ -# This .cfg file is used to generate the GL interface and implementing class. +# This .cfg file is used to generate the GL implementing class. JavaOutputDir gensrc/classes -NativeOutputDir gensrc/native/jogl/es2 +NativeOutputDir gensrc/native/jogl/es3 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GLES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GLES3.java ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -Package javax.media.opengl -Style InterfaceAndImpl -JavaClass GLES2 -#Extends GLES2 GLBase -#Extends GLES2 GL -Extends GLES2 GL2ES2 -ImplPackage jogamp.opengl.es2 -ImplJavaClass GLES2Impl -Implements GLES2Impl GLBase -Implements GLES2Impl GL -Implements GLES2Impl GL2ES2 +Style ImplOnly +ImplPackage jogamp.opengl.es3 +ImplJavaClass GLES3Impl +Implements GLES3Impl GLBase +Implements GLES3Impl GL +Implements GLES3Impl GL2ES2 +Implements GLES3Impl GLES2 +Implements GLES3Impl GL2ES3 +Implements GLES3Impl GL3ES3 +Implements GLES3Impl GL4ES3 +Implements GLES3Impl GLES3 HierarchicalNativeOutput false Include gl-common.cfg Include gl-common-extensions.cfg -Include gl2_es2-common.cfg +Include gl2_es3-common.cfg +Include gl2_es2-CustomJavaCode.cfg -RenameExtensionIntoCore GL_OES_texture_3D -RenameExtensionIntoCore GL_OES_get_program_binary +ForceExtension GL_ARB_ES3_compatibility EmitProcAddressTable true -ProcAddressTableClassName GLES2ProcAddressTable -GetProcAddressTableExpr ((GLES2ProcAddressTable)_context.getGLProcAddressTable()) - -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -GLHeader GLES2/gl2.h -GLHeader GLES2/gl2ext.h -GLHeader GL/gl.h -GLHeader GL/glext.h +ProcAddressTableClassName GLES3ProcAddressTable +GetProcAddressTableExpr ((GLES3ProcAddressTable)_context.getGLProcAddressTable()) # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or @@ -50,18 +48,12 @@ TagNativeBinding true # Add PixelStorei StateTracker # -# Add input validation to glPixelStorei, just to be sure. -CustomJavaCode GLES2Impl private static final int params_offset = 0; // just a helper for JavaPrologue .. +CustomJavaCode GLES3Impl private static final int params_offset = 0; // just a helper for JavaPrologue .. -JavaPrologue glPixelStorei if (pname != GL_PACK_ALIGNMENT && pname != GL_UNPACK_ALIGNMENT) { -JavaPrologue glPixelStorei throw new GLException("Unsupported pixel store parameter name 0x" + Integer.toHexString(pname)); -JavaPrologue glPixelStorei } JavaPrologue glPixelStorei glStateTracker.setInt(pname, param); JavaPrologue glGetIntegerv if ( glStateTracker.getInt(pname, params, params_offset) ) { return; } -IncludeAs CustomJavaCode GLES2 gl-if-CustomJavaCode-gles2.java - CustomCCode #include <stdio.h> /* android */ CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in CustomCCode "glext.h" are parsed. */ @@ -69,19 +61,24 @@ CustomCCode #define GL_GLEXT_PROTOTYPES CustomCCode /* Include the OpenGL headers */ CustomCCode /* #define GL_APICALL __declspec(dllimport) */ -CustomCCode #include <GLES2/gl2.h> +CustomCCode #include <GLES3/gl3.h> +CustomCCode #include <GLES3/gl3ext.h> CustomCCode #include <GLES2/gl2ext.h> CustomCCode #include <stdlib.h> -IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-common.java -IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gles2.java -IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-embedded.java -IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gl2_es2.java -IncludeAs CustomCCode gl-impl-CustomCCode-gles2.c - -Import javax.media.opengl.GLES1 -Import javax.media.opengl.GLES2 -Import javax.media.opengl.GL2 +IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-common.java +IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-gles3.java +IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-embedded.java +IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-gl2_es2.java +IncludeAs CustomCCode gl-impl-CustomCCode-gles3.c + +Import javax.media.opengl.GLBase +Import javax.media.opengl.GL +Import javax.media.opengl.GL2ES2 +Import javax.media.opengl.GL2ES3 +Import javax.media.opengl.GL3ES3 +Import javax.media.opengl.GL4ES3 +Import javax.media.opengl.GLES3 Import javax.media.opengl.GLArrayData Import javax.media.opengl.GLUniformData Import com.jogamp.common.nio.Buffers diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg index ae77b2eb8..6ccbace44 100644 --- a/make/config/jogl/gl-gl4bc.cfg +++ b/make/config/jogl/gl-gl4bc.cfg @@ -5,6 +5,9 @@ NativeOutputDir gensrc/native/jogl/gl4 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java @@ -22,6 +25,9 @@ JavaClass GL4bc #Extends GL4bc GL #Extends GL4bc GL2ES1 #Extends GL4bc GL2ES2 +#Extends GL4bc GL2ES3 +#Extends GL4bc GL3ES3 +#Extends GL4bc GL4ES3 #Extends GL4bc GL2GL3 #Extends GL4bc GL2 #Extends GL4bc GL3 @@ -33,6 +39,9 @@ Implements GL4bcImpl GLBase Implements GL4bcImpl GL Implements GL4bcImpl GL2ES1 Implements GL4bcImpl GL2ES2 +Implements GL4bcImpl GL2ES3 +Implements GL4bcImpl GL3ES3 +Implements GL4bcImpl GL4ES3 Implements GL4bcImpl GL2GL3 Implements GL4bcImpl GL2 Implements GL4bcImpl GL3 @@ -43,16 +52,57 @@ Include gl-common.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg Include gl3-desktop.cfg -Include gl2_es2-common.cfg +Include gl3-common.cfg +Include gl2_es2-CustomJavaCode.cfg + +# +# Manually implement following GL functions to be redirected +# to GLBufferObjectTracker. +# +ManuallyImplement glNamedBufferDataEXT +ForceProcAddressGen glNamedBufferDataEXT +MethodJavadoc glNamedBufferDataEXT * <p> +MethodJavadoc glNamedBufferDataEXT * Throws a {@link GLException} if GL-function constraints are not met or the native GL-function fails. +MethodJavadoc glNamedBufferDataEXT * </p> +MethodJavadoc glNamedBufferDataEXT * <p> +MethodJavadoc glNamedBufferDataEXT * @throws GLException if size is less-than zero +MethodJavadoc glNamedBufferDataEXT * @throws GLException if a native GL-Error occurs +MethodJavadoc glNamedBufferDataEXT * </p> -# Manually implement glMapNamedBufferEXT as the size of the returned buffer -# can only be computed by calling another routine ManuallyImplement glMapNamedBufferEXT ForceProcAddressGen glMapNamedBufferEXT -JavaEpilogue glNamedBufferDataEXT bufferSizeTracker.setDirectStateBufferSize({0}, this, {1}); +MethodJavadoc glMapNamedBufferEXT * <p> +MethodJavadoc glMapNamedBufferEXT * Throws a {@link GLException} if GL-function constraints are not met. +MethodJavadoc glMapNamedBufferEXT * </p> +MethodJavadoc glMapNamedBufferEXT * <p> +MethodJavadoc glMapNamedBufferEXT * Returns {@link GL2#mapNamedBuffer(int, int)}'s {@link GLBufferStorage#getMappedBuffer()}. +MethodJavadoc glMapNamedBufferEXT * </p> +MethodJavadoc glMapNamedBufferEXT * <p> +MethodJavadoc glMapNamedBufferEXT * @throws GLException if buffer is not tracked +MethodJavadoc glMapNamedBufferEXT * @throws GLException if buffer is already mapped +MethodJavadoc glMapNamedBufferEXT * @throws GLException if buffer has invalid store size, i.e. less-than zero +MethodJavadoc glMapNamedBufferEXT * </p> + +ManuallyImplement glMapNamedBufferRangeEXT +ForceProcAddressGen glMapNamedBufferRangeEXT +MethodJavadoc glMapNamedBufferRangeEXT * <p> +MethodJavadoc glMapNamedBufferRangeEXT * Throws a {@link GLException} if GL-function constraints are not met. +MethodJavadoc glMapNamedBufferRangeEXT * </p> +MethodJavadoc glMapNamedBufferRangeEXT * <p> +MethodJavadoc glMapNamedBufferRangeEXT * Returns {@link GL2#mapNamedBufferRange(int, long, long, int)}'s {@link GLBufferStorage#getMappedBuffer()}. +MethodJavadoc glMapNamedBufferRangeEXT * </p> +MethodJavadoc glMapNamedBufferRangeEXT * <p> +MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer is not tracked +MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer is already mapped +MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer has invalid store size, i.e. less-than zero +MethodJavadoc glMapNamedBufferRangeEXT * @throws GLException if buffer mapping range does not fit, incl. offset +MethodJavadoc glMapNamedBufferRangeEXT * </p> + +ManuallyImplement glUnmapNamedBufferEXT +ForceProcAddressGen glUnmapNamedBufferEXT # Manuall implement glDebugMessageCallback* using the proc address resolver -ForceProcAddressGen glDebugMessageCallbackARB +ForceProcAddressGen glDebugMessageCallback ForceProcAddressGen glDebugMessageCallbackAMD # Force all of the methods to be emitted using dynamic linking so we @@ -74,6 +124,8 @@ TagNativeBinding true # Ignore extensions that are already picked up via the GL2ES1 interface IgnoreExtension GL_EXT_point_parameters +IncludeAs CustomJavaCode GL4bc gl4bc-common-cpubufferJavaCode.java + # Add PixelStorei StateTracker CustomJavaCode GL4bcImpl private static final int params_offset = 0; // just a helper for JavaPrologue .. @@ -81,23 +133,42 @@ JavaPrologue glPixelStorei glStateTracker.setInt(pname, param); JavaPrologue glGetIntegerv if ( glStateTracker.getInt(pname, params, params_offset) ) { return; } -CustomJavaCode GL4bcImpl public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { -CustomJavaCode GL4bcImpl glFrustum((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); } +JavaPrologue glFrustumf if ( !_context.hasFP32CompatAPI() ) { +JavaPrologue glFrustumf glFrustum((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); +JavaPrologue glFrustumf return; +JavaPrologue glFrustumf } + +JavaPrologue glOrthof if ( !_context.hasFP32CompatAPI() ) { +JavaPrologue glOrthof glOrtho((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); +JavaPrologue glOrthof return; +JavaPrologue glOrthof } -CustomJavaCode GL4bcImpl public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) { -CustomJavaCode GL4bcImpl glOrtho((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); } +JavaPrologue glDepthRangef if ( !_context.isGLES2Compatible() && !_context.hasFP32CompatAPI() ) { +JavaPrologue glDepthRangef glDepthRange( (double)zNear, (double)zFar ); +JavaPrologue glDepthRangef return; +JavaPrologue glDepthRangef } + +JavaPrologue glClearDepthf if ( !_context.isGLES2Compatible() && !_context.hasFP32CompatAPI() ) { +JavaPrologue glClearDepthf glClearDepth( (double)depth ); +JavaPrologue glClearDepthf return; +JavaPrologue glClearDepthf } Include gl-headers.cfg Include gl3ext-headers.cfg IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-common.java IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-gl4bc.java -IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-desktop.java IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-gl2_es2.java + IncludeAs CustomCCode gl-impl-CustomCCode-gl4bc.c Import javax.media.opengl.GLES1 Import javax.media.opengl.GLES2 +Import javax.media.opengl.GL2ES1 +Import javax.media.opengl.GL2ES2 +Import javax.media.opengl.GL2ES3 +Import javax.media.opengl.GL3ES3 +Import javax.media.opengl.GL4ES3 Import javax.media.opengl.GL2GL3 Import javax.media.opengl.GL2 Import javax.media.opengl.GL3 diff --git a/make/config/jogl/gl-headers.cfg b/make/config/jogl/gl-headers.cfg index b80630c63..0916fa348 100644 --- a/make/config/jogl/gl-headers.cfg +++ b/make/config/jogl/gl-headers.cfg @@ -1,7 +1,6 @@ CustomCCode #include <gluegen_stdint.h> CustomCCode #include <stdio.h> /* android */ -CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in -CustomCCode "glext.h" are parsed. */ +CustomCCode /** Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes are parsed. */ CustomCCode #define GL_GLEXT_PROTOTYPES CustomCCode #if defined(_WIN32) CustomCCode #define WIN32_LEAN_AND_MEAN @@ -16,12 +15,12 @@ CustomCCode #define WGL_GLEXT_PROTOTYPES CustomCCode /* Include the OpenGL headers */ CustomCCode #include <GL/gl.h> CustomCCode #include <GL/wglext.h> -CustomCCode #elif defined(macosx) +CustomCCode #elif defined(__APPLE__) CustomCCode #include <inttypes.h> CustomCCode #include <stdlib.h> CustomCCode /* Include the OpenGL headers */ CustomCCode #include <GL/gl.h> -CustomCCode #include </usr/include/machine/types.h> +CustomCCode #include <machine/types.h> CustomCCode /* Provide Windows typedefs */ CustomCCode typedef void* LPVOID; CustomCCode typedef unsigned int* PUINT; diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl2_gl3.java b/make/config/jogl/gl-if-CustomJavaCode-es3.java index 97fd6c4a6..88c557f11 100644 --- a/make/config/jogl/gl-if-CustomJavaCode-gl2_gl3.java +++ b/make/config/jogl/gl-if-CustomJavaCode-es3.java @@ -8,3 +8,7 @@ public static final long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFL ; /** Part of <code>GL_ARB_shader_image_load_store</code> */ public static final int GL_ALL_BARRIER_BITS = 0xFFFFFFFF ; +public boolean isPBOPackBound(); + +public boolean isPBOUnpackBound(); + diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl.java b/make/config/jogl/gl-if-CustomJavaCode-gl.java index 9ea4f98b4..f9f33eec9 100644 --- a/make/config/jogl/gl-if-CustomJavaCode-gl.java +++ b/make/config/jogl/gl-if-CustomJavaCode-gl.java @@ -57,3 +57,11 @@ earmarked for ES 3.0 (hence kept in GL while fixing Bug 590) */ public static final int GL_HALF_FLOAT = 0x140B; + /** Part of <code>GL_VERSION_1_4</code>, <code>GL_ES_VERSION_2_0</code>, <code>GL_OES_required_internalformat</code>. */ + public static final int GL_DEPTH_COMPONENT16 = 0x81A5; + /** Part of <code>GL_VERSION_1_0</code>, <code>GL_OES_element_index_uint</code>, <code>GL_ES_VERSION_2_0</code> */ + public static final int GL_UNSIGNED_INT = 0x1405; + /** Part of <code>GL_VERSION_1_0</code>, <code>GL_ES_VERSION_2_0</code> */ + public static final int GL_UNSIGNED_SHORT = 0x1403; + + diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl2.java b/make/config/jogl/gl-if-CustomJavaCode-gl2.java new file mode 100644 index 000000000..283f72da1 --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl2.java @@ -0,0 +1,40 @@ + + // + // GLBufferObjectTracker Redirects + // + + /** + * Returns the {@link GLBufferStorage} instance as mapped via OpenGL's native {@link GL2#glMapNamedBufferEXT(int, int) glMapNamedBufferEXT(..)} implementation. + * <p> + * Throws a {@link GLException} if GL-function constraints are not met. + * </p> + * <p> + * {@link GL2#glMapNamedBufferEXT(int, int)} wrapper calls this method and returns {@link GLBufferStorage#getMappedBuffer()}. + * </p> + * @param bufferName denotes the buffer + * @param access the mapping access mode + * @throws GLException if buffer is not tracked + * @throws GLException if buffer is already mapped + * @throws GLException if buffer has invalid store size, i.e. less-than zero + */ + public GLBufferStorage mapNamedBuffer(int bufferName, int access) throws GLException; + + /** + * Returns the {@link GLBufferStorage} instance as mapped via OpenGL's native {@link GL2#glMapNamedBufferRangeEXT(int, long, long, int) glMapNamedBufferRangeEXT(..)} implementation. + * <p> + * Throws a {@link GLException} if GL-function constraints are not met. + * </p> + * <p> + * {@link GL2#glMapNamedBufferRangeEXT(int, long, long, int)} wrapper calls this method and returns {@link GLBufferStorage#getMappedBuffer()}. + * </p> + * @param bufferName denotes the buffer + * @param offset offset of the mapped buffer's storage + * @param length length of the mapped buffer's storage + * @param access the mapping access mode + * @throws GLException if buffer is not tracked + * @throws GLException if buffer is already mapped + * @throws GLException if buffer has invalid store size, i.e. less-than zero + * @throws GLException if buffer mapping range does not fit, incl. offset + */ + public GLBufferStorage mapNamedBufferRange(final int bufferName, final long offset, final long length, final int access) throws GLException; + diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java b/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java index 4522d34c8..5ad235de5 100644 --- a/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java +++ b/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java @@ -39,10 +39,21 @@ * <br> Calls <code> void {@native glDepthRange}(GLclampd zNear, GLclampd zFar); </code> if no native implementation is available. */ public void glDepthRangef(float zNear, float zFar); + public void glDepthRange(double zNear, double zFar); + /** Entry point to C language function: * <code> void {@native glClearDepthf}(GLclampf depth); </code> * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. * <br> Calls <code> void {@native glClearDepth}(GLclampd depth); </code> if no native implementation is available. */ public void glClearDepthf(float depth); + public void glClearDepth( double depth ); + + public void glVertexAttribPointer(GLArrayData array); + + public void glUniform(GLUniformData data); + + /** Part of <code>GL_VERSION_1_0</code>, <code>GL_ES_VERSION_2_0</code>, <code>GL_ANGLE_depth_texture</code> */ + public static final int GL_DEPTH_COMPONENT = 0x1902; + /** End: GL_ARB_ES2_compatibility functions, which are part of ES2 core as well */ diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl_compat.java b/make/config/jogl/gl-if-CustomJavaCode-gl_compat.java new file mode 100644 index 000000000..22ae54cbe --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl_compat.java @@ -0,0 +1,20 @@ + +/** + * Part of <code>GL_NV_vertex_array_range</code>. + * <p> + * Provides platform-independent access to the <code>wglAllocateMemoryNV</code> / + * <code>glXAllocateMemoryNV</code>. + * </p> + */ +public java.nio.ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority); + +/** + * Part of <code>GL_NV_vertex_array_range</code>. + * <p> + * Provides platform-independent access to the <code>wglFreeMemoryNV</code> / + * <code>glXFreeMemoryNV</code>. + * </p> + */ +public void glFreeMemoryNV(java.nio.ByteBuffer pointer); + + diff --git a/make/config/jogl/gl-if-CustomJavaCode-gles2.java b/make/config/jogl/gl-if-CustomJavaCode-gles2.java deleted file mode 100644 index ea40f6329..000000000 --- a/make/config/jogl/gl-if-CustomJavaCode-gles2.java +++ /dev/null @@ -1,3 +0,0 @@ - - public static final int GL_NVIDIA_PLATFORM_BINARY_NV = 0x890B; - diff --git a/make/config/jogl/gl-if-es2.cfg b/make/config/jogl/gl-if-es2.cfg new file mode 100644 index 000000000..052722f40 --- /dev/null +++ b/make/config/jogl/gl-if-es2.cfg @@ -0,0 +1,33 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/es2 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GLES2 +#Extends GLES2 GLBase +#Extends GLES2 GL +Extends GLES2 GL2ES2 +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl2_es2-common.cfg +Include gl2_es2-CustomJavaCode.cfg + +IncludeAs CustomJavaCode GLES2 gl2_es1-common-cpubufferJavaCode.java +IncludeAs CustomJavaCode GLES2 gl2_es2-common-cpubufferJavaCode.java + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +# dummy procaddress config / force procaddress for comments +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff +ForceProcAddressGen __ALL__ + +CustomJavaCode GLES2 public static final int GL_NVIDIA_PLATFORM_BINARY_NV = 0x890B; + diff --git a/make/config/jogl/gl-if-es3.cfg b/make/config/jogl/gl-if-es3.cfg new file mode 100644 index 000000000..66fd52597 --- /dev/null +++ b/make/config/jogl/gl-if-es3.cfg @@ -0,0 +1,41 @@ +# This .cfg file is used to generate the GL interface. +JavaOutputDir gensrc/classes + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GLES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GLES3 +#Extends GLES3 GLBase +#Extends GLES3 GL +#Extends GLES3 GL2ES2 +#Extends GLES3 GL2ES3 +#Extends GLES3 GL3ES3 +Extends GLES3 GLES2 +Extends GLES3 GL4ES3 +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl2_es3-common.cfg +Include gl2_es2-CustomJavaCode.cfg + +IncludeAs CustomJavaCode GLES3 gl2_es2-common-cpubufferJavaCode.java +IncludeAs CustomJavaCode GLES3 gl2-common-cpubufferJavaCode.java + +ForceExtension GL_ARB_ES3_compatibility + +# dummy procaddress config / force procaddress for comments +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff +ForceProcAddressGen __ALL__ + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + diff --git a/make/config/jogl/gl-if-gl-ignores.cfg b/make/config/jogl/gl-if-gl-ignores.cfg index 25fbd5a6f..e6513cadb 100644 --- a/make/config/jogl/gl-if-gl-ignores.cfg +++ b/make/config/jogl/gl-if-gl-ignores.cfg @@ -13,6 +13,7 @@ DropUniqVendorExtensions IMG DropUniqVendorExtensions QCOM DropUniqVendorExtensions NV DropUniqVendorExtensions VIV +DropUniqVendorExtensions FJ IgnoreExtension GL_EXT_discard_framebuffer IgnoreExtension GL_OES_compressed_paletted_texture @@ -34,11 +35,14 @@ IgnoreExtension GL_EXT_multisampled_render_to_texture IgnoreExtension GL_EXT_framebuffer_multisample IgnoreExtension GL_OES_texture_half_float IgnoreExtension GL_OES_vertex_half_float -# IgnoreExtension GL_EXT_texture_storage IgnoreExtension GL_NV_draw_buffers IgnoreExtension GL_NV_fbo_color_attachments IgnoreExtension GL_OES_vertex_array_object IgnoreExtension GL_OES_texture_3D +IgnoreExtension GL_OES_surfaceless_context +IgnoreExtension GL_OES_required_internalformat +IgnoreExtension GL_EXT_unpack_subimage +IgnoreExtension GL_KHR_debug # includes GL_STATE_RESTORE, which hasn't the QCOM suffix IgnoreExtension GL_QCOM_extended_get @@ -46,12 +50,8 @@ Ignore GL_STATE_RESTORE # above ext mightbe subsumed, ignore the aliased ones Ignore GL_ACTIVE_PROGRAM -Ignore GL_ALPHA16F -Ignore GL_ALPHA32F -Ignore GL_ALPHA8 Ignore GL_ANY_SAMPLES_PASSED Ignore GL_ANY_SAMPLES_PASSED_CONSERVATIVE -Ignore GL_BGRA8 Ignore GL_BGRA8_EXT Ignore GL_BUFFER_OBJECT_EXT Ignore GL_COLOR_ATTACHMENT1 @@ -93,12 +93,6 @@ Ignore GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING Ignore GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT Ignore GL_INT_10_10_10_2 -Ignore GL_LUMINANCE16F -Ignore GL_LUMINANCE32F -Ignore GL_LUMINANCE8 -Ignore GL_LUMINANCE8_ALPHA8 -Ignore GL_LUMINANCE_ALPHA16F -Ignore GL_LUMINANCE_ALPHA32F Ignore GL_MAX_COLOR_ATTACHMENTS Ignore GL_MAX_DRAW_BUFFERS Ignore GL_PROGRAM_OBJECT_EXT @@ -108,15 +102,15 @@ Ignore GL_PROGRAM_SEPARABLE Ignore GL_QUERY_OBJECT_EXT Ignore GL_QUERY_RESULT Ignore GL_QUERY_RESULT_AVAILABLE +Ignore GL_R32F Ignore GL_R16F Ignore GL_R8 Ignore GL_RED Ignore GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES Ignore GL_RG +Ignore GL_RG32F Ignore GL_RG16F Ignore GL_RG8 -Ignore GL_RGB16F -Ignore GL_RGBA16F Ignore GL_SAMPLER_2D_SHADOW Ignore GL_SAMPLER_EXTERNAL_OES Ignore GL_SHADER_BINARY_DMP @@ -530,13 +524,9 @@ Ignore glFogxvOES Ignore glFramebufferVertexAttribArrayNV Ignore glFrustumf Ignore glFrustumfOES -#Ignore glGenerateMipmap -#Ignore glGenerateMipmapOES Ignore glGetActiveAttrib Ignore glGetActiveUniform Ignore glGetAttachedShaders -Ignore glGetClipPlanef -Ignore glGetClipPlanefOES Ignore glGetFixedv Ignore glGetFixedvOES Ignore glGetLightfv diff --git a/make/config/jogl/gl-if-gl.cfg b/make/config/jogl/gl-if-gl.cfg index 89233330a..5c9e4caa2 100644 --- a/make/config/jogl/gl-if-gl.cfg +++ b/make/config/jogl/gl-if-gl.cfg @@ -8,10 +8,11 @@ ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.jav HierarchicalNativeOutput false Include gl-common.cfg +Include gl-common-gpubufferonly.cfg Include gl-common-extensions.cfg Include gl-if-gl-ignores.cfg -Include gl-if-gl3-ignores.cfg -Include gl-if-gl4-ignores.cfg +Include gl-if-gl2_es2-ignores.cfg +Include gl-if-luminance-ignore.cfg JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl @@ -27,14 +28,6 @@ ProcAddressTableClassName DontGenerateProcAddressTableStuff GetProcAddressTableExpr DontGenerateProcAddressTableStuff ForceProcAddressGen __ALL__ -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined. -# This also gives a better API doc since it includes all extension names. -GLHeader GLES2/gl2.h -GLHeader GLES2/gl2ext.h -GLHeader GL/gl.h -GLHeader GL/glext.h - # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true diff --git a/make/config/jogl/gl-if-gl2.cfg b/make/config/jogl/gl-if-gl2.cfg index c58b73dfd..0120bd674 100644 --- a/make/config/jogl/gl-if-gl2.cfg +++ b/make/config/jogl/gl-if-gl2.cfg @@ -5,6 +5,7 @@ NativeOutputDir gensrc/native/jogl/gl2 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java @@ -25,6 +26,11 @@ Include gl-desktop.cfg Include gl-if-gl3-ignores.cfg Include gl-if-gl4-ignores.cfg +IncludeAs CustomJavaCode GL2 gl-if-CustomJavaCode-gl2.java +IncludeAs CustomJavaCode GL2 gl-if-CustomJavaCode-gl_compat.java +IncludeAs CustomJavaCode GL2 gl2_es2-common-cpubufferJavaCode.java +IncludeAs CustomJavaCode GL2 gl2-common-cpubufferJavaCode.java + # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true @@ -37,8 +43,5 @@ ForceProcAddressGen __ALL__ # Ignore extensions that are already picked up via the GL2ES1 interface IgnoreExtension GL_EXT_point_parameters -CustomJavaCode GL2 public boolean glIsPBOPackEnabled(); -CustomJavaCode GL2 public boolean glIsPBOUnpackEnabled(); - Include gl-headers.cfg diff --git a/make/config/jogl/gl-if-gl2_es1.cfg b/make/config/jogl/gl-if-gl2_es1.cfg index ad8bbea7d..b533e83c3 100644 --- a/make/config/jogl/gl-if-gl2_es1.cfg +++ b/make/config/jogl/gl-if-gl2_es1.cfg @@ -17,6 +17,7 @@ ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/ HierarchicalNativeOutput false Include gl-common.cfg Include gl-common-extensions.cfg +Include gl-if-luminance-ignore.cfg JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl @@ -39,11 +40,11 @@ IgnoreExtension GL_OES_EGL_image_external IgnoreExtension GL_OES_compressed_ETC1_RGB8_texture IgnoreExtension GL_OES_draw_texture -IgnoreExtension GL_OES_fixed_point IgnoreExtension GL_OES_matrix_get IgnoreExtension GL_OES_point_size_array IgnoreExtension GL_OES_query_matrix IgnoreExtension GL_OES_vertex_half_float +IgnoreExtension GL_OES_matrix_palette IgnoreExtension GL_EXT_debug_marker IgnoreExtension GL_EXT_debug_label @@ -55,11 +56,6 @@ IgnoreExtension GL_QCOM_extended_get Ignore GL_STATE_RESTORE Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET -Ignore glGetFixedv - -# Ignore OES variants of single precision floating point routines -IgnoreExtension GL_OES_single_precision - # Ignore fixed point versions of routines in ES 1.x core Ignore glAlphaFuncx Ignore glClearColorx @@ -68,18 +64,28 @@ Ignore glClipPlanex Ignore glColor4x Ignore glDepthRangex Ignore glFogx +Ignore glFogxv Ignore glFrustumx Ignore glGetClipPlanex +Ignore glGetFixedv +Ignore glGetLightxv +Ignore glGetMaterialxv +Ignore glGetTexEnvxv +Ignore glGetTexParameterxv Ignore glLightModelx +Ignore glLightModelxv Ignore glLightx +Ignore glLightxv Ignore glLineWidthx Ignore glLoadMatrixx Ignore glMaterialx +Ignore glMaterialxv Ignore glMultMatrixx Ignore glMultiTexCoord4x Ignore glNormal3x Ignore glOrthox Ignore glPointParameterx +Ignore glPointParameterxv Ignore glPointSizex Ignore glPolygonOffsetx Ignore glQueryMatrixx @@ -87,38 +93,31 @@ Ignore glRotatex Ignore glSampleCoveragex Ignore glScalex Ignore glTexEnvx +Ignore glTexEnvxv Ignore glTexGenx Ignore glTexParameterx +Ignore glTexParameterxv Ignore glTranslatex #heavy float/double array diff to GL2 Ignore glClipPlanef Ignore ^glGetClipPlanef(OES)? - + #impl diff Ignore ^glEGL.* -Ignore ^gl.*(xv)(OES)? -Ignore glTexGenxOES Ignore GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES -Ignore glLoadPaletteFromModelViewMatrixOES -Ignore glGetFixedv CustomJavaCode GL2ES1 public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val); CustomJavaCode GL2ES1 public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar); +IncludeAs CustomJavaCode GL2ES1 gl2_es1-common-cpubufferJavaCode.java + # dummy procaddress config / force procaddress for comments EmitProcAddressTable false ProcAddressTableClassName DontGenerateProcAddressTableStuff GetProcAddressTableExpr DontGenerateProcAddressTableStuff ForceProcAddressGen __ALL__ -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -GLHeader GLES/gl.h -GLHeader GLES/glext.h -GLHeader GL/gl.h -GLHeader GL/glext.h - # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true diff --git a/make/config/jogl/gl-if-gl2_es2-ignores.cfg b/make/config/jogl/gl-if-gl2_es2-ignores.cfg new file mode 100644 index 000000000..f08d8a51b --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es2-ignores.cfg @@ -0,0 +1,48 @@ +# Ignore all ES 2.X only stuff .. +DropUniqVendorExtensions ANGLE +DropUniqVendorExtensions ARM +DropUniqVendorExtensions APPLE +DropUniqVendorExtensions ATI +DropUniqVendorExtensions IMG +DropUniqVendorExtensions QCOM +DropUniqVendorExtensions NV +DropUniqVendorExtensions VIV + +Ignore glEGL.* + +IgnoreExtension GL_AMD_compressed_3DC_texture +IgnoreExtension GL_AMD_compressed_ATC_texture +IgnoreExtension GL_AMD_program_binary_Z400 +IgnoreExtension GL_AMD_performance_monitor + +IgnoreExtension GL_KHR_texture_compression_astc_ldr +IgnoreExtension GL_ANGLE_depth_texture +IgnoreExtension GL_ANGLE_instanced_arrays +IgnoreExtension GL_ANGLE_pack_reverse_row_order +IgnoreExtension GL_ANGLE_program_binary +IgnoreExtension GL_ANGLE_texture_compression_dxt3 +IgnoreExtension GL_ANGLE_texture_compression_dxt5 +IgnoreExtension GL_ANGLE_texture_usage +IgnoreExtension GL_ANGLE_translated_shader_source +IgnoreExtension GL_EXT_debug_label +IgnoreExtension GL_EXT_debug_marker +IgnoreExtension GL_EXT_discard_framebuffer +IgnoreExtension GL_EXT_disjoint_timer_query +IgnoreExtension GL_EXT_draw_buffers +IgnoreExtension GL_EXT_multiview_draw_buffers +IgnoreExtension GL_EXT_multisampled_render_to_texture +IgnoreExtension GL_EXT_shader_framebuffer_fetch +IgnoreExtension GL_FJ_shader_binary_GCCSO +IgnoreExtension GL_OES_compressed_paletted_texture +IgnoreExtension GL_OES_compressed_ETC1_RGB8_texture +IgnoreExtension GL_OES_vertex_array_object +IgnoreExtension GL_OES_vertex_half_float +IgnoreExtension GL_OES_surfaceless_context +IgnoreExtension GL_OES_texture_half_float +IgnoreExtension GL_OES_EGL_image_external + +# includes GL_STATE_RESTORE, which hasn't the QCOM suffix +IgnoreExtension GL_QCOM_extended_get +Ignore GL_STATE_RESTORE + +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET diff --git a/make/config/jogl/gl-if-gl2_es2.cfg b/make/config/jogl/gl-if-gl2_es2.cfg index 85e799298..db5489d06 100644 --- a/make/config/jogl/gl-if-gl2_es2.cfg +++ b/make/config/jogl/gl-if-gl2_es2.cfg @@ -13,46 +13,11 @@ Extends GL2ES2 GL HierarchicalNativeOutput false Include gl-common.cfg +Include gl-common-gpubufferonly.cfg Include gl-common-extensions.cfg -Include gl-if-gl3-ignores.cfg -Include gl-if-gl4-ignores.cfg - -RenameExtensionIntoCore GL_OES_texture_3D -RenameExtensionIntoCore GL_OES_get_program_binary - -# Ignore all ES 2.X only stuff .. -DropUniqVendorExtensions AMD -DropUniqVendorExtensions ANGLE -DropUniqVendorExtensions ARM -DropUniqVendorExtensions APPLE -DropUniqVendorExtensions ATI -DropUniqVendorExtensions IMG -DropUniqVendorExtensions QCOM -DropUniqVendorExtensions NV -DropUniqVendorExtensions VIV - -IgnoreExtension GL_EXT_discard_framebuffer -IgnoreExtension GL_OES_compressed_paletted_texture -IgnoreExtension GL_OES_compressed_ETC1_RGB8_texture -IgnoreExtension GL_OES_vertex_array_object -IgnoreExtension GL_OES_texture_half_float -IgnoreExtension GL_OES_vertex_half_float -IgnoreExtension GL_OES_EGL_image_external -IgnoreExtension GL_EXT_debug_marker -IgnoreExtension GL_EXT_debug_label -IgnoreExtension GL_EXT_multisampled_render_to_texture - -# isn't included in GL2 -# includes GL_STATE_RESTORE, which hasn't the QCOM suffix -IgnoreExtension GL_QCOM_extended_get -Ignore GL_STATE_RESTORE -Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET - -# Ignore ^gl.*x(v)?(OES)? -Ignore glEGL.* -#Ignore glFramebufferVertexAttribArrayNV -#Ignore glCoverageOperationNV -#Ignore glCoverageMaskNV +Include gl2_es2-common.cfg +Include gl-if-gl2_es2-ignores.cfg +Include gl-if-luminance-ignore.cfg # Ignore GL_ARB_ES2_compatibility functions for interface code generation # since we need our own javadoc header for a detailed description @@ -62,9 +27,6 @@ Ignore glGetShaderPrecisionFormat Ignore glDepthRangef Ignore glClearDepthf -CustomJavaCode GL2ES2 public void glClearDepth( double depth ); -CustomJavaCode GL2ES2 public void glDepthRange(double zNear, double zFar); - IncludeAs CustomJavaCode GL2ES2 gl-if-CustomJavaCode-gl2_es2.java # dummy procaddress config / force procaddress for comments @@ -73,20 +35,8 @@ ProcAddressTableClassName DontGenerateProcAddressTableStuff GetProcAddressTableExpr DontGenerateProcAddressTableStuff ForceProcAddressGen __ALL__ -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -# This also gives a better API doc since it includes all extension names. -GLHeader GLES2/gl2.h -GLHeader GLES2/gl2ext.h -GLHeader GL/gl.h -GLHeader GL/glext.h - # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true -CustomJavaCode GL2ES2 public void glVertexAttribPointer(GLArrayData array); -CustomJavaCode GL2ES2 public void glUniform(GLUniformData data); -CustomJavaCode GL2ES2 - Import java.io.PrintStream diff --git a/make/config/jogl/gl-if-gl2_es3-ignores.cfg b/make/config/jogl/gl-if-gl2_es3-ignores.cfg new file mode 100644 index 000000000..172857840 --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es3-ignores.cfg @@ -0,0 +1,47 @@ +# Ignore all ES 3.X only stuff .. +DropUniqVendorExtensions ANGLE +DropUniqVendorExtensions ARM +DropUniqVendorExtensions APPLE +DropUniqVendorExtensions ATI +DropUniqVendorExtensions IMG +DropUniqVendorExtensions QCOM +DropUniqVendorExtensions NV +DropUniqVendorExtensions VIV + +Ignore glEGL.* + +IgnoreExtension GL_AMD_compressed_3DC_texture +IgnoreExtension GL_AMD_compressed_ATC_texture +IgnoreExtension GL_AMD_program_binary_Z400 +IgnoreExtension GL_AMD_performance_monitor + +IgnoreExtension GL_ANGLE_depth_texture +IgnoreExtension GL_ANGLE_instanced_arrays +IgnoreExtension GL_ANGLE_pack_reverse_row_order +IgnoreExtension GL_ANGLE_program_binary +IgnoreExtension GL_ANGLE_texture_compression_dxt3 +IgnoreExtension GL_ANGLE_texture_compression_dxt5 +IgnoreExtension GL_ANGLE_texture_usage +IgnoreExtension GL_ANGLE_translated_shader_source +IgnoreExtension GL_EXT_debug_label +IgnoreExtension GL_EXT_debug_marker +IgnoreExtension GL_EXT_discard_framebuffer +IgnoreExtension GL_EXT_disjoint_timer_query +IgnoreExtension GL_EXT_draw_buffers +IgnoreExtension GL_EXT_multisampled_render_to_texture +IgnoreExtension GL_EXT_multiview_draw_buffers +IgnoreExtension GL_EXT_shader_framebuffer_fetch +IgnoreExtension GL_OES_compressed_paletted_texture +IgnoreExtension GL_OES_compressed_ETC1_RGB8_texture +IgnoreExtension GL_OES_vertex_array_object +IgnoreExtension GL_OES_vertex_half_float +IgnoreExtension GL_OES_surfaceless_context +IgnoreExtension GL_OES_texture_half_float +IgnoreExtension GL_OES_EGL_image_external +IgnoreExtension GL_FJ_shader_binary_GCCSO + +# includes GL_STATE_RESTORE, which hasn't the QCOM suffix +IgnoreExtension GL_QCOM_extended_get +Ignore GL_STATE_RESTORE + +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET diff --git a/make/config/jogl/gl-if-gl2_es3.cfg b/make/config/jogl/gl-if-gl2_es3.cfg new file mode 100644 index 000000000..112bc5434 --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es3.cfg @@ -0,0 +1,46 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2ES3 +#Extends GL2ES3 GLBase +#Extends GL2ES3 GL +Extends GL2ES3 GL2ES2 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2ES3Subset.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-gpubufferonly.cfg +Include gl-common-extensions.cfg +Include gl2_es3-common.cfg +Include gl-if-gl2_es3-ignores.cfg +Include gl-if-gl4-ignores.cfg +Include gl-if-luminance-ignore.cfg + +IncludeAs CustomJavaCode GL2ES3 gl-if-CustomJavaCode-es3.java + +# +# Same name but different signature .. +# No collisions found .. good! + +# dummy procaddress config / force procaddress for comments +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to APIENTRY +LocalProcAddressCallingConvention __ALL__ APIENTRY + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +Import java.io.PrintStream diff --git a/make/config/jogl/gl-if-gl2_gl3.cfg b/make/config/jogl/gl-if-gl2_gl3.cfg index 0c51dfe9c..532a670e6 100644 --- a/make/config/jogl/gl-if-gl2_gl3.cfg +++ b/make/config/jogl/gl-if-gl2_gl3.cfg @@ -4,21 +4,24 @@ Style InterfaceOnly JavaClass GL2GL3 #Extends GL2GL3 GLBase #Extends GL2GL3 GL -Extends GL2GL3 GL2ES2 +#Extends GL2GL3 GL2ES2 +Extends GL2GL3 GL2ES3 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java -ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL3Subset.java +ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2GL3Subset.java HierarchicalNativeOutput false Include gl-common.cfg +Include gl-common-gpubufferonly.cfg Include gl-common-extensions.cfg Include gl-desktop.cfg +Include gl3-common.cfg Include gl-if-gl4-ignores.cfg - -IncludeAs CustomJavaCode GL2GL3 gl-if-CustomJavaCode-gl2_gl3.java +Include gl-if-luminance-ignore.cfg JavaOutputDir gensrc/classes NativeOutputDir gensrc/native/jogl @@ -33,11 +36,6 @@ ProcAddressTableClassName DontGenerateProcAddressTableStuff GetProcAddressTableExpr DontGenerateProcAddressTableStuff ForceProcAddressGen __ALL__ -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -GLHeader GL/gl.h -GLHeader GL/glext.h - # Also force the calling conventions of the locally generated function # pointer typedefs for these routines to APIENTRY LocalProcAddressCallingConvention __ALL__ APIENTRY diff --git a/make/config/jogl/gl-if-gl2es3-subset.cfg b/make/config/jogl/gl-if-gl2es3-subset.cfg new file mode 100644 index 000000000..3e325e065 --- /dev/null +++ b/make/config/jogl/gl-if-gl2es3-subset.cfg @@ -0,0 +1,17 @@ +# This .cfg file is used to generate the common GL2 ES3 set +JavaOutputDir ../../build-temp/gluegen-set + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2ES3Subset +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl2_es3-common.cfg +Include gl-if-gl3-ignores.cfg +Include gl-if-gl4-ignores.cfg + +# dummy procaddress config / force procaddress for comments +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff +ForceProcAddressGen __ALL__ diff --git a/make/config/jogl/gl-if-gl3-subset.cfg b/make/config/jogl/gl-if-gl2gl3-subset.cfg index dae38ec0c..ecb384ca3 100644 --- a/make/config/jogl/gl-if-gl3-subset.cfg +++ b/make/config/jogl/gl-if-gl2gl3-subset.cfg @@ -3,10 +3,11 @@ JavaOutputDir ../../build-temp/gluegen-set Package javax.media.opengl Style InterfaceOnly -JavaClass GL3Subset +JavaClass GL2GL3Subset Include gl-common.cfg Include gl-common-extensions.cfg Include gl3-desktop.cfg +Include gl3-common.cfg Include gl-if-gl3-ignores.cfg Include gl-if-gl4-ignores.cfg diff --git a/make/config/jogl/gl-if-gl3.cfg b/make/config/jogl/gl-if-gl3.cfg index 649b35165..d472fbc29 100644 --- a/make/config/jogl/gl-if-gl3.cfg +++ b/make/config/jogl/gl-if-gl3.cfg @@ -4,6 +4,8 @@ NativeOutputDir gensrc/native/jogl/gl3 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java @@ -13,16 +15,15 @@ JavaClass GL3 #Extends GL3 GLBase #Extends GL3 GL #Extends GL3 GL2ES2 +#Extends GL3 GL2ES3 +Extends GL3 GL3ES3 Extends GL3 GL2GL3 ImplPackage jogamp.opengl.gl3 -ImplJavaClass GL3Impl -Implements GL3Impl GLBase -Implements GL3Impl GL -Implements GL3Impl GL2ES2 -Implements GL3Impl GL2GL3 Include gl-common.cfg +Include gl-common-gpubufferonly.cfg Include gl-common-extensions.cfg Include gl3-desktop.cfg +Include gl3-common.cfg Include gl-if-gl4-ignores.cfg # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums diff --git a/make/config/jogl/gl-if-gl3_es3.cfg b/make/config/jogl/gl-if-gl3_es3.cfg new file mode 100644 index 000000000..a25d9112a --- /dev/null +++ b/make/config/jogl/gl-if-gl3_es3.cfg @@ -0,0 +1,43 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL3ES3 +#Extends GL3ES3 GLBase +#Extends GL3ES3 GL +#Extends GL3ES3 GL2ES2 +Extends GL3ES3 GL2ES3 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl2_es3-common.cfg +Include gl-if-gl2_es3-ignores.cfg +Include gl-if-gl4-ignores.cfg +Include gl-if-luminance-ignore.cfg + +# +# Same name but different signature .. +# No collisions found .. good! + +# dummy procaddress config / force procaddress for comments +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to APIENTRY +LocalProcAddressCallingConvention __ALL__ APIENTRY + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +Import java.io.PrintStream diff --git a/make/config/jogl/gl-if-gl3bc.cfg b/make/config/jogl/gl-if-gl3bc.cfg index f07a9a417..5172c726c 100644 --- a/make/config/jogl/gl-if-gl3bc.cfg +++ b/make/config/jogl/gl-if-gl3bc.cfg @@ -5,6 +5,8 @@ NativeOutputDir gensrc/native/jogl/gl3 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java @@ -20,6 +22,8 @@ JavaClass GL3bc #Extends GL3bc GL #Extends GL3bc GL2ES1 #Extends GL3bc GL2ES2 +#Extends GL3bc GL2ES3 +#Extends GL3bc GL3ES3 #Extends GL3bc GL2GL3 Extends GL3bc GL2 Extends GL3bc GL3 @@ -30,6 +34,8 @@ Include gl-desktop.cfg Include gl3-desktop.cfg Include gl-if-gl4-ignores.cfg +IncludeAs CustomJavaCode GL3bc gl3bc-common-cpubufferJavaCode.java + # Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums TagNativeBinding true diff --git a/make/config/jogl/gl-if-gl4-ignores.cfg b/make/config/jogl/gl-if-gl4-ignores.cfg index 4948b64df..619c82924 100644 --- a/make/config/jogl/gl-if-gl4-ignores.cfg +++ b/make/config/jogl/gl-if-gl4-ignores.cfg @@ -9,5 +9,7 @@ IgnoreExtension GL_VERSION_4_0 IgnoreExtension GL_VERSION_4_1 IgnoreExtension GL_VERSION_4_2 +IgnoreExtension GL_VERSION_4_3 +IgnoreExtension GL_VERSION_4_4 IgnoreExtension GL_ARB_shader_precision diff --git a/make/config/jogl/gl-if-gl4.cfg b/make/config/jogl/gl-if-gl4.cfg index 1e920ac7c..144c10ad2 100644 --- a/make/config/jogl/gl-if-gl4.cfg +++ b/make/config/jogl/gl-if-gl4.cfg @@ -4,6 +4,9 @@ NativeOutputDir gensrc/native/jogl/gl4 ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4ES3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2GL3.java ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java @@ -14,11 +17,16 @@ JavaClass GL4 #Extends GL4 GLBase #Extends GL4 GL #Extends GL4 GL2ES2 +#Extends GL4 GL2ES3 +#Extends GL4 GL3ES3 #Extends GL4 GL2GL3 +Extends GL4 GL4ES3 Extends GL4 GL3 Include gl-common.cfg +Include gl-common-gpubufferonly.cfg Include gl-common-extensions.cfg Include gl3-desktop.cfg +Include gl3-common.cfg # dummy procaddress config / force procaddress for comments EmitProcAddressTable false diff --git a/make/config/jogl/gl-if-gl4_es3.cfg b/make/config/jogl/gl-if-gl4_es3.cfg new file mode 100644 index 000000000..6233d530a --- /dev/null +++ b/make/config/jogl/gl-if-gl4_es3.cfg @@ -0,0 +1,48 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL4ES3 +#Extends GL4ES3 GLBase +#Extends GL4ES3 GL +#Extends GL4ES3 GL2ES2 +#Extends GL4ES3 GL2ES3 +Extends GL4ES3 GL3ES3 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3ES3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-gpubufferonly.cfg +Include gl-common-extensions.cfg +Include gl2_es3-common.cfg +Include gl-if-gl2_es3-ignores.cfg +Include gl-if-luminance-ignore.cfg + +ForceExtension GL_ARB_ES3_compatibility + +# +# Same name but different signature .. +# No collisions found .. good! + +# dummy procaddress config / force procaddress for comments +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to APIENTRY +LocalProcAddressCallingConvention __ALL__ APIENTRY + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +Import java.io.PrintStream diff --git a/make/config/jogl/gl-if-luminance-ignore.cfg b/make/config/jogl/gl-if-luminance-ignore.cfg new file mode 100644 index 000000000..4fb79fae9 --- /dev/null +++ b/make/config/jogl/gl-if-luminance-ignore.cfg @@ -0,0 +1,7 @@ +Ignore GL_LUMINANCE16F +Ignore GL_LUMINANCE32F +Ignore GL_LUMINANCE_ALPHA16F +Ignore GL_LUMINANCE_ALPHA32F +Ignore GL_LUMINANCE4_ALPHA4 +Ignore GL_LUMINANCE8 +Ignore GL_LUMINANCE8_ALPHA8 diff --git a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c index d389db298..42e5700ab 100644 --- a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c +++ b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c @@ -1,6 +1,77 @@ /* Java->C glue code: * Java package: jogamp.opengl.gl4.GL4bcImpl - * Java method: long dispatch_glMapBuffer(int target, int access) + * Java method: void dispatch_glBufferData(int target, long size, java.nio.Buffer data, int usage) + * C function: void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); + */ +JNIEXPORT void JNICALL +Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glBufferData(JNIEnv *env, jobject _unused, jint target, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { + typedef void (APIENTRY*_local_PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); + _local_PFNGLBUFFERDATAPROC ptr_glBufferData; + GLvoid * _data_ptr = NULL; + if ( NULL != data ) { + _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } + ptr_glBufferData = (_local_PFNGLBUFFERDATAPROC) (intptr_t) procAddress; + assert(ptr_glBufferData != NULL); + (* ptr_glBufferData) ((GLenum) target, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); + if ( JNI_FALSE == data_is_nio && NULL != data ) { + (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } +} + +/** FIXME Add for OpenGL 4.4: glBufferStorage */ + +/* Java->C glue code: + * Java package: jogamp.opengl.gl4.GL4bcImpl + * Java method: void dispatch_glNamedBufferDataEXT(int buffer, long size, java.nio.Buffer data, int usage) + * C function: void glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const GLvoid * data, GLenum usage); + */ +JNIEXPORT void JNICALL +Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glNamedBufferDataEXT(JNIEnv *env, jobject _unused, jint buffer, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { + typedef void (APIENTRY*_local_PFNGLNAMEDBUFFERDATAEXTPROC)(GLuint buffer, GLsizeiptr size, const GLvoid * data, GLenum usage); + _local_PFNGLNAMEDBUFFERDATAEXTPROC ptr_glNamedBufferDataEXT; + GLvoid * _data_ptr = NULL; + if ( NULL != data ) { + _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } + ptr_glNamedBufferDataEXT = (_local_PFNGLNAMEDBUFFERDATAEXTPROC) (intptr_t) procAddress; + assert(ptr_glNamedBufferDataEXT != NULL); + (* ptr_glNamedBufferDataEXT) ((GLuint) buffer, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); + if ( JNI_FALSE == data_is_nio && NULL != data ) { + (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } +} + +/* Java->C glue code: + * Java package: jogamp.opengl.gl4.GL4bcImpl + * Java method: boolean dispatch_glUnmapBuffer(int target) + * C function: GLboolean glUnmapBuffer(GLenum target); + */ +JNIEXPORT jboolean JNICALL +Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glUnmapBuffer(JNIEnv *env, jobject _unused, jint target, jlong procAddress) { + typedef GLboolean (APIENTRY*_local_PFNGLUNMAPBUFFERPROC)(GLenum target); + _local_PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; + GLboolean _res; + ptr_glUnmapBuffer = (_local_PFNGLUNMAPBUFFERPROC) (intptr_t) procAddress; + assert(ptr_glUnmapBuffer != NULL); + _res = (* ptr_glUnmapBuffer) ((GLenum) target); + return _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.gl4.GL4bcImpl + * Java method: boolean dispatch_glUnmapNamedBufferEXT(int buffer) + * C function: GLboolean glUnmapNamedBufferEXT(GLuint buffer); + */ +JNIEXPORT jboolean JNICALL +Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glUnmapNamedBufferEXT(JNIEnv *env, jobject _unused, jint buffer, jlong procAddress) { + typedef GLboolean (APIENTRY*_local_PFNGLUNMAPNAMEDBUFFEREXTPROC)(GLuint buffer); + _local_PFNGLUNMAPNAMEDBUFFEREXTPROC ptr_glUnmapNamedBufferEXT; + GLboolean _res; + ptr_glUnmapNamedBufferEXT = (_local_PFNGLUNMAPNAMEDBUFFEREXTPROC) (intptr_t) procAddress; + assert(ptr_glUnmapNamedBufferEXT != NULL); + _res = (* ptr_glUnmapNamedBufferEXT) ((GLuint) buffer); + return _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.gl4.GL4bcImpl * Java method: long dispatch_glMapBuffer(int target, int access) * C function: void * glMapBuffer(GLenum target, GLenum access); */ JNIEXPORT jlong JNICALL @@ -15,6 +86,22 @@ Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unu /* Java->C glue code: * Java package: jogamp.opengl.gl4.GL4bcImpl + * Java method: java.nio.ByteBuffer dispatch_glMapBufferRange(int target, long offset, long length, int access) + * C function: void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapBufferRange(JNIEnv *env, jobject _unused, jint target, jlong offset, jlong length, jint access, jlong procAddress) { + typedef void * (APIENTRY*_local_PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + _local_PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; + void * _res; + ptr_glMapBufferRange = (_local_PFNGLMAPBUFFERRANGEPROC) (intptr_t) procAddress; + assert(ptr_glMapBufferRange != NULL); + _res = (* ptr_glMapBufferRange) ((GLenum) target, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.gl4.GL4bcImpl * Java method: long dispatch_glMapNamedBufferEXT(int target, int access) * C function: void * glMapNamedBufferEXT(GLenum target, GLenum access); */ @@ -24,10 +111,26 @@ Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapNamedBufferEXT(JNIEnv *env, jobj void * _res; ptr_glMapNamedBufferEXT = (PFNGLMAPNAMEDBUFFEREXTPROC) (intptr_t) glProcAddress; assert(ptr_glMapNamedBufferEXT != NULL); - _res = (* ptr_glMapNamedBufferEXT) ((GLenum) target, (GLenum) access); + _res = (* ptr_glMapNamedBufferEXT) ((GLuint) target, (GLenum) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.gl4.GL4bcImpl + * Java method: java.nio.ByteBuffer dispatch_glMapNamedBufferRangeEXT(int buffer, long offset, long length, int access) + * C function: void * glMapNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glMapNamedBufferRangeEXT(JNIEnv *env, jobject _unused, jint buffer, jlong offset, jlong length, jint access, jlong procAddress) { + PFNGLMAPNAMEDBUFFERRANGEEXTPROC ptr_glMapNamedBufferRangeEXT; + void * _res; + ptr_glMapNamedBufferRangeEXT = (PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (intptr_t) procAddress; + assert(ptr_glMapNamedBufferRangeEXT != NULL); + _res = (* ptr_glMapNamedBufferRangeEXT) ((GLuint) buffer, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); return (jlong) (intptr_t) _res; } + /* Java->C glue code: * Java package: jogamp.opengl.gl4.GL4bcImpl * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); diff --git a/make/config/jogl/gl-impl-CustomCCode-gles1.c b/make/config/jogl/gl-impl-CustomCCode-gles1.c index 0155c13f8..83b8c7586 100644 --- a/make/config/jogl/gl-impl-CustomCCode-gles1.c +++ b/make/config/jogl/gl-impl-CustomCCode-gles1.c @@ -1,3 +1,38 @@ +/* Java->C glue code: + * Java package: jogamp.opengl.es1.GLES1Impl + * Java method: void dispatch_glBufferData(int target, long size, java.nio.Buffer data, int usage) + * C function: void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); + */ +JNIEXPORT void JNICALL +Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glBufferData(JNIEnv *env, jobject _unused, jint target, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { + typedef void (GL_APIENTRY*_local_PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); + _local_PFNGLBUFFERDATAPROC ptr_glBufferData; + GLvoid * _data_ptr = NULL; + if ( NULL != data ) { + _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } + ptr_glBufferData = (_local_PFNGLBUFFERDATAPROC) (intptr_t) procAddress; + assert(ptr_glBufferData != NULL); + (* ptr_glBufferData) ((GLenum) target, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); + if ( JNI_FALSE == data_is_nio && NULL != data ) { + (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } +} + +/* Java->C glue code: + * Java package: jogamp.opengl.es1.GLES1Impl + * Java method: boolean dispatch_glUnmapBuffer(int target) + * C function: GLboolean glUnmapBufferOES(GLenum target); + */ +JNIEXPORT jboolean JNICALL +Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glUnmapBuffer(JNIEnv *env, jobject _unused, jint target, jlong procAddress) { + typedef GLboolean (GL_APIENTRY*_local_PFNGLUNMAPBUFFEROESPROC)(GLenum target); + _local_PFNGLUNMAPBUFFEROESPROC ptr_glUnmapBufferOES; + GLboolean _res; + ptr_glUnmapBufferOES = (_local_PFNGLUNMAPBUFFEROESPROC) (intptr_t) procAddress; + assert(ptr_glUnmapBufferOES != NULL); + _res = (* ptr_glUnmapBufferOES) ((GLenum) target); + return _res; +} + typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); /* Java->C glue code: * Java package: jogamp.opengl.es1.GLES1Impl @@ -16,6 +51,22 @@ Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unu /* Java->C glue code: * Java package: jogamp.opengl.es1.GLES1Impl + * Java method: java.nio.ByteBuffer dispatch_glMapBufferRange(int target, long offset, long length, int access) + * C function: void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_es1_GLES1Impl_dispatch_1glMapBufferRange(JNIEnv *env, jobject _unused, jint target, jlong offset, jlong length, jint access, jlong procAddress) { + typedef void * (GL_APIENTRY*_local_PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + _local_PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; + void * _res; + ptr_glMapBufferRange = (_local_PFNGLMAPBUFFERRANGEPROC) (intptr_t) procAddress; + assert(ptr_glMapBufferRange != NULL); + _res = (* ptr_glMapBufferRange) ((GLenum) target, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.es1.GLES1Impl * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); * C function: jobject newDirectByteBuffer(jlong addr, jlong capacity); */ diff --git a/make/config/jogl/gl-impl-CustomCCode-gles2.c b/make/config/jogl/gl-impl-CustomCCode-gles2.c deleted file mode 100644 index e140df76b..000000000 --- a/make/config/jogl/gl-impl-CustomCCode-gles2.c +++ /dev/null @@ -1,25 +0,0 @@ -typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -/* Java->C glue code: - * Java package: jogamp.opengl.es2.GLES2Impl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: void * glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_jogamp_opengl_es2_GLES2Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERPROC ptr_glMapBuffer; - void * _res; - ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: jogamp.opengl.es2.GLES2Impl - * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); - * C function: jobject newDirectByteBuffer(jlong addr, jlong capacity); - */ -JNIEXPORT jobject JNICALL -Java_jogamp_opengl_es2_GLES2Impl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jlong capacity) { - return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); -} diff --git a/make/config/jogl/gl-impl-CustomCCode-gles3.c b/make/config/jogl/gl-impl-CustomCCode-gles3.c new file mode 100644 index 000000000..ff1d42e23 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gles3.c @@ -0,0 +1,77 @@ +/* Java->C glue code: + * Java package: jogamp.opengl.es3.GLES3Impl + * Java method: void dispatch_glBufferData(int target, long size, java.nio.Buffer data, int usage) + * C function: void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); + */ +JNIEXPORT void JNICALL +Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glBufferData(JNIEnv *env, jobject _unused, jint target, jlong size, jobject data, jint data_byte_offset, jboolean data_is_nio, jint usage, jlong procAddress) { + typedef void (GL_APIENTRY*_local_PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); + _local_PFNGLBUFFERDATAPROC ptr_glBufferData; + GLvoid * _data_ptr = NULL; + if ( NULL != data ) { + _data_ptr = (GLvoid *) ( JNI_TRUE == data_is_nio ? (*env)->GetDirectBufferAddress(env, data) : (*env)->GetPrimitiveArrayCritical(env, data, NULL) ); } + ptr_glBufferData = (_local_PFNGLBUFFERDATAPROC) (intptr_t) procAddress; + assert(ptr_glBufferData != NULL); + (* ptr_glBufferData) ((GLenum) target, (GLsizeiptr) size, (GLvoid *) (((char *) _data_ptr) + data_byte_offset), (GLenum) usage); + if ( JNI_FALSE == data_is_nio && NULL != data ) { + (*env)->ReleasePrimitiveArrayCritical(env, data, _data_ptr, JNI_ABORT); } +} + +/* Java->C glue code: + * Java package: jogamp.opengl.es3.GLES3Impl + * Java method: boolean dispatch_glUnmapBuffer(int target) + * C function: GLboolean glUnmapBuffer(GLenum target); + */ +JNIEXPORT jboolean JNICALL +Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glUnmapBuffer(JNIEnv *env, jobject _unused, jint target, jlong procAddress) { + typedef GLboolean (GL_APIENTRY*_local_PFNGLUNMAPBUFFERPROC)(GLenum target); + _local_PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; + GLboolean _res; + ptr_glUnmapBuffer = (_local_PFNGLUNMAPBUFFERPROC) (intptr_t) procAddress; + assert(ptr_glUnmapBuffer != NULL); + _res = (* ptr_glUnmapBuffer) ((GLenum) target); + return _res; +} + +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); + +/* Java->C glue code: + * Java package: jogamp.opengl.es3.GLES3Impl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { + PFNGLMAPBUFFERPROC ptr_glMapBuffer; + void * _res; + ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; + assert(ptr_glMapBuffer != NULL); + _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.es3.GLES3Impl + * Java method: java.nio.ByteBuffer dispatch_glMapBufferRange(int target, long offset, long length, int access) + * C function: void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + */ +JNIEXPORT jlong JNICALL +Java_jogamp_opengl_es3_GLES3Impl_dispatch_1glMapBufferRange(JNIEnv *env, jobject _unused, jint target, jlong offset, jlong length, jint access, jlong procAddress) { + typedef void * (GL_APIENTRY*_local_PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + _local_PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; + void * _res; + ptr_glMapBufferRange = (_local_PFNGLMAPBUFFERRANGEPROC) (intptr_t) procAddress; + assert(ptr_glMapBufferRange != NULL); + _res = (* ptr_glMapBufferRange) ((GLenum) target, (GLintptr) offset, (GLsizeiptr) length, (GLbitfield) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.es3.GLES3Impl + * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); + * C function: jobject newDirectByteBuffer(jlong addr, jlong capacity); + */ +JNIEXPORT jobject JNICALL +Java_jogamp_opengl_es3_GLES3Impl_newDirectByteBuffer(JNIEnv *env, jobject _unused, jlong addr, jlong capacity) { + return (*env)->NewDirectByteBuffer(env, (void*) (intptr_t) addr, capacity); +} diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index 283a4e623..a2ca12960 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -5,23 +5,33 @@ private final GLProfile glProfile; @Override - public final int glGetBoundBuffer(int target) { + public final int getBoundBuffer(int target) { return bufferStateTracker.getBoundBufferObject(target, this); } @Override - public final long glGetBufferSize(int buffer) { - return bufferSizeTracker.getDirectStateBufferSize(buffer, this); + public final GLBufferStorage getBufferStorage(int bufferName) { + return bufferObjectTracker.getBufferStorage(bufferName); } @Override - public final boolean glIsVBOArrayEnabled() { - return checkArrayVBOEnabled(false); + public final boolean isVBOArrayBound() { + return checkArrayVBOBound(false); } @Override - public final boolean glIsVBOElementArrayEnabled() { - return checkElementVBOEnabled(false); + public final boolean isVBOElementArrayBound() { + return checkElementVBOBound(false); + } + + @Override + public final GL getDownstreamGL() throws GLException { + return null; + } + + @Override + public final GL getRootGL() throws GLException { + return this; } @Override @@ -113,3 +123,65 @@ return _context.getDefaultReadFramebuffer(); } + @Override + public final int getDefaultReadBuffer() { + return _context.getDefaultReadBuffer(); + } + + private final GLStateTracker glStateTracker; + + // + // GLBufferObjectTracker Redirects + // + private final GLBufferObjectTracker bufferObjectTracker; + private final GLBufferStateTracker bufferStateTracker; + + private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createBoundMutableStorageDispatch = + new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { + public final void create(final int target, final long size, final Buffer data, final int mutableUsage, final long glProcAddress) { + final boolean data_is_direct = Buffers.isDirect(data); + dispatch_glBufferData(target, size, + data_is_direct ? data : Buffers.getArray(data), + data_is_direct ? Buffers.getDirectBufferByteOffset(data) : Buffers.getIndirectBufferByteOffset(data), + data_is_direct, mutableUsage, glProcAddress); + } + }; + private native void dispatch_glBufferData(int target, long size, Object data, int data_byte_offset, boolean data_is_direct, int usage, long procAddress); + + private final jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch unmapBoundBufferDispatch = + new jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch() { + public final boolean unmap(final int target, final long glProcAddress) { + return dispatch_glUnmapBuffer(target, glProcAddress); + } + }; + private native boolean dispatch_glUnmapBuffer(int target, long procAddress); + + @Override + public final java.nio.ByteBuffer glMapBuffer(int target, int access) { + return mapBuffer(target, access).getMappedBuffer(); + } + + @Override + public final ByteBuffer glMapBufferRange(int target, long offset, long length, int access) { + return mapBufferRange(target, offset, length, access).getMappedBuffer(); + } + + private final jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch mapBoundBufferAllDispatch = + new jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch() { + public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } + public final long mapBuffer(final int target, final int access, final long glProcAddress) { + return dispatch_glMapBuffer(target, access, glProcAddress); + } + }; + private native long dispatch_glMapBuffer(int target, int access, long glProcAddress); + + private final jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch mapBoundBufferRangeDispatch = + new jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch() { + public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } + public final long mapBuffer(final int target, final long offset, final long length, final int access, final long glProcAddress) { + return dispatch_glMapBufferRange(target, offset, length, access, glProcAddress); + } + }; + private native long dispatch_glMapBufferRange(int target, long offset, long length, int access, long glProcAddress); + + private native ByteBuffer newDirectByteBuffer(long addr, long capacity); diff --git a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java deleted file mode 100644 index 6a74b80a6..000000000 --- a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java +++ /dev/null @@ -1,148 +0,0 @@ - private int[] imageSizeTemp = new int[1]; - - private final int imageSizeInBytes(int format, int type, int width, int height, int depth, boolean pack) { - return GLBuffers.sizeof(this, imageSizeTemp, format, type, width, height, depth, pack) ; - } - - @Override - public final boolean isGL4bc() { - return _context.isGL4bc(); - } - - @Override - public final boolean isGL4() { - return _context.isGL4(); - } - - @Override - public final boolean isGL3bc() { - return _context.isGL3bc(); - } - - @Override - public final boolean isGL3() { - return _context.isGL3(); - } - - @Override - public final boolean isGL2() { - return _context.isGL2(); - } - - @Override - public final boolean isGL2ES1() { - return _context.isGL2ES1(); - } - - @Override - public final boolean isGL2ES2() { - return _context.isGL2ES2(); - } - - @Override - public final boolean isGLES2Compatible() { - return _context.isGLES2Compatible(); - } - - public final boolean isGL2GL3() { - return _context.isGL2GL3(); - } - - @Override - public final boolean hasGLSL() { - return _context.hasGLSL(); - } - - @Override - public final GL4bc getGL4bc() throws GLException { - if(!isGL4bc()) { - throw new GLException("Not a GL4bc implementation"); - } - return this; - } - - @Override - public final GL4 getGL4() throws GLException { - if(!isGL4()) { - throw new GLException("Not a GL4 implementation"); - } - return this; - } - - @Override - public final GL3bc getGL3bc() throws GLException { - if(!isGL3bc()) { - throw new GLException("Not a GL3bc implementation"); - } - return this; - } - - @Override - public final GL3 getGL3() throws GLException { - if(!isGL3()) { - throw new GLException("Not a GL3 implementation"); - } - return this; - } - - @Override - public final GL2 getGL2() throws GLException { - if(!isGL2()) { - throw new GLException("Not a GL2 implementation"); - } - return this; - } - - @Override - public final GL2ES1 getGL2ES1() throws GLException { - if(!isGL2ES1()) { - throw new GLException("Not a GL2ES1 implementation"); - } - return this; - } - - @Override - public final GL2ES2 getGL2ES2() throws GLException { - if(!isGL2ES2()) { - throw new GLException("Not a GL2ES2 implementation"); - } - return this; - } - - @Override - public final GL2GL3 getGL2GL3() throws GLException { - if(!isGL2GL3()) { - throw new GLException("Not a GL2GL3 implementation"); - } - return this; - } - - @Override - public final boolean isGLES1() { - return false; - } - - @Override - public final boolean isGLES2() { - return false; - } - - @Override - public final boolean isGLES() { - return false; - } - - @Override - public final GLES1 getGLES1() throws GLException { - throw new GLException("Not a GLES1 implementation"); - } - - @Override - public final GLES2 getGLES2() throws GLException { - throw new GLException("Not a GLES2 implementation"); - } - - @Override - public final boolean isNPOTTextureAvailable() { - return _context.isNPOTTextureAvailable(); - } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index e079a1a24..a8b5f8320 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -18,297 +18,608 @@ public void setObjectTracker(GLObjectTracker tracker) { public GL4bcImpl(GLProfile glp, GLContextImpl context) { this._context = context; if(null != context) { - this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferObjectTracker = context.getBufferObjectTracker(); this.bufferStateTracker = context.getBufferStateTracker(); this.glStateTracker = context.getGLStateTracker(); } else { - this.bufferSizeTracker = null; + this.bufferObjectTracker = null; this.bufferStateTracker = null; this.glStateTracker = null; } this.glProfile = glp; } -/** - * Provides platform-independent access to the wglAllocateMemoryNV / - * glXAllocateMemoryNV extension. - */ -public final java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { - return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3); +public final void finalizeInit() { + if(null != _context) { + haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object"); + haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object"); + haveGL15 = isExtensionAvailable("GL_VERSION_1_5"); + haveGL21 = isExtensionAvailable("GL_VERSION_2_1"); + haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object"); + haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version300) >= 0 || + isExtensionAvailable("GL_ARB_vertex_array_object"); + } else { + haveARBPixelBufferObject = false; + haveEXTPixelBufferObject = false; + haveGL15 = false; + haveGL21 = false; + haveARBVertexBufferObject = false; + haveARBVertexArrayObject = false; + } +} + +private int[] imageSizeTemp = new int[1]; + +private final int imageSizeInBytes(int format, int type, int width, int height, int depth, boolean pack) { + return GLBuffers.sizeof(this, imageSizeTemp, format, type, width, height, depth, pack) ; +} + +@Override +public final boolean isGL4bc() { + return _context.isGL4bc(); +} + +@Override +public final boolean isGL4() { + return _context.isGL4(); +} + +@Override +public final boolean isGL3bc() { + return _context.isGL3bc(); +} + +@Override +public final boolean isGL3() { + return _context.isGL3(); +} + +@Override +public final boolean isGL2() { + return _context.isGL2(); +} + +@Override +public final boolean isGL2ES1() { + return _context.isGL2ES1(); +} + +@Override +public final boolean isGL2ES2() { + return _context.isGL2ES2(); +} + +@Override +public final boolean isGL2ES3() { + return _context.isGL2ES3(); +} + +@Override +public final boolean isGL3ES3() { + return _context.isGL3ES3(); +} + +@Override +public final boolean isGL4ES3() { + return _context.isGL4ES3(); +} + +@Override +public final boolean isGL4core() { + return _context.isGL4core(); +} + +@Override +public final boolean isGL3core() { + return _context.isGL3core(); +} + +@Override +public final boolean isGLcore() { + return _context.isGLcore(); +} + +@Override +public final boolean isGLES2Compatible() { + return _context.isGLES2Compatible(); +} + +@Override +public final boolean isGLES3Compatible() { + return _context.isGLES3Compatible(); +} + +@Override +public final boolean isGL2GL3() { + return _context.isGL2GL3(); +} + +@Override +public final boolean hasGLSL() { + return _context.hasGLSL(); +} + +@Override +public final GL4bc getGL4bc() throws GLException { + if(!isGL4bc()) { + throw new GLException("Not a GL4bc implementation"); + } + return this; +} + +@Override +public final GL4 getGL4() throws GLException { + if(!isGL4()) { + throw new GLException("Not a GL4 implementation"); + } + return this; +} + +@Override +public final GL3bc getGL3bc() throws GLException { + if(!isGL3bc()) { + throw new GLException("Not a GL3bc implementation"); + } + return this; +} + +@Override +public final GL3 getGL3() throws GLException { + if(!isGL3()) { + throw new GLException("Not a GL3 implementation"); + } + return this; +} + +@Override +public final GL2 getGL2() throws GLException { + if(!isGL2()) { + throw new GLException("Not a GL2 implementation"); + } + return this; +} + +@Override +public final GL2ES1 getGL2ES1() throws GLException { + if(!isGL2ES1()) { + throw new GLException("Not a GL2ES1 implementation"); + } + return this; +} + +@Override +public final GL2ES2 getGL2ES2() throws GLException { + if(!isGL2ES2()) { + throw new GLException("Not a GL2ES2 implementation"); + } + return this; +} + +@Override +public final GL2ES3 getGL2ES3() throws GLException { + if(!isGL2ES3()) { + throw new GLException("Not a GL2ES3 implementation"); + } + return this; +} + +@Override +public final GL3ES3 getGL3ES3() throws GLException { + if(!isGL3ES3()) { + throw new GLException("Not a GL3ES3 implementation"); + } + return this; +} + +@Override +public final GL4ES3 getGL4ES3() throws GLException { + if(!isGL4ES3()) { + throw new GLException("Not a GL4ES3 implementation"); + } + return this; +} + +@Override +public final GL2GL3 getGL2GL3() throws GLException { + if(!isGL2GL3()) { + throw new GLException("Not a GL2GL3 implementation"); + } + return this; +} + +@Override +public final boolean isGLES1() { + return false; +} + +@Override +public final boolean isGLES2() { + return false; +} + +@Override +public final boolean isGLES3() { + return false; +} + +@Override +public final boolean isGLES() { + return false; +} + +@Override +public final GLES1 getGLES1() throws GLException { + throw new GLException("Not a GLES1 implementation"); +} + +@Override +public final GLES2 getGLES2() throws GLException { + throw new GLException("Not a GLES2 implementation"); +} + +@Override +public final GLES3 getGLES3() throws GLException { + throw new GLException("Not a GLES3 implementation"); +} + +@Override +public final boolean isNPOTTextureAvailable() { + return _context.isNPOTTextureAvailable(); +} +@Override +public final java.nio.ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + return _context.glAllocateMemoryNV(size, readFrequency, writeFrequency, priority); +} + +@Override +public final void glFreeMemoryNV(java.nio.ByteBuffer pointer) { + _context.glFreeMemoryNV(pointer); } // // Helpers for ensuring the correct amount of texture data // -private final GLBufferSizeTracker bufferSizeTracker; -private final GLBufferStateTracker bufferStateTracker; -private final GLStateTracker glStateTracker; - -private boolean bufferObjectExtensionsInitialized = false; private boolean haveARBPixelBufferObject; private boolean haveEXTPixelBufferObject; private boolean haveGL15; private boolean haveGL21; private boolean haveARBVertexBufferObject; +private boolean haveARBVertexArrayObject; -private final void initBufferObjectExtensionChecks() { - if (bufferObjectExtensionsInitialized) - return; - bufferObjectExtensionsInitialized = true; - haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object"); - haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object"); - haveGL15 = isExtensionAvailable("GL_VERSION_1_5"); - haveGL21 = isExtensionAvailable("GL_VERSION_2_1"); - haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object"); -} - -private final boolean checkBufferObject(boolean extension1, - boolean extension2, - boolean extension3, - boolean enabled, +private final boolean checkBufferObject(boolean extensionAvail, + boolean allowVAO, + boolean bound, int state, String kind, boolean throwException) { - if (inBeginEndPair) { + if ( inBeginEndPair ) { throw new GLException("May not call this between glBegin and glEnd"); } - boolean avail = (extension1 || extension2 || extension3); - if (!avail) { - if (!enabled) + if ( !extensionAvail ) { + if ( !bound ) { return true; + } if(throwException) { throw new GLException("Required extensions not available to call this function"); } return false; } int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if (enabled) { - if (buffer == 0) { - if(throwException) { - throw new GLException(kind + " must be enabled to call this method"); - } - return false; + if ( bound ) { + if ( 0 != buffer ) { + return true; + } + if ( allowVAO ) { + buffer = bufferStateTracker.getBoundBufferObject(GL2ES3.GL_VERTEX_ARRAY_BINDING, this); + if( 0 != buffer && _context.getDefaultVAO() != buffer ) { + return true; + } } + if ( throwException ) { + throw new GLException(kind + " must be bound to call this method"); + } + return false; } else { - if (buffer != 0) { - if(throwException) { - throw new GLException(kind + " must be disabled to call this method"); - } - return false; + if ( 0 == buffer ) { + return true; } + if ( throwException ) { + throw new GLException(kind + " must be unbound to call this method"); + } + return false; } - return true; } -private final boolean checkArrayVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - false, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); +private final void validateCPUSourcedAvail() { + if(!_context.isCPUDataSourcingAvail()) { + throw new GLException("CPU data sourcing n/a w/ "+_context); + } +} + +private final boolean checkArrayVBOUnbound(boolean throwException) { + if(throwException) { + validateCPUSourcedAvail(); + } + return checkBufferObject(haveGL15 || haveARBVertexBufferObject, + haveARBVertexArrayObject, // allowVAO + false, // bound + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private final boolean checkArrayVBOBound(boolean throwException) { + return checkBufferObject(haveGL15 || haveARBVertexBufferObject, + haveARBVertexArrayObject, // allowVAO + true, // bound + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private final boolean checkElementVBOUnbound(boolean throwException) { + if(throwException) { + validateCPUSourcedAvail(); + } + return checkBufferObject(haveGL15 || haveARBVertexBufferObject, + haveARBVertexArrayObject, // allowVAO + false, // bound + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); } -private final boolean checkArrayVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - true, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); +private final boolean checkElementVBOBound(boolean throwException) { + return checkBufferObject(haveGL15 || haveARBVertexBufferObject, + haveARBVertexArrayObject, // allowVAO + true, // bound + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); } -private final boolean checkElementVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - false, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); +private final boolean checkIndirectVBOUnbound(boolean throwException) { + if(throwException) { + validateCPUSourcedAvail(); + } + return checkBufferObject(haveGL15 || haveARBVertexBufferObject, + haveARBVertexArrayObject, // allowVAO + false, // bound + GL4.GL_DRAW_INDIRECT_BUFFER, + "indirect vertex_buffer_object", throwException); } -private final boolean checkElementVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveGL15, - haveARBVertexBufferObject, - false, - true, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); +private final boolean checkIndirectVBOBound(boolean throwException) { + return checkBufferObject(haveGL15 || haveARBVertexBufferObject, + haveARBVertexArrayObject, // allowVAO + true, // bound + GL4.GL_DRAW_INDIRECT_BUFFER, + "indirect vertex_buffer_object", throwException); } -private final boolean checkUnpackPBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - false, - GL2.GL_PIXEL_UNPACK_BUFFER, - "unpack pixel_buffer_object", throwException); +private final boolean checkUnpackPBOUnbound(boolean throwException) { + return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, + false, // allowVAO + false, // bound + GL2.GL_PIXEL_UNPACK_BUFFER, + "unpack pixel_buffer_object", throwException); } -private final boolean checkUnpackPBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - true, - GL2.GL_PIXEL_UNPACK_BUFFER, - "unpack pixel_buffer_object", throwException); +private final boolean checkUnpackPBOBound(boolean throwException) { + return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, + false, // allowVAO + true, // bound + GL2.GL_PIXEL_UNPACK_BUFFER, + "unpack pixel_buffer_object", throwException); } -private final boolean checkPackPBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - false, - GL2.GL_PIXEL_PACK_BUFFER, - "pack pixel_buffer_object", throwException); +private final boolean checkPackPBOUnbound(boolean throwException) { + return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, + false, // allowVAO + false, // bound + GL2.GL_PIXEL_PACK_BUFFER, + "pack pixel_buffer_object", throwException); } -private final boolean checkPackPBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(haveARBPixelBufferObject, - haveEXTPixelBufferObject, - haveGL21, - true, - GL2.GL_PIXEL_PACK_BUFFER, - "pack pixel_buffer_object", throwException); +private final boolean checkPackPBOBound(boolean throwException) { + return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, + false, // allowVAO + true, // bound + GL2.GL_PIXEL_PACK_BUFFER, + "pack pixel_buffer_object", throwException); } @Override -public final boolean glIsPBOPackEnabled() { - return checkPackPBOEnabled(false); +public final boolean isPBOPackBound() { + return checkPackPBOBound(false); } @Override -public final boolean glIsPBOUnpackEnabled() { - return checkUnpackPBOEnabled(false); +public final boolean isPBOUnpackBound() { + return checkUnpackPBOBound(false); } -private final HashMap<MemoryObject, MemoryObject> arbMemCache = new HashMap<MemoryObject, MemoryObject>(); +@Override +public final void glVertexPointer(GLArrayData array) { + if(array.getComponentCount()==0) return; + if(array.isVBO()) { + glVertexPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getVBOOffset()); + } else { + glVertexPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getBuffer()); + } +} +@Override +public final void glColorPointer(GLArrayData array) { + if(array.getComponentCount()==0) return; + if(array.isVBO()) { + glColorPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getVBOOffset()); + } else { + glColorPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getBuffer()); + } -/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -public final java.nio.ByteBuffer glMapBuffer(int target, int access) { - final long __addr_ = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; - if (__addr_ == 0) { - throw new GLException("Method \"glMapBuffer\" not available"); +} +@Override +public final void glNormalPointer(GLArrayData array) { + if(array.getComponentCount()==0) return; + if(array.getComponentCount()!=3) { + throw new GLException("Only 3 components per normal allowed"); } - final long sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); - if (0 == sz) { - return null; + if(array.isVBO()) { + glNormalPointer(array.getComponentType(), array.getStride(), array.getVBOOffset()); + } else { + glNormalPointer(array.getComponentType(), array.getStride(), array.getBuffer()); } - final long addr = dispatch_glMapBuffer(target, access, __addr_); - if (0 == addr) { - return null; +} +@Override +public final void glTexCoordPointer(GLArrayData array) { + if(array.getComponentCount()==0) return; + if(array.isVBO()) { + glTexCoordPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getVBOOffset()); + } else { + glTexCoordPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getBuffer()); } - ByteBuffer buffer; - MemoryObject memObj0 = new MemoryObject(addr, sz); // object and key - MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0); - if(memObj0 == memObj1) { - // just added .. - if(null != memObj0.getBuffer()) { - throw new InternalError(); +} + +// +// GLBufferObjectTracker Redirects +// + +@Override +public final void glBufferData(int target, long size, Buffer data, int usage) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); } - buffer = newDirectByteBuffer(addr, sz); - Buffers.nativeOrder(buffer); - memObj0.setBuffer(buffer); - } else { - // already mapped - buffer = memObj1.getBuffer(); - if(null == buffer) { - throw new InternalError(); + bufferObjectTracker.createBufferStorage(bufferStateTracker, this, + target, size, data, usage, 0 /* immutableFlags */, + createBoundMutableStorageDispatch, glProcAddress); +} +/** FIXME Add for OpenGL 4.4 +@Override +public final void glBufferStorage(int target, long size, Buffer data, int flags) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferStorage; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glBufferStorage")); } - } - buffer.position(0); - return buffer; + bufferObjectTracker.createBufferStorage(bufferStateTracker, this, + target, size, data, 0 * mutableUsage *, flags, + createBoundImmutableStorageDispatch, glProcAddress); } +private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createBoundImmutableStorageDispatch = + new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { + public final void create(final int target, final long size, final Buffer data, final int immutableFlags, final long glProcAddress) { + final boolean data_is_direct = Buffers.isDirect(data); + dispatch_glBufferStorage(target, size, + data_is_direct ? data : Buffers.getArray(data), + data_is_direct ? Buffers.getDirectBufferByteOffset(data) : Buffers.getIndirectBufferByteOffset(data), + data_is_direct, immutableFlags, glProcAddress); + } + }; +private native void dispatch_glBufferStorage(int target, long size, Object data, int data_byte_offset, boolean data_is_direct, int flags, long procAddress); + */ -/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -native private long dispatch_glMapBuffer(int target, int access, long glProcAddress); +@Override +public final void glNamedBufferDataEXT(int buffer, long size, Buffer data, int usage) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glNamedBufferDataEXT; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glNamedBufferDataEXT")); + } + bufferObjectTracker.createBufferStorage(this, + buffer, size, data, usage, 0 /* immutableFlags */, + createNamedStorageDispatch, glProcAddress); +} +private final jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch createNamedStorageDispatch = + new jogamp.opengl.GLBufferObjectTracker.CreateStorageDispatch() { + public final void create(final int buffer, final long size, final Buffer data, final int mutableUsage, final long glProcAddress) { + final boolean data_is_direct = Buffers.isDirect(data); + dispatch_glNamedBufferDataEXT(buffer, size, + data_is_direct ? data : Buffers.getArray(data), + data_is_direct ? Buffers.getDirectBufferByteOffset(data) : Buffers.getIndirectBufferByteOffset(data), + data_is_direct, mutableUsage, glProcAddress); + } + }; +private native void dispatch_glNamedBufferDataEXT(int buffer, long size, Object data, int data_byte_offset, boolean data_is_direct, int usage, long procAddress); -/** Entry point to C language function: <code> GLvoid * {@native glMapNamedBufferEXT}(GLuint buffer, GLenum access); </code> <br>Part of <code>GL_EXT_direct_state_access</code> */ -public final java.nio.ByteBuffer glMapNamedBufferEXT(int bufferName, int access) { - final long __addr_ = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferEXT; - if (__addr_ == 0) { - throw new GLException("Method \"glMapNamedBufferEXT\" not available"); - } - final long sz = bufferSizeTracker.getDirectStateBufferSize(bufferName, this); - if (0 == sz) { - return null; - } - final long addr = dispatch_glMapNamedBufferEXT(bufferName, access, __addr_); - if (0 == addr) { - return null; - } - ByteBuffer buffer; - MemoryObject memObj0 = new MemoryObject(addr, sz); // object and key - MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0); - if(memObj0 == memObj1) { - // just added .. - if(null != memObj0.getBuffer()) { - throw new InternalError(); +@Override +public boolean glUnmapBuffer(int target) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); } - buffer = newDirectByteBuffer(addr, sz); - Buffers.nativeOrder(buffer); - memObj0.setBuffer(buffer); - } else { - // already mapped - buffer = memObj1.getBuffer(); - if(null == buffer) { - throw new InternalError(); + return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch, glProcAddress); +} + +@Override +public boolean glUnmapNamedBufferEXT(int buffer) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapNamedBufferEXT; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glUnmapNamedBufferEXT")); } + return bufferObjectTracker.unmapBuffer(buffer, unmapNamedBufferDispatch, glProcAddress); +} +private final jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch unmapNamedBufferDispatch = + new jogamp.opengl.GLBufferObjectTracker.UnmapBufferDispatch() { + public final boolean unmap(final int buffer, final long glProcAddress) { + return dispatch_glUnmapNamedBufferEXT(buffer, glProcAddress); + } + }; +private native boolean dispatch_glUnmapNamedBufferEXT(int buffer, long procAddress); + +@Override +public final GLBufferStorage mapBuffer(final int target, final int access) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapBuffer\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch, glProcAddress); +} +@Override +public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapBufferRange\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch, glProcAddress); +} + +@Override +public final GLBufferStorage mapNamedBuffer(final int bufferName, final int access) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferEXT; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapNamedBufferEXT\" not available"); } - buffer.position(0); - return buffer; + return bufferObjectTracker.mapBuffer(bufferName, access, mapNamedBufferAllDispatch, glProcAddress); } +private final jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch mapNamedBufferAllDispatch = + new jogamp.opengl.GLBufferObjectTracker.MapBufferAllDispatch() { + public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } + public final long mapBuffer(final int bufferName, final int access, final long glProcAddress) { + return dispatch_glMapNamedBufferEXT(bufferName, access, glProcAddress); + } + }; +private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long glProcAddress); -private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long procAddress); +@Override +public final GLBufferStorage mapNamedBufferRange(final int bufferName, final long offset, final long length, final int access) { + final long glProcAddress = ((GL4bcProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapNamedBufferRangeEXT; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapNamedBufferRangeEXT\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferName, offset, length, access, mapNamedBufferRangeDispatch, glProcAddress); +} +private final jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch mapNamedBufferRangeDispatch = + new jogamp.opengl.GLBufferObjectTracker.MapBufferRangeDispatch() { + public final ByteBuffer allocNioByteBuffer(final long addr, final long length) { return newDirectByteBuffer(addr, length); } + public final long mapBuffer(final int bufferName, final long offset, final long length, final int access, final long glProcAddress) { + return dispatch_glMapNamedBufferRangeEXT(bufferName, offset, length, access, glProcAddress); + } + }; +private native long dispatch_glMapNamedBufferRangeEXT(int buffer, long offset, long length, int access, long procAddress); -native private ByteBuffer newDirectByteBuffer(long addr, long capacity); +@Override +public final java.nio.ByteBuffer glMapNamedBufferEXT(int bufferName, int access) { + return mapNamedBuffer(bufferName, access).getMappedBuffer(); +} - @Override - public final void glVertexPointer(GLArrayData array) { - if(array.getComponentCount()==0) return; - if(array.isVBO()) { - glVertexPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getVBOOffset()); - } else { - glVertexPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getBuffer()); - } - } - @Override - public final void glColorPointer(GLArrayData array) { - if(array.getComponentCount()==0) return; - if(array.isVBO()) { - glColorPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getVBOOffset()); - } else { - glColorPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getBuffer()); - } +@Override +public final ByteBuffer glMapNamedBufferRangeEXT(int bufferName, long offset, long length, int access) { + return mapNamedBufferRange(bufferName, offset, length, access).getMappedBuffer(); +} - } - @Override - public final void glNormalPointer(GLArrayData array) { - if(array.getComponentCount()==0) return; - if(array.getComponentCount()!=3) { - throw new GLException("Only 3 components per normal allowed"); - } - if(array.isVBO()) { - glNormalPointer(array.getComponentType(), array.getStride(), array.getVBOOffset()); - } else { - glNormalPointer(array.getComponentType(), array.getStride(), array.getBuffer()); - } - } - @Override - public final void glTexCoordPointer(GLArrayData array) { - if(array.getComponentCount()==0) return; - if(array.isVBO()) { - glTexCoordPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getVBOOffset()); - } else { - glTexCoordPointer(array.getComponentCount(), array.getComponentType(), array.getStride(), array.getBuffer()); - } - } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 68eadc683..6a7e12ca1 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -1,17 +1,20 @@ public GLES1Impl(GLProfile glp, GLContextImpl context) { this._context = context; if(null != context) { - this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferObjectTracker = context.getBufferObjectTracker(); this.bufferStateTracker = context.getBufferStateTracker(); this.glStateTracker = context.getGLStateTracker(); } else { - this.bufferSizeTracker = null; + this.bufferObjectTracker = null; this.bufferStateTracker = null; this.glStateTracker = null; } this.glProfile = glp; } +public final void finalizeInit() { +} + @Override public final boolean isGL4bc() { return false; @@ -48,6 +51,11 @@ public final boolean isGLES2() { } @Override +public final boolean isGLES3() { + return false; +} + +@Override public final boolean isGLES() { return true; } @@ -63,11 +71,46 @@ public final boolean isGL2ES2() { } @Override +public final boolean isGL2ES3() { + return false; +} + +@Override +public final boolean isGL3ES3() { + return false; +} + +@Override +public final boolean isGL4ES3() { + return false; +} + +@Override +public final boolean isGL4core() { + return false; +} + +@Override +public final boolean isGL3core() { + return false; +} + +@Override +public final boolean isGLcore() { + return false; +} + +@Override public final boolean isGLES2Compatible() { return false; } @Override +public final boolean isGLES3Compatible() { + return false; +} + +@Override public final boolean isGL2GL3() { return false; } @@ -118,16 +161,36 @@ public final GLES2 getGLES2() throws GLException { } @Override +public final GLES3 getGLES3() throws GLException { + throw new GLException("Not a GLES3 implementation"); +} + +@Override public final GL2ES1 getGL2ES1() throws GLException { return this; } @Override +public final GL2ES3 getGL2ES3() throws GLException { + throw new GLException("Not a GL2ES3 implementation"); +} + +@Override public final GL2ES2 getGL2ES2() throws GLException { throw new GLException("Not a GL2ES2 implementation"); } @Override +public final GL3ES3 getGL3ES3() throws GLException { + throw new GLException("Not a GL3ES3 implementation"); +} + +@Override +public final GL4ES3 getGL4ES3() throws GLException { + throw new GLException("Not a GL4ES3 implementation"); +} + +@Override public final GL2GL3 getGL2GL3() throws GLException { throw new GLException("Not a GL2GL3 implementation"); } @@ -136,44 +199,21 @@ public final GL2GL3 getGL2GL3() throws GLException { // Helpers for ensuring the correct amount of texture data // -private final GLBufferSizeTracker bufferSizeTracker; -private final GLBufferStateTracker bufferStateTracker; -private final GLStateTracker glStateTracker; - -private boolean bufferObjectExtensionsInitialized = false; -private boolean haveOESFramebufferObject; - -private final void initBufferObjectExtensionChecks() { - if (bufferObjectExtensionsInitialized) - return; - bufferObjectExtensionsInitialized = true; - haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object"); -} - -private final boolean checkBufferObject(boolean avail, - boolean enabled, +private final boolean checkBufferObject(boolean bound, int state, String kind, boolean throwException) { - if (!avail) { - if (!enabled) - return true; - if(throwException) { - throw new GLException("Required extensions not available to call this function"); - } - return false; - } - int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if (enabled) { - if (buffer == 0) { + final int buffer = bufferStateTracker.getBoundBufferObject(state, this); + if (bound) { + if (0 == buffer) { if(throwException) { - throw new GLException(kind + " must be enabled to call this method"); + throw new GLException(kind + " must be bound to call this method"); } return false; } } else { - if (buffer != 0) { + if (0 != buffer) { if(throwException) { - throw new GLException(kind + " must be disabled to call this method"); + throw new GLException(kind + " must be unbound to call this method"); } return false; } @@ -181,101 +221,50 @@ private final boolean checkBufferObject(boolean avail, return true; } -private final boolean checkArrayVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - false, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); +private final boolean checkArrayVBOUnbound(boolean throwException) { + return checkBufferObject(false, // bound + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); } -private final boolean checkArrayVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - true, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); +private final boolean checkArrayVBOBound(boolean throwException) { + return checkBufferObject(true, // bound + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); } -private final boolean checkElementVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - false, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); +private final boolean checkElementVBOUnbound(boolean throwException) { + return checkBufferObject(false, // bound + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); } -private final boolean checkElementVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - true, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); +private final boolean checkElementVBOBound(boolean throwException) { + return checkBufferObject(true, // bound + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); } -private final boolean checkUnpackPBODisabled(boolean throwException) { +private final boolean checkUnpackPBOUnbound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return true; } -private final boolean checkUnpackPBOEnabled(boolean throwException) { +private final boolean checkUnpackPBOBound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return false; } -private final boolean checkPackPBODisabled(boolean throwException) { +private final boolean checkPackPBOUnbound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return true; } -private final boolean checkPackPBOEnabled(boolean throwException) { +private final boolean checkPackPBOBound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return false; } -private final HashMap<MemoryObject, MemoryObject> arbMemCache = new HashMap<MemoryObject, MemoryObject>(); - -/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -public final java.nio.ByteBuffer glMapBuffer(int target, int access) { - final long __addr_ = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; - if (__addr_ == 0) { - throw new GLException("Method \"glMapBuffer\" not available"); - } - final long sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); - if (0 == sz) { - return null; - } - final long addr = dispatch_glMapBuffer(target, access, __addr_); - if (0 == addr) { - return null; - } - ByteBuffer buffer; - MemoryObject memObj0 = new MemoryObject(addr, sz); // object and key - MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0); - if(memObj0 == memObj1) { - // just added .. - if(null != memObj0.getBuffer()) { - throw new InternalError(); - } - buffer = newDirectByteBuffer(addr, sz); - Buffers.nativeOrder(buffer); - memObj0.setBuffer(buffer); - } else { - // already mapped - buffer = memObj1.getBuffer(); - if(null == buffer) { - throw new InternalError(); - } - } - buffer.position(0); - return buffer; -} - -/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -native private long dispatch_glMapBuffer(int target, int access, long glProcAddress); - -native private ByteBuffer newDirectByteBuffer(long addr, long capacity); - @Override public final void glVertexPointer(GLArrayData array) { if(array.getComponentCount()==0) return; @@ -317,3 +306,44 @@ public final void glTexCoordPointer(GLArrayData array) { } } +// +// GLBufferObjectTracker Redirects +// + +@Override +public final void glBufferData(int target, long size, Buffer data, int usage) { + final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); + } + bufferObjectTracker.createBufferStorage(bufferStateTracker, this, + target, size, data, usage, 0 /* immutableFlags */, + createBoundMutableStorageDispatch, glProcAddress); +} + +@Override +public boolean glUnmapBuffer(int target) { + final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); + } + return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch, glProcAddress); +} + +@Override +public final GLBufferStorage mapBuffer(final int target, final int access) { + final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapBuffer\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch, glProcAddress); +} +@Override +public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { + final long glProcAddress = ((GLES1ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapBufferRange\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch, glProcAddress); +} + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java deleted file mode 100644 index 760287364..000000000 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ /dev/null @@ -1,289 +0,0 @@ - -public GLES2Impl(GLProfile glp, GLContextImpl context) { - this._context = context; - if(null != context) { - this.bufferSizeTracker = context.getBufferSizeTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); - } else { - this.bufferSizeTracker = null; - this.bufferStateTracker = null; - this.glStateTracker = null; - } - this.glProfile = glp; -} - -@Override -public final boolean isGL4bc() { - return false; -} - -@Override -public final boolean isGL4() { - return false; -} - -@Override -public final boolean isGL3bc() { - return false; -} - -@Override -public final boolean isGL3() { - return false; -} - -public final boolean isGL2() { - return false; -} - -@Override -public final boolean isGLES1() { - return false; -} - -@Override -public final boolean isGLES2() { - return true; -} - -@Override -public final boolean isGLES() { - return true; -} - -@Override -public final boolean isGL2ES1() { - return false; -} - -@Override -public final boolean isGL2ES2() { - return true; -} - -@Override -public final boolean isGLES2Compatible() { - return true; -} - -@Override -public final boolean isGL2GL3() { - return false; -} - -@Override -public final boolean hasGLSL() { - return true; -} - -@Override -public boolean isNPOTTextureAvailable() { - return true; -} - -@Override -public final GL4bc getGL4bc() throws GLException { - throw new GLException("Not a GL4bc implementation"); -} - -@Override -public final GL4 getGL4() throws GLException { - throw new GLException("Not a GL4 implementation"); -} - -@Override -public final GL3bc getGL3bc() throws GLException { - throw new GLException("Not a GL3bc implementation"); -} - -@Override -public final GL3 getGL3() throws GLException { - throw new GLException("Not a GL3 implementation"); -} - -@Override -public final GL2 getGL2() throws GLException { - throw new GLException("Not a GL2 implementation"); -} - -@Override -public final GLES1 getGLES1() throws GLException { - throw new GLException("Not a GLES1 implementation"); -} - -@Override -public final GLES2 getGLES2() throws GLException { - return this; -} - -@Override -public final GL2ES1 getGL2ES1() throws GLException { - throw new GLException("Not a GL2ES1 implementation"); -} - -@Override -public final GL2ES2 getGL2ES2() throws GLException { - return this; -} - -@Override -public final GL2GL3 getGL2GL3() throws GLException { - throw new GLException("Not a GL2GL3 implementation"); -} - -// -// Helpers for ensuring the correct amount of texture data -// - -private final GLBufferSizeTracker bufferSizeTracker; -private final GLBufferStateTracker bufferStateTracker; -private final GLStateTracker glStateTracker; - -private boolean bufferObjectExtensionsInitialized = false; -private boolean haveOESFramebufferObject; - -private final void initBufferObjectExtensionChecks() { - if (bufferObjectExtensionsInitialized) - return; - bufferObjectExtensionsInitialized = true; - haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object"); -} - -private final boolean checkBufferObject(boolean avail, - boolean enabled, - int state, - String kind, boolean throwException) { - if (!avail) { - if (!enabled) - return true; - if(throwException) { - throw new GLException("Required extensions not available to call this function"); - } - return false; - } - int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if (enabled) { - if (buffer == 0) { - if(throwException) { - throw new GLException(kind + " must be enabled to call this method"); - } - return false; - } - } else { - if (buffer != 0) { - if(throwException) { - throw new GLException(kind + " must be disabled to call this method"); - } - return false; - } - } - return true; -} - -private final boolean checkArrayVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - false, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); -} - -private final boolean checkArrayVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - true, - GL.GL_ARRAY_BUFFER, - "array vertex_buffer_object", throwException); -} - -private final boolean checkElementVBODisabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - false, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); -} - -private final boolean checkElementVBOEnabled(boolean throwException) { - initBufferObjectExtensionChecks(); - return checkBufferObject(true, - true, - GL.GL_ELEMENT_ARRAY_BUFFER, - "element vertex_buffer_object", throwException); -} - -private final boolean checkUnpackPBODisabled(boolean throwException) { - // PBO n/a for ES 1.1 or ES 2.0 - return true; -} - -private final boolean checkUnpackPBOEnabled(boolean throwException) { - // PBO n/a for ES 1.1 or ES 2.0 - return false; -} - -private final boolean checkPackPBODisabled(boolean throwException) { - // PBO n/a for ES 1.1 or ES 2.0 - return true; -} - -private final boolean checkPackPBOEnabled(boolean throwException) { - // PBO n/a for ES 1.1 or ES 2.0 - return false; -} - -private final HashMap<MemoryObject, MemoryObject> arbMemCache = new HashMap<MemoryObject, MemoryObject>(); - -/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -@Override -public final java.nio.ByteBuffer glMapBuffer(int target, int access) { - final long __addr_ = ((GLES2ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; - if (__addr_ == 0) { - throw new GLException("Method \"glMapBuffer\" not available"); - } - final long sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this); - if (0 == sz) { - return null; - } - final long addr = dispatch_glMapBuffer(target, access, __addr_); - if (0 == addr) { - return null; - } - ByteBuffer buffer; - MemoryObject memObj0 = new MemoryObject(addr, sz); // object and key - MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0); - if(memObj0 == memObj1) { - // just added .. - if(null != memObj0.getBuffer()) { - throw new InternalError(); - } - buffer = newDirectByteBuffer(addr, sz); - Buffers.nativeOrder(buffer); - memObj0.setBuffer(buffer); - } else { - // already mapped - buffer = memObj1.getBuffer(); - if(null == buffer) { - throw new InternalError(); - } - } - buffer.position(0); - return buffer; -} - -/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ -native private long dispatch_glMapBuffer(int target, int access, long glProcAddress); - -native private ByteBuffer newDirectByteBuffer(long addr, long capacity); - -@Override -public final void glClearDepth(double depth) { - glClearDepthf((float)depth); -} - -@Override -public final void glDepthRange(double zNear, double zFar) { - glDepthRangef((float)zNear, (float)zFar); -} - diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java new file mode 100644 index 000000000..42adca4b1 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java @@ -0,0 +1,392 @@ + +public GLES3Impl(GLProfile glp, GLContextImpl context) { + this._context = context; + if(null != context) { + this.bufferObjectTracker = context.getBufferObjectTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + } else { + this.bufferObjectTracker = null; + this.bufferStateTracker = null; + this.glStateTracker = null; + } + this.glProfile = glp; + this._isES3 = glp.getImplName() == GLProfile.GLES3; +} + +public final void finalizeInit() { +} + +@Override +public final boolean isGL4bc() { + return false; +} + +@Override +public final boolean isGL4() { + return false; +} + +@Override +public final boolean isGL3bc() { + return false; +} + +@Override +public final boolean isGL3() { + return false; +} + +public final boolean isGL2() { + return false; +} + +@Override +public final boolean isGLES1() { + return false; +} + +@Override +public final boolean isGLES2() { + return true; +} + +@Override +public final boolean isGLES3() { + return _isES3; +} + +@Override +public final boolean isGLES() { + return true; +} + +@Override +public final boolean isGL2ES1() { + return false; +} + +@Override +public final boolean isGL2ES2() { + return true; +} + +@Override +public final boolean isGL2ES3() { + return _isES3; +} + +@Override +public final boolean isGL3ES3() { + return _isES3; +} + +@Override +public final boolean isGL4ES3() { + return _isES3; +} + +@Override +public final boolean isGL4core() { + return false; +} + +@Override +public final boolean isGL3core() { + return false; +} + +@Override +public final boolean isGLcore() { + return true; +} + +@Override +public final boolean isGLES2Compatible() { + return true; +} + +@Override +public final boolean isGLES3Compatible() { + return _isES3; +} + + +@Override +public final boolean isGL2GL3() { + return false; +} + +@Override +public final boolean hasGLSL() { + return true; +} + +@Override +public boolean isNPOTTextureAvailable() { + return true; +} + +@Override +public final GL4bc getGL4bc() throws GLException { + throw new GLException("Not a GL4bc implementation"); +} + +@Override +public final GL4 getGL4() throws GLException { + throw new GLException("Not a GL4 implementation"); +} + +@Override +public final GL3bc getGL3bc() throws GLException { + throw new GLException("Not a GL3bc implementation"); +} + +@Override +public final GL3 getGL3() throws GLException { + throw new GLException("Not a GL3 implementation"); +} + +@Override +public final GL2 getGL2() throws GLException { + throw new GLException("Not a GL2 implementation"); +} + +@Override +public final GLES1 getGLES1() throws GLException { + throw new GLException("Not a GLES1 implementation"); +} + +@Override +public final GLES2 getGLES2() throws GLException { + return this; +} + +@Override +public final GLES3 getGLES3() throws GLException { + return this; +} + +@Override +public final GL2ES1 getGL2ES1() throws GLException { + throw new GLException("Not a GL2ES1 implementation"); +} + +@Override +public final GL2ES2 getGL2ES2() throws GLException { + return this; +} + +@Override +public final GL2ES3 getGL2ES3() throws GLException { + if(!_isES3) { + throw new GLException("Not a GL2ES3 implementation"); + } + return this; +} + +@Override +public final GL3ES3 getGL3ES3() throws GLException { + if(!_isES3) { + throw new GLException("Not a GL3ES3 implementation"); + } + return this; +} + +@Override +public final GL4ES3 getGL4ES3() throws GLException { + if(!_isES3) { + throw new GLException("Not a GL4ES3 implementation"); + } + return this; +} + +@Override +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +private final boolean _isES3; + +private final boolean checkBufferObject(boolean extensionAvail, + boolean allowVAO, + boolean bound, + int state, + String kind, boolean throwException) { + if ( !extensionAvail ) { + if ( !bound ) { + return true; + } + if(throwException) { + throw new GLException("Required extensions not available to call this function"); + } + return false; + } + int buffer = bufferStateTracker.getBoundBufferObject(state, this); + if ( bound ) { + if ( 0 != buffer ) { + return true; + } + if ( allowVAO ) { + buffer = bufferStateTracker.getBoundBufferObject(GL2ES3.GL_VERTEX_ARRAY_BINDING, this); + if( 0 != buffer && _context.getDefaultVAO() != buffer ) { + return true; + } + } + if ( throwException ) { + throw new GLException(kind + " must be bound to call this method"); + } + return false; + } else { + if ( 0 == buffer ) { + return true; + } + if ( throwException ) { + throw new GLException(kind + " must be unbound to call this method"); + } + return false; + } +} + +private final void validateCPUSourcedAvail() { + if(!_context.isCPUDataSourcingAvail()) { + throw new GLException("CPU data sourcing n/a w/ "+_context); + } +} + +private final boolean checkArrayVBOUnbound(boolean throwException) { + if(throwException) { + validateCPUSourcedAvail(); + } + return checkBufferObject(true, + _isES3, // allowVAO + false, // bound + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private final boolean checkArrayVBOBound(boolean throwException) { + return checkBufferObject(true, + _isES3, // allowVAO + true, // bound + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private final boolean checkElementVBOUnbound(boolean throwException) { + if(throwException) { + validateCPUSourcedAvail(); + } + return checkBufferObject(true, + _isES3, // allowVAO + false, // bound + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private final boolean checkElementVBOBound(boolean throwException) { + return checkBufferObject(true, + _isES3, // allowVAO + true, // bound + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private final boolean checkUnpackPBOUnbound(boolean throwException) { + return checkBufferObject(_isES3, + false, // allowVAO + false, // bound + GL2.GL_PIXEL_UNPACK_BUFFER, + "unpack pixel_buffer_object", throwException); +} + +private final boolean checkUnpackPBOBound(boolean throwException) { + return checkBufferObject(_isES3, + false, // allowVAO + true, // bound + GL2.GL_PIXEL_UNPACK_BUFFER, + "unpack pixel_buffer_object", throwException); +} + +private final boolean checkPackPBOUnbound(boolean throwException) { + return checkBufferObject(_isES3, + false, // allowVAO + false, // bound + GL2.GL_PIXEL_PACK_BUFFER, + "pack pixel_buffer_object", throwException); +} + +private final boolean checkPackPBOBound(boolean throwException) { + return checkBufferObject(_isES3, + false, // allowVAO + true, // bound + GL2.GL_PIXEL_PACK_BUFFER, + "pack pixel_buffer_object", throwException); +} + +@Override +public final boolean isPBOPackBound() { + return checkPackPBOBound(false); +} + +@Override +public final boolean isPBOUnpackBound() { + return checkUnpackPBOBound(false); +} + +@Override +public final void glClearDepth(double depth) { + glClearDepthf((float)depth); +} + +@Override +public final void glDepthRange(double zNear, double zFar) { + glDepthRangef((float)zNear, (float)zFar); +} + +// +// GLBufferObjectTracker Redirects +// + +@Override +public final void glBufferData(int target, long size, Buffer data, int usage) { + final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glBufferData; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glBufferData")); + } + bufferObjectTracker.createBufferStorage(bufferStateTracker, this, + target, size, data, usage, 0 /* immutableFlags */, + createBoundMutableStorageDispatch, glProcAddress); +} + +@Override +public boolean glUnmapBuffer(int target) { + final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glUnmapBuffer; + if ( 0 == glProcAddress ) { + throw new GLException(String.format("Method \"%s\" not available", "glUnmapBuffer")); + } + return bufferObjectTracker.unmapBuffer(bufferStateTracker, this, target, unmapBoundBufferDispatch, glProcAddress); +} + +@Override +public final GLBufferStorage mapBuffer(final int target, final int access) { + final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapBuffer\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, access, mapBoundBufferAllDispatch, glProcAddress); +} +@Override +public final GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) { + final long glProcAddress = ((GLES3ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBufferRange; + if ( 0 == glProcAddress ) { + throw new GLException("Method \"glMapBufferRange\" not available"); + } + return bufferObjectTracker.mapBuffer(bufferStateTracker, this, target, offset, length, access, mapBoundBufferRangeDispatch, glProcAddress); +} + + diff --git a/make/config/jogl/gl2-common-cpubufferJavaCode.java b/make/config/jogl/gl2-common-cpubufferJavaCode.java new file mode 100644 index 000000000..50a97b3df --- /dev/null +++ b/make/config/jogl/gl2-common-cpubufferJavaCode.java @@ -0,0 +1,13 @@ + + /** Entry point to C language function: <code> void {@native glDrawElementsInstanced}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei instancecount); </code> <br>Part of <code>GL_ES_VERSION_3_0</code>, <code>GL_VERSION_3_1</code>; <code>GL_ARB_draw_instanced</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElementsInstanced(int mode, int count, int type, Buffer indices, int instancecount); + + /** Entry point to C language function: <code> void {@native glDrawRangeElements}(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); </code> <br>Part of <code>GL_VERSION_1_2</code>, <code>GL_ES_VERSION_3_0</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawRangeElements(int mode, int start, int end, int count, int type, Buffer indices); + + /** Entry point to C language function: <code> void {@native glVertexAttribIPointer}(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); </code> <br>Part of <code>GL_ES_VERSION_3_0</code>, <code>GL_VERSION_3_0</code> + @param pointer a direct only {@link java.nio.Buffer} */ + public void glVertexAttribIPointer(int index, int size, int type, int stride, Buffer pointer); + diff --git a/make/config/jogl/gl2_es1-common-cpubufferJavaCode.java b/make/config/jogl/gl2_es1-common-cpubufferJavaCode.java new file mode 100644 index 000000000..39bc141b8 --- /dev/null +++ b/make/config/jogl/gl2_es1-common-cpubufferJavaCode.java @@ -0,0 +1,4 @@ + /** Entry point to C language function: <code> void {@native glDrawElements}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); </code> <br>Part of <code>GL_VERSION_ES_CL_CM</code>, <code>GL_VERSION_1_1</code>, <code>GL_ES_VERSION_2_0</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElements(int mode, int count, int type, Buffer indices); + diff --git a/make/config/jogl/gl2_es2-CustomJavaCode.cfg b/make/config/jogl/gl2_es2-CustomJavaCode.cfg new file mode 100644 index 000000000..b769f3b29 --- /dev/null +++ b/make/config/jogl/gl2_es2-CustomJavaCode.cfg @@ -0,0 +1,13 @@ + +JavaPrologue glReleaseShaderCompiler if ( !_context.isGLES2Compatible() ) { +JavaPrologue glReleaseShaderCompiler return; +JavaPrologue glReleaseShaderCompiler } + +JavaPrologue glShaderBinary if ( !_context.isGLES2Compatible() ) { +JavaPrologue glShaderBinary throw new GLException("Method \"glShaderBinary\" not available"); +JavaPrologue glShaderBinary } + +JavaPrologue glGetShaderPrecisionFormat if ( !_context.isGLES2Compatible() ) { +JavaPrologue glGetShaderPrecisionFormat throw new GLException("Method \"glGetShaderPrecisionFormat\" not available"); +JavaPrologue glGetShaderPrecisionFormat } + diff --git a/make/config/jogl/gl2_es2-common-cpubufferJavaCode.java b/make/config/jogl/gl2_es2-common-cpubufferJavaCode.java new file mode 100644 index 000000000..fe6820e1f --- /dev/null +++ b/make/config/jogl/gl2_es2-common-cpubufferJavaCode.java @@ -0,0 +1,4 @@ + /** Entry point to C language function: <code> void {@native glVertexAttribPointer}(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * ptr); </code> <br>Part of <code>GL_ES_VERSION_2_0</code>, <code>GL_VERSION_2_0</code> + @param ptr a direct only {@link java.nio.Buffer} */ + public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, Buffer ptr); + diff --git a/make/config/jogl/gl2_es2-common.cfg b/make/config/jogl/gl2_es2-common.cfg index d26c76ead..2ad7fd3fd 100644 --- a/make/config/jogl/gl2_es2-common.cfg +++ b/make/config/jogl/gl2_es2-common.cfg @@ -1,23 +1,11 @@ -JavaPrologue glReleaseShaderCompiler if ( !_context.isGLES2Compatible() ) { -JavaPrologue glReleaseShaderCompiler return; -JavaPrologue glReleaseShaderCompiler } +RenameExtensionIntoCore GL_KHR_debug +RenameExtensionIntoCore GL_OES_texture_3D +RenameExtensionIntoCore GL_OES_get_program_binary +RenameExtensionIntoCore GL_OES_required_internalformat +RenameExtensionIntoCore GL_EXT_unpack_subimage -JavaPrologue glShaderBinary if ( !_context.isGLES2Compatible() ) { -JavaPrologue glShaderBinary throw new GLException("Method \"glShaderBinary\" not available"); -JavaPrologue glShaderBinary } +ForceExtension GL_EXT_occlusion_query_boolean -JavaPrologue glGetShaderPrecisionFormat if ( !_context.isGLES2Compatible() ) { -JavaPrologue glGetShaderPrecisionFormat throw new GLException("Method \"glGetShaderPrecisionFormat\" not available"); -JavaPrologue glGetShaderPrecisionFormat } - -JavaPrologue glDepthRangef if ( !_context.isGLES2Compatible() ) { -JavaPrologue glDepthRangef glDepthRange( (double)zNear, (double)zFar ); -JavaPrologue glDepthRangef return; -JavaPrologue glDepthRangef } - -JavaPrologue glClearDepthf if ( !_context.isGLES2Compatible() ) { -JavaPrologue glClearDepthf glClearDepth( (double)depth ); -JavaPrologue glClearDepthf return; -JavaPrologue glClearDepthf } +ForceExtension GL_ARB_ES2_compatibility diff --git a/make/config/jogl/gl2_es3-common.cfg b/make/config/jogl/gl2_es3-common.cfg new file mode 100644 index 000000000..b5326b159 --- /dev/null +++ b/make/config/jogl/gl2_es3-common.cfg @@ -0,0 +1,9 @@ + +RenameExtensionIntoCore GL_KHR_debug +RenameExtensionIntoCore GL_OES_texture_3D +IgnoreExtension GL_OES_get_program_binary +RenameExtensionIntoCore GL_OES_required_internalformat +RenameExtensionIntoCore GL_EXT_unpack_subimage + +ForceExtension GL_EXT_occlusion_query_boolean + diff --git a/make/config/jogl/gl3-common.cfg b/make/config/jogl/gl3-common.cfg new file mode 100644 index 000000000..e11c50aa3 --- /dev/null +++ b/make/config/jogl/gl3-common.cfg @@ -0,0 +1,9 @@ + +ForceExtension GL_ARB_debug_output +RenameExtensionIntoCore GL_KHR_debug + +RenameExtensionIntoCore GL_OES_texture_3D +IgnoreExtension GL_OES_get_program_binary +RenameExtensionIntoCore GL_OES_required_internalformat +RenameExtensionIntoCore GL_EXT_unpack_subimage + diff --git a/make/config/jogl/gl3-desktop.cfg b/make/config/jogl/gl3-desktop.cfg index 96e59aa05..4a2c53371 100644 --- a/make/config/jogl/gl3-desktop.cfg +++ b/make/config/jogl/gl3-desktop.cfg @@ -1,11 +1,6 @@ # This .cfg file provides common options used by the desktop OpenGL # implementation on all platforms. -# Inform the glue code generator of the association between #defines -# and functions and the extensions in which they are defined -GLHeader GL3/gl3.h -GLHeader GL3/gl3ext.h - #Include gl-desktop-tracker.cfg # diff --git a/make/config/jogl/gl3-headers.cfg b/make/config/jogl/gl3-headers.cfg index 8b35a07b4..d76d3ae4c 100644 --- a/make/config/jogl/gl3-headers.cfg +++ b/make/config/jogl/gl3-headers.cfg @@ -1,7 +1,6 @@ CustomCCode #include <stdio.h> /* android */ -CustomCCode /* Define GL3_PROTOTYPES so that the OpenGL extension prototypes in -CustomCCode "gl3.h" are parsed. */ -CustomCCode #define GL3_PROTOTYPES +CustomCCode /** Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES CustomCCode #if defined(_WIN32) CustomCCode #define WIN32_LEAN_AND_MEAN CustomCCode #include <windows.h> @@ -9,12 +8,14 @@ CustomCCode #undef WIN32_LEAN_AND_MEAN CustomCCode #include <stdlib.h> CustomCCode #include <stddef.h> CustomCCode #include <malloc.h> -CustomCCode #include <GL3/gl3.h> -CustomCCode #elif defined(macosx) +CustomCCode #include <GL/glcorearb.h> +CustomCCode #include <GL/glcorearbext.h> +CustomCCode #elif defined(__APPLE__) CustomCCode #include <inttypes.h> CustomCCode #include <stdlib.h> -CustomCCode #include <GL3/gl3.h> -CustomCCode #include </usr/include/machine/types.h> +CustomCCode #include <GL/glcorearb.h> +CustomCCode #include <GL/glcorearbext.h> +CustomCCode #include <machine/types.h> CustomCCode /* Provide Windows typedefs */ CustomCCode typedef void* LPVOID; CustomCCode typedef unsigned int* PUINT; @@ -22,5 +23,6 @@ CustomCCode #elif defined(__unix__) CustomCCode #include <inttypes.h> CustomCCode #include <stdlib.h> CustomCCode #include <X11/Xlib.h> -CustomCCode #include <GL3/gl3.h> +CustomCCode #include <GL/glcorearb.h> +CustomCCode #include <GL/glcorearbext.h> CustomCCode #endif diff --git a/make/config/jogl/gl3bc-common-cpubufferJavaCode.java b/make/config/jogl/gl3bc-common-cpubufferJavaCode.java new file mode 100644 index 000000000..d5d2ec836 --- /dev/null +++ b/make/config/jogl/gl3bc-common-cpubufferJavaCode.java @@ -0,0 +1,13 @@ + + /** Entry point to C language function: <code> void {@native glDrawElementsBaseVertex}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); </code> <br>Part of <code>GL_ARB_draw_elements_base_vertex</code>, <code>GL_VERSION_3_2</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElementsBaseVertex(int mode, int count, int type, Buffer indices, int basevertex); + + /** Entry point to C language function: <code> void {@native glDrawElementsInstancedBaseVertex}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei instancecount, GLint basevertex); </code> <br>Part of <code>GL_ARB_draw_elements_base_vertex</code>, <code>GL_VERSION_3_2</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElementsInstancedBaseVertex(int mode, int count, int type, Buffer indices, int instancecount, int basevertex); + + /** Entry point to C language function: <code> void {@native glDrawRangeElementsBaseVertex}(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); </code> <br>Part of <code>GL_ARB_draw_elements_base_vertex</code>, <code>GL_VERSION_3_2</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawRangeElementsBaseVertex(int mode, int start, int end, int count, int type, Buffer indices, int basevertex); + diff --git a/make/config/jogl/gl3ext-headers.cfg b/make/config/jogl/gl3ext-headers.cfg index 5e2c7aa37..24b1ba518 100644 --- a/make/config/jogl/gl3ext-headers.cfg +++ b/make/config/jogl/gl3ext-headers.cfg @@ -1,6 +1,4 @@ CustomCCode #include <stdio.h> /* android */ -CustomCCode /* Define GL_GL3EXT_PROTOTYPES so that the OpenGL extension prototypes in -CustomCCode "gl3ext.h" are parsed. */ -CustomCCode #define GL_GL3EXT_PROTOTYPES -CustomCCode #include <GL3/gl3ext.h> -CustomCCode #include <GL3/gl3ext.h> +CustomCCode /** Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES +CustomCCode #include <GL/glcorearbext.h> diff --git a/make/config/jogl/gl4bc-common-cpubufferJavaCode.java b/make/config/jogl/gl4bc-common-cpubufferJavaCode.java new file mode 100644 index 000000000..39dc9f6c4 --- /dev/null +++ b/make/config/jogl/gl4bc-common-cpubufferJavaCode.java @@ -0,0 +1,25 @@ + + /** Entry point to C language function: <code> void {@native glDrawArraysIndirect}(GLenum mode, const GLvoid * indirect); </code> <br>Part of <code>GL_VERSION_4_0</code>, <code>GL_ARB_draw_indirect</code> + @param indirect a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawArraysIndirect(int mode, Buffer indirect); + + /** Entry point to C language function: <code> void {@native glDrawElementsIndirect}(GLenum mode, GLenum type, const GLvoid * indirect); </code> <br>Part of <code>GL_VERSION_4_0</code>, <code>GL_ARB_draw_indirect</code> + @param indirect a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElementsIndirect(int mode, int type, Buffer indirect); + + /** Entry point to C language function: <code> void {@native glMultiDrawArraysIndirect}(GLenum mode, const void * indirect, GLsizei drawcount, GLsizei stride); </code> <br>Part of <code>GL_VERSION_4_3</code>, <code>GL_ARB_multi_draw_indirect</code> + @param indirect a direct or array-backed {@link java.nio.Buffer} */ + public void glMultiDrawArraysIndirect(int mode, Buffer indirect, int drawcount, int stride); + + /** Entry point to C language function: <code> void {@native glDrawElementsInstancedBaseInstance}(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLuint baseinstance); </code> <br>Part of <code>GL_VERSION_4_2</code>, <code>GL_ARB_base_instance</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElementsInstancedBaseInstance(int mode, int count, int type, Buffer indices, int instancecount, int baseinstance); + + /** Entry point to C language function: <code> void {@native glDrawElementsInstancedBaseVertexBaseInstance}(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); </code> <br>Part of <code>GL_VERSION_4_2</code>, <code>GL_ARB_base_instance</code> + @param indices a direct or array-backed {@link java.nio.Buffer} */ + public void glDrawElementsInstancedBaseVertexBaseInstance(int mode, int count, int type, Buffer indices, int instancecount, int basevertex, int baseinstance); + + /** Entry point to C language function: <code> void {@native glVertexAttribLPointer}(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); </code> <br>Part of <code>GL_VERSION_4_1</code>, <code>GL_ARB_vertex_attrib_64bit</code> + @param pointer a direct only {@link java.nio.Buffer} */ + public void glVertexAttribLPointer(int index, int size, int type, int stride, Buffer pointer); + diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java index 49722b469..e8047d9d7 100644 --- a/make/config/jogl/glu-CustomJavaCode-base.java +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -83,11 +83,16 @@ static { Class _gl2Class=null; Class _gl2es1Class=null; try { - _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2"); - _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1"); + final ClassLoader cl = GLU.class.getClassLoader(); + _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2", false, cl); + _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1", false, cl); } catch (Throwable t) {} gl2Class = _gl2Class; gl2es1Class = _gl2es1Class; + /** Not required nor forced + if( !initializeImpl() ) { + throw new RuntimeException("Initialization failure"); + } */ } /** @@ -123,14 +128,7 @@ public static final GLU createGLU(GL gl) throws GLException { public GLU() { - this.project = new ProjectFloat(); -} - -public void destroy() { - if(null!=this.project) { - this.project.destroy(); - this.project=null; - } + project = new ProjectFloat(); } public static final GL getCurrentGL() throws GLException { @@ -1250,16 +1248,24 @@ public final void gluDisk(GLUquadric quad, double inner, double outer, int slice /** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> GLUquadric * gluNewQuadric(void); </code> */ public final GLUquadric gluNewQuadric() { - return gluNewQuadric(false); + return gluNewQuadric(false, null, 0); +} + +public final GLUquadric gluNewQuadric(boolean useGLSL, ShaderState st) { + return gluNewQuadric(useGLSL, st, 0); +} + +public final GLUquadric gluNewQuadric(boolean useGLSL, int shaderProgram) { + return gluNewQuadric(useGLSL, null, shaderProgram); } -public final GLUquadric gluNewQuadric(boolean useGLSL) { +private final GLUquadric gluNewQuadric(boolean useGLSL, ShaderState st, int shaderProgram) { GL gl = getCurrentGL(); if(useGLSL && !gl.isGL2ES2()) { throw new GLException("GLUquadric GLSL implementation not supported for profile: "+gl); } validateGLUquadricImpl(); - return new GLUquadricImpl(gl, useGLSL); + return new GLUquadricImpl(gl, useGLSL, st, shaderProgram); } /** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ @@ -1302,7 +1308,7 @@ public final void gluSphere(GLUquadric quad, double radius, int slices, int stac // Projection routines // -private ProjectFloat project; +private final ProjectFloat project; public void gluOrtho2D(float left, float right, float bottom, float top) { project.gluOrtho2D(getCurrentGL().getGL2ES1(), left, right, bottom, top); diff --git a/make/config/jogl/glu-CustomJavaCode-gl2.java b/make/config/jogl/glu-CustomJavaCode-gl2.java index 4dcb5691e..d7ba58de4 100644 --- a/make/config/jogl/glu-CustomJavaCode-gl2.java +++ b/make/config/jogl/glu-CustomJavaCode-gl2.java @@ -7,6 +7,10 @@ static { if (val != null && !val.toLowerCase().equals("false")) { useJavaMipmapCode = false; } + /** Not required nor forced + if( !initializeImpl() ) { + throw new RuntimeException("Initialization failure"); + } */ return null; } }); @@ -31,18 +35,9 @@ static { public GLUgl2() { - this.project = new ProjectDouble(); + project = new ProjectDouble(); } -public void destroy() { - if(null!=this.project) { - this.project.destroy(); - this.project=null; - } - super.destroy(); -} - - //---------------------------------------------------------------------- // Utility routines // @@ -132,7 +127,7 @@ public final boolean isFunctionAvailable(String gluFunctionName) // Projection routines // -private ProjectDouble project; +private final ProjectDouble project; public final void gluOrtho2D(float left, float right, float bottom, float top) { project.gluOrtho2D(getCurrentGL2(), (double)left, (double)right, (double)bottom, (double)top); diff --git a/make/config/jogl/glu-CustomJavaCode-gl2es1.java b/make/config/jogl/glu-CustomJavaCode-gl2es1.java index 203d1eeae..41a7e5b9b 100644 --- a/make/config/jogl/glu-CustomJavaCode-gl2es1.java +++ b/make/config/jogl/glu-CustomJavaCode-gl2es1.java @@ -8,6 +8,10 @@ static { if (val != null && !val.toLowerCase().equals("false")) { useJavaMipmapCode = false; } + // Not required nor forced + // if( !initializeImpl() ) { + // throw new RuntimeException("Initialization failure"); + // } return null; } }); @@ -36,10 +40,6 @@ public GLUgl2es1() super(); } -public void destroy() { - super.destroy(); -} - //---------------------------------------------------------------------- // Utility routines // diff --git a/make/config/jogl/glu-base.cfg b/make/config/jogl/glu-base.cfg index f4021d6d8..05aa2110e 100644 --- a/make/config/jogl/glu-base.cfg +++ b/make/config/jogl/glu-base.cfg @@ -18,6 +18,7 @@ Ignore gluScaleImage # Custom Java code for GLU class IncludeAs CustomJavaCode GLU glu-CustomJavaCode-base.java +ManualStaticInitCall GLU # Imports for the Error and Registry classes Import jogamp.opengl.glu.error.Error diff --git a/make/config/jogl/glu-common.cfg b/make/config/jogl/glu-common.cfg index 9271ec3c6..85d556b77 100644 --- a/make/config/jogl/glu-common.cfg +++ b/make/config/jogl/glu-common.cfg @@ -11,6 +11,7 @@ TagNativeBinding true # Import javax.media.opengl.* Import javax.media.opengl.glu.* +import com.jogamp.opengl.util.glsl.ShaderState Import jogamp.opengl.* Import jogamp.opengl.glu.* Import jogamp.opengl.glu.tessellator.GLUtessellatorImpl diff --git a/make/config/jogl/glu-gl2.cfg b/make/config/jogl/glu-gl2.cfg index 9387b4c4a..696e07050 100644 --- a/make/config/jogl/glu-gl2.cfg +++ b/make/config/jogl/glu-gl2.cfg @@ -15,24 +15,26 @@ CustomCCode #include <windows.h> CustomCCode #undef WIN32_LEAN_AND_MEAN CustomCCode CustomCCode #include <stddef.h> -CustomCCode #elif defined(macosx) +CustomCCode #elif defined(__APPLE__) CustomCCode #include <inttypes.h> CustomCCode #include <jni.h> -CustomCCode #include </usr/include/machine/types.h> +CustomCCode #include <machine/types.h> CustomCCode #elif defined(__unix__) CustomCCode #include <inttypes.h> CustomCCode #endif EmitProcAddressTable true -ProcAddressTablePackage jogamp.opengl.glu.gl2 +ProcAddressTablePackage javax.media.opengl.glu.gl2 ProcAddressTableClassName GLUgl2ProcAddressTable GetProcAddressTableExpr getGLUProcAddressTable() +AccessControl javax.media.opengl.glu.gl2.GLUgl2ProcAddressTable PACKAGE_PRIVATE CustomCCode /* Include the OpenGL GLU header */ CustomCCode #include <GL/glu.h> # Custom Java code for GLU class IncludeAs CustomJavaCode GLUgl2 glu-CustomJavaCode-gl2.java +ManualStaticInitCall GLUgl2 # GLU needs access to the GLUtesselatorImpl class for GLUtesselator, # to the Mipmap class for scaling and mipmap generation, diff --git a/make/config/jogl/glu-gl2es1.cfg b/make/config/jogl/glu-gl2es1.cfg index fa7011360..ef9405fac 100644 --- a/make/config/jogl/glu-gl2es1.cfg +++ b/make/config/jogl/glu-gl2es1.cfg @@ -18,6 +18,7 @@ Ignore gluScaleImage # Custom Java code for GLU class IncludeAs CustomJavaCode GLUgl2es1 glu-CustomJavaCode-gl2es1.java +ManualStaticInitCall GLUgl2es1 Import javax.media.opengl.GLES1 Import jogamp.opengl.glu.mipmap.Mipmap diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c index e372e5120..7216e5b65 100644 --- a/make/config/jogl/glx-CustomCCode.c +++ b/make/config/jogl/glx-CustomCCode.c @@ -12,51 +12,35 @@ #define RTLD_DEFAULT NULL #endif +#include <string.h> + /* We expect glXGetProcAddressARB to be defined */ extern void (*glXGetProcAddressARB(const GLubyte *procname))(); -static const char * clazzNameBuffers = "com/jogamp/common/nio/Buffers"; -static const char * clazzNameBuffersStaticCstrName = "copyByteBuffer"; -static const char * clazzNameBuffersStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;"; -static const char * clazzNameByteBuffer = "java/nio/ByteBuffer"; -static jclass clazzBuffers = NULL; -static jmethodID cstrBuffers = NULL; -static jclass clazzByteBuffer = NULL; - -static void _initClazzAccess(JNIEnv *env) { - jclass c; - - if(NULL!=cstrBuffers) return ; - - c = (*env)->FindClass(env, clazzNameBuffers); - if(NULL==c) { - fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't find %s\n", clazzNameBuffers); - (*env)->FatalError(env, clazzNameBuffers); - } - clazzBuffers = (jclass)(*env)->NewGlobalRef(env, c); - if(NULL==clazzBuffers) { - fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't use %s\n", clazzNameBuffers); - (*env)->FatalError(env, clazzNameBuffers); - } - c = (*env)->FindClass(env, clazzNameByteBuffer); - if(NULL==c) { - fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't find %s\n", clazzNameByteBuffer); - (*env)->FatalError(env, clazzNameByteBuffer); +/** + * Java->C glue code: + * Java package: jogamp.opengl.x11.glx.GLX + * Java method: int glXGetFBConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) + */ +JNIEXPORT jint JNICALL +Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigAttributes(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 int (APIENTRY*_local_PFNGLXGETFBCONFIGATTRIBPROC)(Display * dpy, GLXFBConfig config, int attribute, int * value); + _local_PFNGLXGETFBCONFIGATTRIBPROC ptr_glXGetFBConfigAttrib = (_local_PFNGLXGETFBCONFIGATTRIBPROC) (intptr_t) procAddress; + assert(ptr_glXGetFBConfigAttrib != NULL); + + int err = 0; + if ( attributeCount > 0 && NULL != attributes ) { + int i; + int * attributes_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attributes)) + attributes_byte_offset); + int * values_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, values)) + values_byte_offset); + for(i=0; 0 == err && i<attributeCount; i++) { + err = (* ptr_glXGetFBConfigAttrib) ((Display *) (intptr_t) dpy, (GLXFBConfig) (intptr_t) config, attributes_ptr[i], &values_ptr[i]); } - clazzByteBuffer = (jclass)(*env)->NewGlobalRef(env, c); - if(NULL==c) { - fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX: can't use %s\n", clazzNameByteBuffer); - (*env)->FatalError(env, clazzNameByteBuffer); - } - - cstrBuffers = (*env)->GetStaticMethodID(env, clazzBuffers, - clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature); - if(NULL==cstrBuffers) { - fprintf(stderr, "FatalError: Java_jogamp_opengl_x11_glx_GLX:: can't create %s.%s %s\n", - clazzNameBuffers, - clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature); - (*env)->FatalError(env, clazzNameBuffersStaticCstrName); + if( 0 != err ) { + values_ptr[0] = i; } + } + return (jint)err; } /* Java->C glue code: @@ -69,19 +53,13 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetVisualFromFBConfig(JNIEnv *env, j typedef XVisualInfo* (APIENTRY*_local_PFNGLXGETVISUALFROMFBCONFIG)(Display * dpy, GLXFBConfig config); _local_PFNGLXGETVISUALFROMFBCONFIG ptr_glXGetVisualFromFBConfig; XVisualInfo * _res; - jobject jbyteSource; jobject jbyteCopy; ptr_glXGetVisualFromFBConfig = (_local_PFNGLXGETVISUALFROMFBCONFIG) (intptr_t) procAddress; assert(ptr_glXGetVisualFromFBConfig != NULL); _res = (* ptr_glXGetVisualFromFBConfig) ((Display *) (intptr_t) dpy, (GLXFBConfig) (intptr_t) config); if (_res == NULL) return NULL; - _initClazzAccess(env); - - jbyteSource = (*env)->NewDirectByteBuffer(env, _res, sizeof(XVisualInfo)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); - - (*env)->DeleteLocalRef(env, jbyteSource); + jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo)); XFree(_res); return jbyteCopy; @@ -89,77 +67,120 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetVisualFromFBConfig(JNIEnv *env, j /* Java->C glue code: * Java package: jogamp.opengl.x11.glx.GLX - * Java method: java.nio.LongBuffer glXChooseFBConfig(long dpy, int screen, java.nio.IntBuffer attribList, java.nio.IntBuffer nitems) + * Java method: com.jogamp.common.nio.PointerBuffer dispatch_glXChooseFBConfig(long dpy, int screen, java.nio.IntBuffer attribList, java.nio.IntBuffer nitems) * C function: GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); */ JNIEXPORT jobject JNICALL Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jobject nitems, jint nitems_byte_offset, jlong procAddress) { - typedef GLXFBConfig* (APIENTRY*_local_PFNGLXCHOOSEFBCONFIG)(Display * dpy, int screen, const int * attribList, int * nitems); - _local_PFNGLXCHOOSEFBCONFIG ptr_glXChooseFBConfig; - int * _ptr2 = NULL; - int * _ptr3 = NULL; + typedef GLXFBConfig * (APIENTRY*_local_PFNGLXCHOOSEFBCONFIGPROC)(Display * dpy, int screen, const int * attribList, int * nitems); + _local_PFNGLXCHOOSEFBCONFIGPROC ptr_glXChooseFBConfig; + int * _attribList_ptr = NULL; + int * _nitems_ptr = NULL; GLXFBConfig * _res; - int count; - jobject jbyteSource; + int count, i; jobject jbyteCopy; - ptr_glXChooseFBConfig = (_local_PFNGLXCHOOSEFBCONFIG) (intptr_t) procAddress; + if ( NULL != attribList ) { + _attribList_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attribList)) + attribList_byte_offset); + } + if ( NULL != nitems ) { + _nitems_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, nitems)) + nitems_byte_offset); + } + ptr_glXChooseFBConfig = (_local_PFNGLXCHOOSEFBCONFIGPROC) (intptr_t) procAddress; assert(ptr_glXChooseFBConfig != NULL); - if (attribList != NULL) { - _ptr2 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, attribList, NULL)) + attribList_byte_offset); - } - if (nitems != NULL) { - _ptr3 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, nitems, NULL)) + nitems_byte_offset); - } - _res = (*ptr_glXChooseFBConfig)((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2, (int *) _ptr3); - count = _ptr3[0]; - if (attribList != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, attribList, _ptr2, 0); - } - if (nitems != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, nitems, _ptr3, 0); + _res = (* ptr_glXChooseFBConfig) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr, (int *) _nitems_ptr); + count = _nitems_ptr[0]; + if (NULL == _res) return NULL; + + /** + * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. + * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer + */ + // fprintf(stderr, "glXChooseFBConfig.0: Count %d\n", count); + i=0; + while( i < count ) { + if( NULL == _res[i] ) { + if( 0 < count-i-1 ) { + memmove(_res+i, _res+i+1, (count-i-1)*sizeof(GLXFBConfig)); + } + count--; + } else { + i++; + } } - if (_res == NULL) return NULL; + // fprintf(stderr, "glXChooseFBConfig.X: Count %d\n", count); - _initClazzAccess(env); + jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig)); + XFree(_res); - jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(GLXFBConfig)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); - (*env)->DeleteLocalRef(env, jbyteSource); + return jbyteCopy; +} + +/* Java->C glue code: + * Java package: jogamp.opengl.x11.glx.GLX + * Java method: com.jogamp.common.nio.PointerBuffer dispatch_glXGetFBConfigs(long dpy, int screen, java.nio.IntBuffer nelements) + * C function: GLXFBConfig * glXGetFBConfigs(Display * dpy, int screen, int * nelements); + */ +JNIEXPORT jobject JNICALL +Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject nelements, jint nelements_byte_offset, jlong procAddress) { + typedef GLXFBConfig * (APIENTRY*_local_PFNGLXGETFBCONFIGSPROC)(Display * dpy, int screen, int * nelements); + _local_PFNGLXGETFBCONFIGSPROC ptr_glXGetFBConfigs; + int * _nelements_ptr = NULL; + GLXFBConfig * _res; + int count, i; + jobject jbyteCopy; + if ( NULL != nelements ) { + _nelements_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, nelements)) + nelements_byte_offset); + } + ptr_glXGetFBConfigs = (_local_PFNGLXGETFBCONFIGSPROC) (intptr_t) procAddress; + assert(ptr_glXGetFBConfigs != NULL); + _res = (* ptr_glXGetFBConfigs) ((Display *) (intptr_t) dpy, (int) screen, (int *) _nelements_ptr); + count = _nelements_ptr[0]; + if (NULL == _res) return NULL; + + /** + * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. + * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer + */ + i=0; + while( i < count ) { + if( NULL == _res[i] ) { + if( 0 < count-i-1 ) { + memmove(_res+i, _res+i+1, (count-i-1)*sizeof(GLXFBConfig)); + } + count--; + } else { + i++; + } + } + + jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig)); XFree(_res); return jbyteCopy; } + /* Java->C glue code: * Java package: jogamp.opengl.x11.glx.GLX - * Java method: XVisualInfo glXChooseVisual(long dpy, int screen, java.nio.IntBuffer attribList) + * Java method: XVisualInfo dispatch_glXChooseVisual(long dpy, int screen, java.nio.IntBuffer attribList) * C function: XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); */ JNIEXPORT jobject JNICALL Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _unused, jlong dpy, jint screen, jobject attribList, jint attribList_byte_offset, jlong procAddress) { - typedef XVisualInfo* (APIENTRY*_local_PFNGLXCHOOSEVISUAL)(Display * dpy, int screen, int * attribList); - _local_PFNGLXCHOOSEVISUAL ptr_glXChooseVisual; - int * _ptr2 = NULL; + typedef XVisualInfo * (APIENTRY*_local_PFNGLXCHOOSEVISUALPROC)(Display * dpy, int screen, int * attribList); + _local_PFNGLXCHOOSEVISUALPROC ptr_glXChooseVisual; + int * _attribList_ptr = NULL; XVisualInfo * _res; - jobject jbyteSource; jobject jbyteCopy; - ptr_glXChooseVisual = (_local_PFNGLXCHOOSEVISUAL) (intptr_t) procAddress; + if ( NULL != attribList ) { + _attribList_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attribList)) + attribList_byte_offset); + } + ptr_glXChooseVisual = (_local_PFNGLXCHOOSEVISUALPROC) (intptr_t) procAddress; assert(ptr_glXChooseVisual != NULL); - if (attribList != NULL) { - _ptr2 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, attribList, NULL)) + attribList_byte_offset); - } - _res = (*ptr_glXChooseVisual)((Display *) (intptr_t) dpy, (int) screen, (int *) _ptr2); - if (attribList != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env, attribList, _ptr2, 0); - } - if (_res == NULL) return NULL; - - _initClazzAccess(env); - - jbyteSource = (*env)->NewDirectByteBuffer(env, _res, sizeof(XVisualInfo)); - jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); + _res = (* ptr_glXChooseVisual) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr); + if (NULL == _res) return NULL; - (*env)->DeleteLocalRef(env, jbyteSource); + jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo)); XFree(_res); return jbyteCopy; diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java index 36ad10031..5a3ea392b 100644 --- a/make/config/jogl/glx-CustomJavaCode.java +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -1,4 +1,26 @@ + /** + * Returns the GLX error value, i.e. 0 for no error. In case of an error values.get(values.getPosition()) contains the attributes index causing the error. + * <p> + * Entry point to C language function: <code> int glXGetFBConfigAttrib(Display * dpy, GLXFBConfig config, int attribute, int * value); </code> <br>Part of <code>GLX_VERSION_1_3</code> + * </p> + */ + public static int glXGetFBConfigAttributes(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 = glxProcAddressTable._addressof_glXGetFBConfigAttrib; + return dispatch_glXGetFBConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes), + values, Buffers.getDirectBufferByteOffset(values), __addr); + } + private static native int dispatch_glXGetFBConfigAttributes(long dpy, long config, int attributeCount, Object attributes, int attributes_byte_offset, Object values, int valuesOffset, long procAddr); + /** Interface to C language function: <br> - Alias for: <br> <code> XVisualInfo * glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); </code> */ public static XVisualInfo glXGetVisualFromFBConfig(long dpy, long config) { @@ -6,53 +28,74 @@ if (__addr_ == 0) { throw new GLException("Method \"glXGetVisualFromFBConfig\" not available"); } - java.nio.ByteBuffer _res; - _res = dispatch_glXGetVisualFromFBConfig(dpy, config, __addr_); + final java.nio.ByteBuffer _res = dispatch_glXGetVisualFromFBConfig(dpy, config, __addr_); if (_res == null) return null; - return XVisualInfo.create(_res); + return XVisualInfo.create(Buffers.nativeOrder(_res)); } /** Entry point to C language function: - Alias for: <br> <code> XVisualInfo * glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); </code> */ private static native java.nio.ByteBuffer dispatch_glXGetVisualFromFBConfig(long dpy, long config, long procAddr); - /** Interface to C language function: <br> - Alias for: <br> <code> GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> */ - public static com.jogamp.common.nio.PointerBuffer glXChooseFBConfig(long dpy, int screen, int[] attribList, int attribList_offset, int[] nitems, int nitems_offset) - { + /** Entry point to C language function: <code> GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> <br>Part of CORE FUNC + @param attribList a direct only {@link java.nio.IntBuffer} + @param nitems a direct only {@link java.nio.IntBuffer} */ + public static PointerBuffer glXChooseFBConfig(long dpy, int screen, IntBuffer attribList, IntBuffer nitems) { + + if (!Buffers.isDirect(attribList)) + throw new GLException("Argument \"attribList\" is not a direct buffer"); + if (!Buffers.isDirect(nitems)) + throw new GLException("Argument \"nitems\" is not a direct buffer"); final long __addr_ = glxProcAddressTable._addressof_glXChooseFBConfig; if (__addr_ == 0) { - throw new GLException("Method \"glXChooseFBConfig\" not available"); + throw new GLException("Method \"glXChooseFBConfig\" not available"); } - if(attribList != null && attribList.length <= attribList_offset) - throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); - if(nitems != null && nitems.length <= nitems_offset) - throw new GLException("array offset argument \"nitems_offset\" (" + nitems_offset + ") equals or exceeds array length (" + nitems.length + ")"); - java.nio.ByteBuffer _res; - _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, nitems, Buffers.SIZEOF_INT * nitems_offset, __addr_); + final ByteBuffer _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), nitems, Buffers.getDirectBufferByteOffset(nitems), __addr_); + if (_res == null) return null; + return PointerBuffer.wrap(Buffers.nativeOrder(_res)); + } + /** Entry point to C language function: <code> GLXFBConfig * glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> <br>Part of CORE FUNC + @param attribList a direct only {@link java.nio.IntBuffer} + @param nitems a direct only {@link java.nio.IntBuffer} */ + private static native ByteBuffer dispatch_glXChooseFBConfig(long dpy, int screen, Object attribList, int attribList_byte_offset, Object nitems, int nitems_byte_offset, long procAddress); + + /** Entry point to C language function: <code> GLXFBConfig * glXGetFBConfigs(Display * dpy, int screen, int * nelements); </code> <br>Part of <code>GLX_VERSION_1_3</code> + @param nelements a direct only {@link java.nio.IntBuffer} */ + public static PointerBuffer glXGetFBConfigs(long dpy, int screen, IntBuffer nelements) { + + if (!Buffers.isDirect(nelements)) + throw new GLException("Argument \"nelements\" is not a direct buffer"); + final long __addr_ = glxProcAddressTable._addressof_glXGetFBConfigs; + if (__addr_ == 0) { + throw new GLException(String.format("Method \"%s\" not available", "glXGetFBConfigs")); + } + final ByteBuffer _res = dispatch_glXGetFBConfigs(dpy, screen, nelements, Buffers.getDirectBufferByteOffset(nelements), __addr_); if (_res == null) return null; - return PointerBuffer.wrap(_res); + return PointerBuffer.wrap(Buffers.nativeOrder(_res)); } - /** Entry point to C language function: - Alias for: <br> <code> GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); </code> */ - private static native java.nio.ByteBuffer dispatch_glXChooseFBConfig(long dpy, int screen, Object attribList, int attribList_byte_offset, Object nitems, int nitems_byte_offset, long procAddr); + /** Entry point to C language function: <code> GLXFBConfig * glXGetFBConfigs(Display * dpy, int screen, int * nelements); </code> <br>Part of <code>GLX_VERSION_1_3</code> + @param nelements a direct only {@link java.nio.IntBuffer} */ + private static native ByteBuffer dispatch_glXGetFBConfigs(long dpy, int screen, Object nelements, int nelements_byte_offset, long procAddress); - /** Interface to C language function: <br> - Alias for: <br> <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> */ - public static XVisualInfo glXChooseVisual(long dpy, int screen, int[] attribList, int attribList_offset) - { + + /** Entry point to C language function: <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> <br>Part of <code>GLX_VERSION_1_X</code> + @param attribList a direct only {@link java.nio.IntBuffer} */ + public static XVisualInfo glXChooseVisual(long dpy, int screen, IntBuffer attribList) { + + if (!Buffers.isDirect(attribList)) + throw new GLException("Argument \"attribList\" is not a direct buffer"); final long __addr_ = glxProcAddressTable._addressof_glXChooseVisual; if (__addr_ == 0) { - throw new GLException("Method \"glXChooseVisual\" not available"); + throw new GLException("Method \"glXChooseVisual\" not available"); } - if(attribList != null && attribList.length <= attribList_offset) - throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); - java.nio.ByteBuffer _res; - _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.SIZEOF_INT * attribList_offset, __addr_); - + final ByteBuffer _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), __addr_); if (_res == null) return null; - return XVisualInfo.create(_res); + return XVisualInfo.create(Buffers.nativeOrder(_res)); } - /** Entry point to C language function: - Alias for: <br> <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> */ - private static native java.nio.ByteBuffer dispatch_glXChooseVisual(long dpy, int screen, Object attribList, int attribList_byte_offset, long procAddr); + /** Entry point to C language function: <code> XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); </code> <br>Part of <code>GLX_VERSION_1_X</code> + @param attribList a direct only {@link java.nio.IntBuffer} */ + private static native ByteBuffer dispatch_glXChooseVisual(long dpy, int screen, Object attribList, int attribList_byte_offset, long procAddress); diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg index 4daa78b84..6a5bdc484 100644 --- a/make/config/jogl/glx-x11.cfg +++ b/make/config/jogl/glx-x11.cfg @@ -13,10 +13,13 @@ Include gl-desktop.cfg GLHeader GL/glx.h GLHeader GL/glxext.h +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + ForceProcAddressGen __ALL__ LocalProcAddressCallingConvention __ALL__ APIENTRY -AllowNonGLExtensions true EmitProcAddressTable true ProcAddressTableClassName GLXProcAddressTable GetProcAddressTableExpr glxProcAddressTable @@ -29,6 +32,7 @@ CustomJavaCode GLX public static GLXProcAddressTable getGLXProcAddressTable() { IncludeAs CustomJavaCode GLX glx-CustomJavaCode.java IncludeAs CustomCCode glx-CustomCCode.c +ForceStaticInitCode GLX ArgumentIsString XOpenDisplay 0 @@ -41,9 +45,11 @@ Ignore glXCreateContextAttribsARB Ignore glXGetVisualFromFBConfigSGIX ManuallyImplement glXGetVisualFromFBConfig ManuallyImplement glXChooseFBConfig +ManuallyImplement glXGetFBConfigs ManuallyImplement glXChooseVisual ForceProcAddressGen glXGetVisualFromFBConfig ForceProcAddressGen glXChooseFBConfig +ForceProcAddressGen glXGetFBConfigs ForceProcAddressGen glXChooseVisual # Ignore everything not in the GLX core (up through GLX 1.4) @@ -95,6 +101,6 @@ CustomJavaCode GLX { CustomJavaCode GLX if (glXGetProcAddressHandle == 0) { CustomJavaCode GLX throw new GLException("Passed null pointer for method \"glXGetProcAddress\""); CustomJavaCode GLX } -CustomJavaCode GLX return dispatch_glXGetProcAddress1(procname, glXGetProcAddressHandle); +CustomJavaCode GLX return dispatch_glXGetProcAddress0(procname, glXGetProcAddressHandle); CustomJavaCode GLX } diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg index de23b9f17..d158d241f 100644 --- a/make/config/jogl/glxext.cfg +++ b/make/config/jogl/glxext.cfg @@ -13,6 +13,10 @@ ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/x11/gl Include gl-common.cfg Include gl-desktop.cfg +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + GLHeader GL/glx.h GLHeader GL/glxext.h @@ -56,6 +60,7 @@ CustomJavaCode GLXExtImpl private X11GLXContext _context; Ignore glXGetVisualFromFBConfig Ignore glXGetVisualFromFBConfigSGIX Ignore glXChooseFBConfig +Ignore glXGetFBConfigs Ignore glXChooseVisual Ignore glXCreateContext Ignore glXDestroyContext @@ -77,7 +82,6 @@ Ignore glXQueryExtensionsString Ignore glXQueryServerString Ignore glXGetClientString Ignore glXGetCurrentDisplay -Ignore glXChooseFBConfig Ignore glXGetFBConfigAttrib Ignore glXGetFBConfigs Ignore glXGetVisualFromFBConfig diff --git a/make/config/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg index 4d2fea5d0..d9dbb13e6 100644 --- a/make/config/jogl/wgl-win32.cfg +++ b/make/config/jogl/wgl-win32.cfg @@ -18,6 +18,10 @@ GLHeader GL/wglext.h ForceProcAddressGen __ALL__ LocalProcAddressCallingConvention __ALL__ APIENTRY +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + AllowNonGLExtensions true EmitProcAddressTable true ProcAddressTableClassName WGLProcAddressTable @@ -63,6 +67,6 @@ CustomJavaCode WGL { CustomJavaCode WGL if (wglGetProcAddressHandle == 0) { CustomJavaCode WGL throw new GLException("Passed null pointer for method \"wglGetProcAddress\""); CustomJavaCode WGL } -CustomJavaCode WGL return dispatch_wglGetProcAddress1(procname, wglGetProcAddressHandle); +CustomJavaCode WGL return dispatch_wglGetProcAddress0(procname, wglGetProcAddressHandle); CustomJavaCode WGL } diff --git a/make/config/jogl/wglext.cfg b/make/config/jogl/wglext.cfg index 15986b6cf..57707d6cb 100644 --- a/make/config/jogl/wglext.cfg +++ b/make/config/jogl/wglext.cfg @@ -13,6 +13,10 @@ Include gl-desktop.cfg AllowNonGLExtensions true +# Only NIO direct function, no arrays .. +NIOOnly __ALL__ +NIODirectOnly __ALL__ + GLHeader wingdi.h GLHeader GL/wglext.h |