diff options
Diffstat (limited to 'make/config/jogl')
66 files changed, 7838 insertions, 0 deletions
diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java new file mode 100644 index 000000000..cdaa6f2b2 --- /dev/null +++ b/make/config/jogl/cg-common-CustomJavaCode.java @@ -0,0 +1,48 @@ +private static DynamicLookupHelper cgDynamicLookupHelper; +private static CgProcAddressTable cgProcAddressTable; + +static { + cgProcAddressTable = new CgProcAddressTable(); + if(null==cgProcAddressTable) { + throw new RuntimeException("Couldn't instantiate CgProcAddressTable"); + } + DynamicLibraryBundle cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo()); + if(null==cgDynamicLookupHelper) { + throw new RuntimeException("Null CgDynamicLookupHelper"); + } + if(!cgDynamicLookupHelper.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native Cg or CgGL library"); + } + if(!cgDynamicLookupHelper.isGlueLibLoaded(CgDynamicLibraryBundleInfo.getCgGlueLibIndex())) { + throw new RuntimeException("Couln't load native GLue/JNI library"); + } + cgProcAddressTable.reset(cgDynamicLookupHelper); +} + +public static CgProcAddressTable getCgProcAddressTable() { return cgProcAddressTable; } + +/** A convenience method which reads all available data from the InputStream and then calls cgCreateProgram. */ +public static CGprogram cgCreateProgramFromStream(CGcontext ctx, int program_type, java.io.InputStream stream, int profile, java.lang.String entry, java.lang.String[] args) throws java.io.IOException { + if (stream == null) { + throw new java.io.IOException("null stream"); + } + stream = new java.io.BufferedInputStream(stream); + int avail = stream.available(); + byte[] data = new byte[avail]; + int numRead = 0; + int pos = 0; + do { + if (pos + avail > data.length) { + byte[] newData = new byte[pos + avail]; + System.arraycopy(data, 0, newData, 0, pos); + data = newData; + } + numRead = stream.read(data, pos, avail); + if (numRead >= 0) { + pos += numRead; + } + avail = stream.available(); + } while (avail > 0 && numRead >= 0); + String program = new String(data, 0, pos, "US-ASCII"); + return cgCreateProgram(ctx, program_type, program, profile, entry, args); +} diff --git a/make/config/jogl/cg-common.cfg b/make/config/jogl/cg-common.cfg new file mode 100644 index 000000000..af7e9d268 --- /dev/null +++ b/make/config/jogl/cg-common.cfg @@ -0,0 +1,129 @@ +# This .cfg file provides common options used among all Cg glue code +# generated for Jogl on all platforms. +Package com.jogamp.opengl.cg +JavaClass CgGL +Style AllStatic +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl_cg +HierarchicalNativeOutput false + +ForceProcAddressGen __ALL__ +LocalProcAddressCallingConvention __ALL__ APIENTRY + +EmitProcAddressTable true +ProcAddressTableClassName CgProcAddressTable +GetProcAddressTableExpr cgProcAddressTable +ProcAddressNameExpr PFN $UPPERCASE({0}) PROC + +# +# Map const char* return values to Java strings for these functions +# +ReturnsString cgGetAnnotationName +ReturnsString cgGetEnumString +ReturnsString cgGetErrorString +ReturnsString cgGetLastErrorString +ReturnsString cgGetLastListing +ReturnsString cgGetParameterName +ReturnsString cgGetParameterSemantic +ReturnsString cgGetPassName +ReturnsString cgGetProfileString +ReturnsString cgGetProgramString +ReturnsString cgGetResourceString +ReturnsString cgGetStateName +ReturnsString cgGetString +ReturnsString cgGetStringAnnotationValue +ReturnsString cgGetStringParameterValue +ReturnsString cgGetStringStateAssignmentValue +ReturnsString cgGetTechniqueName +ReturnsString cgGetTypeString + +ArgumentIsString cgAddStateEnumerant 1 +ArgumentIsString cgCreateArrayState 1 +ArgumentIsString cgCreateArraySamplerState 1 +ArgumentIsString cgCreateEffect 1 2 +ArgumentIsString cgCreateEffectFromFile 1 2 +ArgumentIsString cgCreateProgram 2 4 5 +ArgumentIsString cgCreateProgramFromFile 2 4 5 +ArgumentIsString cgCreateProgramFromEffect 2 3 +ArgumentIsString cgCreateSamplerState 1 +ArgumentIsString cgCreateState 1 +ArgumentIsString cgGetEffectParameterBySemantic 1 +ArgumentIsString cgGetEnum 0 +ArgumentIsString cgGetNamedEffectParameter 1 +ArgumentIsString cgGetNamedParameter 1 +ArgumentIsString cgGetNamedPass 1 +ArgumentIsString cgGetNamedProgramParameter 2 +ArgumentIsString cgGetNamedSamplerState 1 +ArgumentIsString cgGetNamedState 1 +ArgumentIsString cgGetNamedSamplerStateAssignment 1 +ArgumentIsString cgGetNamedStateAssignment 1 +ArgumentIsString cgGetNamedStructParameter 1 +ArgumentIsString cgGetNamedTechnique 1 +ArgumentIsString cgGetNamedTechniqueAnnotation 1 +ArgumentIsString cgGetNamedPassAnnotation 1 +ArgumentIsString cgGetNamedParameterAnnotation 1 +ArgumentIsString cgGetNamedProgramAnnotation 1 +ArgumentIsString cgGetNamedUserType 1 +ArgumentIsString cgGetProfile 0 +ArgumentIsString cgGetType 0 +ArgumentIsString cgGetResource 0 +ArgumentIsString cgSetLastListing 1 +ArgumentIsString cgSetParameterSemantic 1 +ArgumentIsString cgSetStringParameterValue 1 + +# Opaque definitions +Opaque boolean CGbool + +# +# FIXME!!!! Ignore these functions for now because we can't +# automatically handle C callbacks +# +Ignore cgSetErrorCallback +Ignore cgGetErrorCallback +Ignore cgSetErrorHandler +Ignore cgGetErrorHandler +Ignore cgSetStateCallbacks +Ignore cgGetStateSetCallback +Ignore cgGetStateResetCallback +Ignore cgGetStateValidateCallback + +# +# FIXME!!!! Ignore these functions for now because bugs in the +# emitter code can't handle them +# +Ignore cgGetBooleanAnnotationValues +Ignore cgGetBoolStateAssignmentValues +Ignore cgGetFloatAnnotationValues +Ignore cgGetFloatStateAssignmentValues +Ignore cgGetIntAnnotationValues +Ignore cgGetIntStateAssignmentValues +Ignore cgGetParameterValues +Ignore cgGetProgramOptions + +# And NativeLibLoader for help loading the native libraries +Import com.jogamp.opengl.impl.* +Import com.jogamp.common.os.DynamicLookupHelper; +Import com.jogamp.common.os.DynamicLibraryBundle; +Import com.jogamp.opengl.cg.CgDynamicLibraryBundleInfo; + +# +# NIODirectOnly directives for routines requiring them for semantic reasons +# +NIODirectOnly cgGLSetParameterPointer + +# Raise CgException instead of RuntimeException in glue code +RuntimeExceptionType CgException + +# +# Make sure the right definitions and include files are added to the +# generated C code +# + +CustomCCode #include <stdlib.h> +CustomCCode #include <Cg/cgGL.h> +CustomCCode +CustomCCode #ifndef APIENTRY +CustomCCode #define APIENTRY +CustomCCode #endif + +IncludeAs CustomJavaCode CgGL cg-common-CustomJavaCode.java diff --git a/make/config/jogl/cgl-macosx.cfg b/make/config/jogl/cgl-macosx.cfg new file mode 100644 index 000000000..2b28d3c68 --- /dev/null +++ b/make/config/jogl/cgl-macosx.cfg @@ -0,0 +1,43 @@ +# This .cfg file is used to generate the interface to the CGL routines +# used internally by the MacOSXGLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/MacOSX + +Package com.jogamp.opengl.impl.macosx.cgl +JavaClass CGL +Style AllStatic +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +GLHeader GL/cglext.h + +Opaque long void * + +# Opaque directives for low-level CGL binding (for Java2D/JOGL bridge) +Opaque long CGLContextObj +Opaque long CGLPBufferObj +Opaque long CGLPixelFormatObj + +CustomCCode #include </usr/include/machine/types.h> +CustomCCode #include "macosx-window-system.h" + +# Implement the first argument to getProcAddress as String instead +# of byte[] +ArgumentIsString getProcAddress 0 + +DropUniqVendorExtensions AMD +# We need GL_APPLE_float_pixels for our pbuffer implementation +# DropUniqVendorExtensions APPLE +DropUniqVendorExtensions ATI +DropUniqVendorExtensions HP +DropUniqVendorExtensions IBM +DropUniqVendorExtensions MESA +DropUniqVendorExtensions MESAX +DropUniqVendorExtensions NV +DropUniqVendorExtensions SGI +DropUniqVendorExtensions SGIS +DropUniqVendorExtensions SGIX +DropUniqVendorExtensions SUN +DropUniqVendorExtensions WIN + diff --git a/make/config/jogl/cglext.cfg b/make/config/jogl/cglext.cfg new file mode 100644 index 000000000..404a852b0 --- /dev/null +++ b/make/config/jogl/cglext.cfg @@ -0,0 +1,46 @@ +# This .cfg file is used to generate the interface and implementing +# class for the CGL extensions. +# Note that there are currently no such extensions exposed on Mac OS +# X, but if in the future there are, this structure will allow them to +# be easily exposed. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/MacOSX + +Package com.jogamp.opengl.impl.macosx.cgl +Style InterfaceAndImpl +JavaClass CGLExt +ImplPackage com.jogamp.opengl.impl.macosx.cgl +ImplJavaClass CGLExtImpl +Include gl-common.cfg +Include gl-desktop.cfg + +GLHeader GL/cglext.h + +EmitProcAddressTable true +ProcAddressTableClassName CGLExtProcAddressTable +GetProcAddressTableExpr _context.getCGLExtProcAddressTable() + +# Ignore everything that doesn't start with cgl or CGL +IgnoreNot ^(cgl|CGL).+ + +Include gl-headers.cfg +Include ../intptr.cfg + +CustomJavaCode CGLExt public boolean isFunctionAvailable(String glFunctionName); +CustomJavaCode CGLExt public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode CGLExtImpl public CGLExtImpl(MacOSXCGLContext context) { +CustomJavaCode CGLExtImpl this._context = context; +CustomJavaCode CGLExtImpl } + +CustomJavaCode CGLExtImpl public boolean isFunctionAvailable(String glFunctionName) +CustomJavaCode CGLExtImpl { +CustomJavaCode CGLExtImpl return _context.isFunctionAvailable(glFunctionName); +CustomJavaCode CGLExtImpl } + +CustomJavaCode CGLExtImpl public boolean isExtensionAvailable(String glExtensionName) +CustomJavaCode CGLExtImpl { +CustomJavaCode CGLExtImpl return _context.isExtensionAvailable(glExtensionName); +CustomJavaCode CGLExtImpl } + +CustomJavaCode CGLExtImpl private MacOSXCGLContext _context; diff --git a/make/config/jogl/egl-common.cfg b/make/config/jogl/egl-common.cfg new file mode 100644 index 000000000..fd65d5c10 --- /dev/null +++ b/make/config/jogl/egl-common.cfg @@ -0,0 +1,45 @@ +# Inform the glue code generator of the association between #defines +# and functions and the extensions in which they are defined +GLHeader EGL/egl.h +GLHeader EGL/eglext.h + +# Imports needed by all glue code +Import java.util.* +Import javax.media.opengl.* +Import javax.media.opengl.fixedfunc.* +Import com.jogamp.opengl.impl.* + +# Treat all of the EGL types as opaque longs +# Opaque long EGLConfig +Opaque long EGLContext +Opaque long EGLDisplay +Opaque long EGLSurface +Opaque long EGLNativeDisplayType +Opaque long EGLNativeWindowType +Opaque long EGLNativePixmapType +Opaque long EGLClientBuffer +Opaque long EGLImageKHR +#Opaque long EGLPerfMonitorNV +#Opaque long EGLPerfCounterNV +#Opaque long EGLPerfMarkerNV +Opaque long EGLSyncKHR +Opaque long NativeSyncKHR +Opaque boolean EGLBoolean + +# Make eglGetProcAddress return an opaque long +Opaque long __EGLFuncPtr + +# Implement the first argument to eglGetProcAddress as String instead +# of byte[] +ArgumentIsString eglGetProcAddress 0 +ReturnsString eglQueryString + +# 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 +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to EGLAPIENTRY +LocalProcAddressCallingConvention __ALL__ EGLAPIENTRY + diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg new file mode 100644 index 000000000..c194de2d0 --- /dev/null +++ b/make/config/jogl/egl.cfg @@ -0,0 +1,50 @@ +# This .cfg file is used to generate the interface to the EGL routines +# used internally by the EGLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/egl + +Package com.jogamp.opengl.impl.egl +JavaClass EGL +Style AllStatic +# Shouldn't matter which one of these we pick up +Include egl-common.cfg + +HierarchicalNativeOutput false + +# Use a ProcAddressTable so we dynamically look up the routines +EmitProcAddressTable true +ProcAddressTableClassName EGLProcAddressTable +GetProcAddressTableExpr _table + +# Implement the first argument to eglGetProcAddress as String instead +# of byte[] +ArgumentIsString eglGetProcAddress 0 +ReturnsString eglQueryString + +CustomCCode #include <EGL/egl.h> + +Include ../intptr.cfg + +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 } + + +Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg new file mode 100644 index 000000000..3b46aca57 --- /dev/null +++ b/make/config/jogl/eglext.cfg @@ -0,0 +1,58 @@ +# This .cfg file is used to generate the interface to the EGL routines +# used internally by the EGLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/egl + +Package com.jogamp.opengl.impl.egl +Style InterfaceAndImpl +JavaClass EGLExt +ImplPackage com.jogamp.opengl.impl.egl +ImplJavaClass EGLExtImpl +# Shouldn't matter which one of these we pick up +Include egl-common.cfg + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/impl/egl/EGL.java + +HierarchicalNativeOutput false + +# Use a ProcAddressTable so we dynamically look up the routines +EmitProcAddressTable true +ProcAddressTableClassName EGLExtProcAddressTable +GetProcAddressTableExpr _context.getEGLExtProcAddressTable() + +CustomCCode /* Define EGL_EGLEXT_PROTOTYPES so that the EGL extension prototypes in +CustomCCode "eglext.h" are parsed. */ +CustomCCode #define EGL_EGLEXT_PROTOTYPES +CustomCCode +CustomCCode #include <EGL/egl.h> +CustomCCode #include <EGL/eglext.h> + +Include ../intptr.cfg + +# There are some #defines in eglext.h that GlueGen and PCPP don't currently handle +CustomJavaCode EGLExt /** Part of <code>EGL_KHR_image</code> */ +CustomJavaCode EGLExt public static final long EGL_NO_IMAGE = 0; +#CustomJavaCode EGLExt /** Part of <code>EGL_KHR_reusable_sync</code> */ +#CustomJavaCode EGLExt public static final long EGL_FOREVER_KHR = 0xFFFFFFFFFFFFFFFFL ; +CustomJavaCode EGLExt /** Part of <code>EGL_KHR_reusable_sync</code> */ +CustomJavaCode EGLExt public static final long EGL_NO_SYNC_KHR = 0; + +CustomJavaCode EGLExt public boolean isFunctionAvailable(String glFunctionName); +CustomJavaCode EGLExt public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode EGLExtImpl public EGLExtImpl(EGLContext context) { +CustomJavaCode EGLExtImpl this._context = context; +CustomJavaCode EGLExtImpl } + +CustomJavaCode EGLExtImpl public boolean isFunctionAvailable(String glFunctionName) +CustomJavaCode EGLExtImpl { +CustomJavaCode EGLExtImpl return _context.isFunctionAvailable(glFunctionName); +CustomJavaCode EGLExtImpl } + +CustomJavaCode EGLExtImpl public boolean isExtensionAvailable(String glExtensionName) +CustomJavaCode EGLExtImpl { +CustomJavaCode EGLExtImpl return _context.isExtensionAvailable(glExtensionName); +CustomJavaCode EGLExtImpl } + +CustomJavaCode EGLExtImpl private EGLContext _context; + diff --git a/make/config/jogl/gdi-CustomCCode.c b/make/config/jogl/gdi-CustomCCode.c new file mode 100644 index 000000000..0fe9ee628 --- /dev/null +++ b/make/config/jogl/gdi-CustomCCode.c @@ -0,0 +1,48 @@ +#include <stdio.h> + +#define JOGL_DUMMY_WINDOW_NAME "__jogl_dummy_window" + +LRESULT CALLBACK DummyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + return DefWindowProc(hWnd,uMsg,wParam,lParam); +} + +ATOM oglClass = 0; + +HWND CreateDummyWindow( int x, int y, int width, int height ) { + HINSTANCE hInstance; + DWORD dwExStyle; + DWORD dwStyle; + HWND hWnd; + + hInstance = GetModuleHandle(NULL); + if( !oglClass ) { + WNDCLASS wc; + ZeroMemory( &wc, sizeof( wc ) ); + wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; + wc.lpfnWndProc = (WNDPROC) DummyWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = JOGL_DUMMY_WINDOW_NAME; + if( !(oglClass = RegisterClass( &wc )) ) { + printf( "RegisterClass Failed: %d\n", GetLastError() ); + return( 0 ); + } + } + + dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; + dwStyle = WS_OVERLAPPEDWINDOW; + if( !(hWnd=CreateWindowEx( dwExStyle, + JOGL_DUMMY_WINDOW_NAME, + JOGL_DUMMY_WINDOW_NAME, + dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + x, y, width, height, + NULL, NULL, hInstance, NULL ) ) ) { + return( 0 ); + } + return( hWnd ); +} diff --git a/make/config/jogl/gdi-win32.cfg b/make/config/jogl/gdi-win32.cfg new file mode 100644 index 000000000..7d831c7b9 --- /dev/null +++ b/make/config/jogl/gdi-win32.cfg @@ -0,0 +1,26 @@ +# This .cfg file is used to generate the interface to the wgl routines +# used internally by the WindowsGLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/Windows + +Package com.jogamp.opengl.impl.windows.wgl +JavaClass GDI +Style AllStatic +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +GLHeader wingdi.h + +AllowNonGLExtensions true + +CustomCCode #define WIN32_LEAN_AND_MEAN +CustomCCode #include <windows.h> +CustomCCode #undef WIN32_LEAN_AND_MEAN + +CustomCCode #include <wingdi.h> +CustomCCode #include <stddef.h> + +Include ../intptr.cfg + +IncludeAs CustomCCode gdi-CustomCCode.c diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg new file mode 100644 index 000000000..1f294ee69 --- /dev/null +++ b/make/config/jogl/gl-common-extensions.cfg @@ -0,0 +1,125 @@ + +# Note: we keep the Apple, AMD/ATI and NVidia extensions since they are generally +# the most useful and up-to-date +DropUniqVendorExtensions 3DFX +# DropUniqVendorExtensions AMD +# DropUniqVendorExtensions APPLE +# DropUniqVendorExtensions ATI +DropUniqVendorExtensions HP +DropUniqVendorExtensions IBM +DropUniqVendorExtensions INGR +DropUniqVendorExtensions MESA +DropUniqVendorExtensions MESAX +# DropUniqVendorExtensions NV +DropUniqVendorExtensions PGI +DropUniqVendorExtensions SGI +DropUniqVendorExtensions SGIS +DropUniqVendorExtensions SGIX +DropUniqVendorExtensions SUN +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_element_array +IgnoreExtension GL_APPLE_vertex_array_object +IgnoreExtension GL_ATI_element_array +IgnoreExtension GL_ATI_envmap_bumpmap +IgnoreExtension GL_ATI_fragment_shader +IgnoreExtension GL_ATI_map_object_buffer +IgnoreExtension GL_ATI_separate_stencil +IgnoreExtension GL_ATI_text_fragment_shader +IgnoreExtension GL_ATI_texture_env_combine3 +IgnoreExtension GL_ATI_texture_mirror_once +IgnoreExtension GL_ATI_vertex_array_object +IgnoreExtension GL_ATI_vertex_attrib_array_object +IgnoreExtension GL_ATI_vertex_streams +IgnoreExtension GL_NV_depth_buffer_float +IgnoreExtension GL_NV_fragment_program +IgnoreExtension GL_NV_fragment_program2 +IgnoreExtension GL_NV_packed_depth_stencil +IgnoreExtension GL_NV_point_sprite +IgnoreExtension GL_NV_register_combiners +IgnoreExtension GL_NV_register_combiners2 +IgnoreExtension GL_NV_texgen_reflection +IgnoreExtension GL_NV_texture_env_combine4 +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 + +# For the time being, ignore these extensions which are in the ES 2.0 spec +IgnoreExtension GL_NV_coverage_sample +IgnoreExtension GL_NV_framebuffer_vertex_attrib_array + +# Remove extension suffixes from extensions which are common between OpenGL and OpenGL ES +RenameExtensionIntoCore GL_ARB_half_float_pixel +RenameExtensionIntoCore GL_ARB_point_sprite +RenameExtensionIntoCore GL_OES_blend_equation_separate +RenameExtensionIntoCore GL_OES_blend_func_separate +RenameExtensionIntoCore GL_OES_blend_subtract +RenameExtensionIntoCore GL_OES_depth24 +RenameExtensionIntoCore GL_OES_depth32 +RenameExtensionIntoCore GL_OES_framebuffer_object +RenameExtensionIntoCore GL_OES_mapbuffer +RenameExtensionIntoCore GL_OES_packed_depth_stencil +RenameExtensionIntoCore GL_OES_point_sprite +RenameExtensionIntoCore GL_OES_rgb8_rgba8 +RenameExtensionIntoCore GL_OES_read_format +RenameExtensionIntoCore GL_OES_standard_derivatives +RenameExtensionIntoCore GL_OES_stencil1 +RenameExtensionIntoCore GL_OES_stencil4 +RenameExtensionIntoCore GL_OES_stencil8 +RenameExtensionIntoCore GL_OES_stencil_wrap +RenameExtensionIntoCore GL_OES_texture_cube_map +RenameExtensionIntoCore GL_OES_texture_half_float +RenameExtensionIntoCore GL_OES_texture_mirrored_repeat +RenameExtensionIntoCore GL_OES_vertex_type_10_10_10_2 + +# The following extensions have some differences requiring us to +# manually rename some symbols and leave others alone for best +# correctness +# RenameExtensionIntoCore GL_ARB_matrix_palette +# We do not want to pull in all of this extension into the core namespace +# RenameExtensionIntoCore GL_ARB_vertex_blend + +RenameJavaSymbol GL_MAX_VERTEX_UNITS_ARB GL_MAX_VERTEX_UNITS +RenameJavaSymbol GL_MAX_PALETTE_MATRICES_ARB GL_MAX_PALETTE_MATRICES +RenameJavaSymbol GL_MATRIX_PALETTE_ARB GL_MATRIX_PALETTE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_ARB GL_MATRIX_INDEX_ARRAY +RenameJavaSymbol GL_WEIGHT_ARRAY_ARB GL_WEIGHT_ARRAY +RenameJavaSymbol GL_CURRENT_PALETTE_MATRIX_ARB GL_CURRENT_PALETTE_MATRIX +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_SIZE_ARB GL_MATRIX_INDEX_ARRAY_SIZE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_TYPE_ARB GL_MATRIX_INDEX_ARRAY_TYPE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_STRIDE_ARB GL_MATRIX_INDEX_ARRAY_STRIDE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_POINTER_ARB GL_MATRIX_INDEX_ARRAY_POINTER +RenameJavaSymbol GL_WEIGHT_ARRAY_SIZE_ARB GL_WEIGHT_ARRAY_SIZE +RenameJavaSymbol GL_WEIGHT_ARRAY_TYPE_ARB GL_WEIGHT_ARRAY_TYPE +RenameJavaSymbol GL_WEIGHT_ARRAY_STRIDE_ARB GL_WEIGHT_ARRAY_STRIDE +RenameJavaSymbol GL_WEIGHT_ARRAY_POINTER_ARB GL_WEIGHT_ARRAY_POINTER +RenameJavaSymbol glCurrentPaletteMatrixARB glCurrentPaletteMatrix +RenameJavaSymbol glMatrixIndexPointerARB glMatrixIndexPointer +RenameJavaSymbol glWeightPointerARB glWeightPointer + +# There are some definitions in this extension that don't exist in desktop OpenGL, +# so we shouldn't remove the suffixes of those OES-only variants +# RenameExtensionIntoCore GL_OES_matrix_palette +RenameJavaSymbol GL_MAX_VERTEX_UNITS_OES GL_MAX_VERTEX_UNITS +RenameJavaSymbol GL_MAX_PALETTE_MATRICES_OES GL_MAX_PALETTE_MATRICES +RenameJavaSymbol GL_MATRIX_PALETTE_OES GL_MATRIX_PALETTE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_OES GL_MATRIX_INDEX_ARRAY +RenameJavaSymbol GL_WEIGHT_ARRAY_OES GL_WEIGHT_ARRAY +RenameJavaSymbol GL_CURRENT_PALETTE_MATRIX_OES GL_CURRENT_PALETTE_MATRIX +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_SIZE_OES GL_MATRIX_INDEX_ARRAY_SIZE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_TYPE_OES GL_MATRIX_INDEX_ARRAY_TYPE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_STRIDE_OES GL_MATRIX_INDEX_ARRAY_STRIDE +RenameJavaSymbol GL_MATRIX_INDEX_ARRAY_POINTER_OES GL_MATRIX_INDEX_ARRAY_POINTER +RenameJavaSymbol GL_WEIGHT_ARRAY_SIZE_OES GL_WEIGHT_ARRAY_SIZE +RenameJavaSymbol GL_WEIGHT_ARRAY_TYPE_OES GL_WEIGHT_ARRAY_TYPE +RenameJavaSymbol GL_WEIGHT_ARRAY_STRIDE_OES GL_WEIGHT_ARRAY_STRIDE +RenameJavaSymbol GL_WEIGHT_ARRAY_POINTER_OES GL_WEIGHT_ARRAY_POINTER +RenameJavaSymbol GL_WEIGHT_ARRAY_BUFFER_BINDING_OES GL_WEIGHT_ARRAY_BUFFER_BINDING +RenameJavaSymbol glCurrentPaletteMatrixOES glCurrentPaletteMatrix +RenameJavaSymbol glMatrixIndexPointerOES glMatrixIndexPointer +RenameJavaSymbol glWeightPointerOES glWeightPointer + + diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg new file mode 100644 index 000000000..4e72daa71 --- /dev/null +++ b/make/config/jogl/gl-common.cfg @@ -0,0 +1,745 @@ +# This .cfg file provides common options used among all glue code +# generated for Jogl on all platforms. + +HierarchicalNativeOutput false + +# Raise GLException instead of RuntimeException in glue code +RuntimeExceptionType GLException +UnsupportedExceptionType GLException + +# Imports needed by all glue code +Import java.util.* +Import javax.media.opengl.* +Import javax.media.opengl.fixedfunc.* +Import com.jogamp.opengl.impl.* + +##################################################################### +# Mostly desktop OpenGL stuff below +# + +# Don't output #defines of GL version identifier strings as constants, +# because we don't need them java-side. +Ignore GL_VERSION_.+ + +Ignore KHRONOS_.+ + +# Ignore GL functions that deal with explicit pointer values in such a +# way that we cannot implement the functionality in Java +Ignore glGetBufferPointerv +Ignore glGetBufferPointervARB +Ignore glGetBufferPointerivNV +Ignore glGetNamedBufferPointervEXT +Ignore glGetPointerv +Ignore glGetPointervEXT +Ignore glGetPointerIndexedvEXT +Ignore glGetTexParameterPointervAPPLE +Ignore glGetVertexAttribPointerv +Ignore glGetVertexAttribPointervARB +Ignore glGetVertexAttribPointervNV +Ignore glTracePointerRangeMESA +Ignore glMultiDrawElementsBaseVertex +Ignore glDebugMessageCallbackARB +Ignore glDebugMessageCallbackAMD + +# Manually implement glMapBuffer as the size of the returned buffer +# can only be computed by calling another routine +ManuallyImplement glMapBuffer +ForceProcAddressGen glMapBuffer + +# Ignore the ATI_map_object_buffer extension for now unless someone +# claims they need it, as it will undoubtedly require a similar +# construct to glMapBuffer +Ignore glMapObjectBufferATI +Ignore glUnmapObjectBufferATI + +# Ignore some GL functions that have outgoing void** parameters; we cannot yet deal with them +Ignore glGetVariantPointervEXT + +# FIXME: these extensions require either a handle to a device context +# or take void** parameters or both. Until we think through the +# semantics of each of these individually we need to disable them. +# WGL_ARB_buffer_region +Ignore wglCreateBufferRegion +Ignore wglDeleteBufferRegion +Ignore wglSaveBufferRegion +Ignore wglRestoreBufferRegion +Ignore wglGetSyncValuesOML +Ignore wglGetMscRateOML +Ignore wglSwapBuffersMscOML +Ignore wglSwapLayerBuffersMscOML +Ignore wglWaitForMscOML +Ignore wglWaitForSbcOML +Ignore wglGetDigitalVideoParametersI3D +Ignore wglSetDigitalVideoParametersI3D +Ignore wglGetGammaTableParametersI3D +Ignore wglSetGammaTableParametersI3D +Ignore wglGetGammaTableI3D +Ignore wglSetGammaTableI3D +Ignore wglEnableGenlockI3D +Ignore wglDisableGenlockI3D +Ignore wglIsEnabledGenlockI3D +Ignore wglGenlockSourceI3D +Ignore wglGetGenlockSourceI3D +Ignore wglGenlockSourceEdgeI3D +Ignore wglGetGenlockSourceEdgeI3D +Ignore wglGenlockSampleRateI3D +Ignore wglGetGenlockSampleRateI3D +Ignore wglGenlockSourceDelayI3D +Ignore wglGetGenlockSourceDelayI3D +Ignore wglQueryGenlockMaxSourceDelayI3D +Ignore wglCreateImageBufferI3D +Ignore wglDestroyImageBufferI3D +Ignore wglAssociateImageBufferEventsI3D +Ignore wglReleaseImageBufferEventsI3D + +# +# IgnoreExtension directives +# + +# Ignore extensions requiring persistent pointer-to-pointer storage as +# there is no such thing as a direct "BufferBuffer" +IgnoreExtension GL_IBM_vertex_array_lists +IgnoreExtension GL_INTEL_parallel_arrays +IgnoreExtension GL_SUN_triangle_list + +# Ignore extensions never approved by the ARB +IgnoreExtension GL_EXT_coordinate_frame + +# Ignore discontinued extensions +IgnoreExtension GL_NV_element_array + +# >>> OpenGL 1.1 +# Ignore extensions subsumed in OpenGL 1.1 (from OpenGL 1.1 spec, Appendix C) +IgnoreExtension GL_EXT_vertex_array +IgnoreExtension GL_EXT_blend_logic_op +IgnoreExtension GL_EXT_copy_texture +IgnoreExtension GL_EXT_polygon_offset +IgnoreExtension GL_EXT_subtexture +IgnoreExtension GL_EXT_texture +IgnoreExtension GL_EXT_texture_object +# <<< OpenGL 1.1 + +# >>> OpenGL 1.2 +# Ignore extensions subsumed in OpenGL 1.2 and 1.2.1 (from OpenGL 1.2.1 spec, Appendix D) +IgnoreExtension GL_EXT_bgra +IgnoreExtension GL_EXT_blend_color +IgnoreExtension GL_EXT_blend_minmax +IgnoreExtension GL_EXT_blend_subtract +IgnoreExtension GL_EXT_color_subtable +IgnoreExtension GL_EXT_convolution +IgnoreExtension GL_EXT_draw_range_elements +IgnoreExtension GL_EXT_histogram +IgnoreExtension GL_EXT_packed_pixels +# NOTE: also ignoring GL_EXT_paletted_texture because it appears that it was subsumed +# into the core even though that isn't stated explicitly in the spec +IgnoreExtension GL_EXT_paletted_texture +IgnoreExtension GL_EXT_rescale_normal +IgnoreExtension GL_EXT_separate_specular_color +IgnoreExtension GL_EXT_texture3D +IgnoreExtension GL_HP_convolution_border_modes +IgnoreExtension GL_SGI_color_matrix +IgnoreExtension GL_SGI_color_table +IgnoreExtension GL_SGIS_texture_edge_clamp +IgnoreExtension GL_SGIS_texture_lod +# <<< OpenGL 1.2 + +# >>> OpenGL 1.3 +# Ignore extensions subsumed in OpenGL 1.3 (from OpenGL 1.3 spec, Appendix F) +IgnoreExtension GL_ARB_multisample +IgnoreExtension GL_ARB_multitexture +IgnoreExtension GL_ARB_texture_compression +IgnoreExtension GL_ARB_texture_cube_map +IgnoreExtension GL_ARB_texture_border_clamp +IgnoreExtension GL_ARB_texture_env_add +IgnoreExtension GL_ARB_texture_env_combine +IgnoreExtension GL_ARB_texture_env_dot3 +IgnoreExtension GL_ARB_transpose_matrix +IgnoreExtension GL_EXT_texture_cube_map +IgnoreExtension GL_EXT_texture_env_add +IgnoreExtension GL_EXT_texture_env_combine +IgnoreExtension GL_EXT_texture_env_dot3 +IgnoreExtension GL_SGIS_texture_border_clamp +# <<< OpenGL 1.3 + +# >>> OpenGL 1.4 +# Ignore extensions subsumed in OpenGL 1.4 (from OpenGL 1.4 spec, Appendix G) +IgnoreExtension GL_ARB_depth_texture +IgnoreExtension GL_ARB_point_parameters +IgnoreExtension GL_ARB_shadow +IgnoreExtension GL_ARB_texture_env_crossbar +IgnoreExtension GL_ARB_texture_mirrored_repeat +IgnoreExtension GL_ARB_window_pos +IgnoreExtension GL_EXT_blend_func_separate +IgnoreExtension GL_EXT_fog_coord +IgnoreExtension GL_EXT_texture_lod_bias +IgnoreExtension GL_EXT_multi_draw_arrays +IgnoreExtension GL_EXT_secondary_color +IgnoreExtension GL_EXT_stencil_wrap +IgnoreExtension GL_NV_blend_square +IgnoreExtension GL_SGIS_generate_mipmap +# <<< OpenGL 1.4 + +# >>> OpenGL 1.5 +# Ignore extensions subsumed in OpenGL 1.5 (from OpenGL 1.5 spec, Appendix H) +IgnoreExtension GL_ARB_occlusion_query +IgnoreExtension GL_ARB_vertex_buffer_object +IgnoreExtension GL_EXT_shadow_funcs +# <<< OpenGL 1.5 + +# >>> OpenGL 2.0 +# Ignore extensions subsumed in OpenGL 2.0 (from OpenGL 2.0 spec, Appendix I) +# NOTE that GL_ARB_shader_objects is NOT ignored here, because the +# naming convention is too different for us to pick up the entry +# points automatically (e.g. glCreateShaderObjectARB was exposed as +# glCreateShader) +# IgnoreExtension GL_ARB_shader_objects +IgnoreExtension GL_ARB_vertex_shader +IgnoreExtension GL_ARB_fragment_shader +IgnoreExtension GL_ARB_texture_non_power_of_two +IgnoreExtension GL_ARB_point_sprite +IgnoreExtension GL_ARB_draw_buffers +IgnoreExtension GL_EXT_blend_equation_separate +# Don't ignore the following one since the entry point is different from anything in the core +# IgnoreExtension GL_EXT_stencil_two_side +# <<< OpenGL 2.0 + +# >>> OpenGL 2.1 +# Ignore extensions subsumed in OpenGL 2.1 (from OpenGL 2.1 spec, Appendix J) +IgnoreExtension GL_ARB_pixel_buffer_object +IgnoreExtension GL_EXT_texture_sRGB +# <<< OpenGL 2.1 + +# >>> OpenGL 3.0 +# Ignore/Rename extensions subsumed in OpenGL 3.0 (from OpenGL 3.0 spec, Appendix N) +RenameExtensionIntoCore GL_EXT_gpu_shader4 + +RenameExtensionIntoCore GL_NV_conditional_render + +RenameExtensionIntoCore GL_APPLE_flush_buffer_range + +RenameExtensionIntoCore GL_ARB_color_buffer_float +# gl.h uses GL_ARB_depth_buffer_float +RenameExtensionIntoCore GL_ARB_depth_buffer_float +IgnoreExtension GL_NV_depth_buffer_float +RenameExtensionIntoCore GL_ARB_texture_float +RenameExtensionIntoCore GL_EXT_packed_float +RenameExtensionIntoCore GL_EXT_texture_shared_exponent + +# gl.h uses GL_ARB_framebuffer_object +RenameExtensionIntoCore GL_ARB_framebuffer_object +IgnoreExtension GL_EXT_framebuffer_object + +RenameExtensionIntoCore GL_NV_half_float +RenameExtensionIntoCore GL_ARB_half_float_pixel + +RenameExtensionIntoCore GL_EXT_framebuffer_multisample +RenameExtensionIntoCore GL_EXT_framebuffer_blit + +#Big gap of promoted tokens and functions: GL_EXT_texture_integer +RenameExtensionIntoCore GL_EXT_texture_integer + +RenameExtensionIntoCore GL_EXT_texture_array + +RenameExtensionIntoCore GL_EXT_packed_depth_stencil + +RenameExtensionIntoCore GL_EXT_draw_buffers2 + +# gl.h uses GL_ARB_texture_compression_rgtc +RenameExtensionIntoCore GL_ARB_texture_compression_rgtc +IgnoreExtension GL_EXT_texture_compression_rgtc + +RenameExtensionIntoCore GL_EXT_transform_feedback +IgnoreExtension GL_NV_transform_feedback + +# gl.h uses GL_ARB_vertex_array_object +RenameExtensionIntoCore GL_ARB_vertex_array_object +IgnoreExtension GL_APPLE_vertex_array_object + +# gl.h uses GL_ARB_framebuffer_sRGB +RenameExtensionIntoCore GL_ARB_framebuffer_sRGB +IgnoreExtension GL_EXT_framebuffer_sRGB + +RenameExtensionIntoCore GL_ARB_map_buffer_range + +# <<< OpenGL 3.0 + +# >>> OpenGL 3.1 +# Rename extension suffices (if exist) subsumed in OpenGL 3.1 (from OpenGL 3.1 spec, Appendix G.1) +# We alias 3.1 subsumed extension even for GL2, due to the convenience of the common GL2GL3 profile! +RenameExtensionIntoCore GL_ARB_draw_instanced +IgnoreExtension GL_EXT_draw_instanced +RenameExtensionIntoCore GL_ARB_copy_buffer +# Does not match the common namespace GL_NV_primitive_restart +RenameExtensionIntoCore GL_ARB_texture_buffer_object +IgnoreExtension GL_EXT_texture_buffer_object +# We rename EXT_texture_rectangle into core, so ARB_texture_rectangle will stay for convenience +RenameExtensionIntoCore GL_EXT_texture_rectangle +IgnoreExtension GL_NV_texture_rectangle +RenameExtensionIntoCore GL_ARB_uniform_buffer_object +# <<< OpenGL 3.1 + +# >>> OpenGL 3.2 +# Rename extension suffices (if exist) subsumed in OpenGL 3.2 (from OpenGL 3.2 spec, Appendix H.1) +RenameExtensionIntoCore GL_ARB_vertex_array_bgra +RenameExtensionIntoCore GL_ARB_draw_elements_base_vertex +RenameExtensionIntoCore GL_ARB_fragment_coord_conventions +RenameExtensionIntoCore GL_ARB_provoking_vertex +RenameExtensionIntoCore GL_ARB_seamless_cube_map +RenameExtensionIntoCore GL_ARB_texture_multisample +RenameExtensionIntoCore GL_ARB_depth_clamp +# GL_ARB_geometry_shader4 is subsumed but values/namespace is orthogonal +IgnoreExtension GL_EXT_geometry_shader4 +RenameExtensionIntoCore GL_ARB_sync +# <<< OpenGL 3.2 + +# >>> OpenGL 3.3 +# Rename extension suffices (if exist) subsumed in OpenGL 3.3 (from OpenGL 3.3 spec, Appendix I.1) +RenameExtensionIntoCore GL_ARB_shader_bit_encoding +RenameExtensionIntoCore GL_ARB_blend_func_extended +RenameExtensionIntoCore GL_ARB_explicit_attrib_location +RenameExtensionIntoCore GL_ARB_occlusion_query2 +RenameExtensionIntoCore GL_ARB_sampler_objects +RenameExtensionIntoCore GL_ARB_texture_rgb10_a2ui +RenameExtensionIntoCore GL_ARB_texture_swizzle +RenameExtensionIntoCore GL_ARB_timer_query +RenameExtensionIntoCore GL_ARB_instanced_arrays +RenameExtensionIntoCore GL_ARB_vertex_type_2_10_10_10_rev +# <<< OpenGL 3.3 + +# >>> OpenGL 4.0 +# Rename extension suffices (if exist) subsumed in OpenGL 4.0 (from OpenGL 4.0 spec, Appendix J.1) +RenameExtensionIntoCore GL_ARB_texture_query_lod +RenameExtensionIntoCore GL_ARB_draw_buffers_blend +RenameExtensionIntoCore GL_ARB_draw_indirect +RenameExtensionIntoCore GL_ARB_gpu_shader5 +RenameExtensionIntoCore GL_ARB_gpu_shader_fp64 +RenameExtensionIntoCore GL_ARB_sample_shading +RenameExtensionIntoCore GL_ARB_shader_subroutine +RenameExtensionIntoCore GL_ARB_tessellation_shader +RenameExtensionIntoCore GL_ARB_texture_buffer_object_rgb32 +RenameExtensionIntoCore GL_ARB_texture_cube_map_array +RenameExtensionIntoCore GL_ARB_texture_gather +RenameExtensionIntoCore GL_ARB_transform_feedback2 +RenameExtensionIntoCore GL_ARB_transform_feedback3 +# <<< OpenGL 4.0 + +# >>> OpenGL 4.1 +# Rename extension suffices (if exist) subsumed in OpenGL 4.1 (from OpenGL 4.1 spec, Appendix K.1) +RenameExtensionIntoCore GL_ARB_ES2_compatibility +RenameExtensionIntoCore GL_ARB_get_program_binary +RenameExtensionIntoCore GL_ARB_separate_shader_objects +RenameExtensionIntoCore GL_ARB_shader_precision +RenameExtensionIntoCore GL_ARB_vertex_attrib_64bit +IgnoreExtension GL_EXT_vertex_attrib_64bit +RenameExtensionIntoCore GL_ARB_viewport_array +# <<< OpenGL 4.1 + +# 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 +IgnoreExtension GL_EXT_separate_shader_objects + + +# +# Opaques and other directives for platform-independent routines +# + +Opaque boolean GLboolean +Opaque long GLsync +ReturnsString glGetString +ReturnsString glGetStringi + +# Experimental: Only NIO function, no arrays .. +# NIOOnly __ALL__ + +# +# NIODirectOnly directives for vertex arrays and other core routines +# + +NIODirectOnly glColorPointer +NIODirectOnly glEdgeFlagPointer +NIODirectOnly glFeedbackBuffer +NIODirectOnly glIndexPointer +NIODirectOnly glNormalPointer +NIODirectOnly glSelectBuffer +NIODirectOnly glTexCoordPointer +NIODirectOnly glVertexPointer +# +# FIXME: we should probably be ignoring the "EXT" variants of these +# +NIODirectOnly glColorPointerEXT +NIODirectOnly glEdgeFlagPointerEXT +NIODirectOnly glIndexPointerEXT +NIODirectOnly glNormalPointerEXT +NIODirectOnly glTexCoordPointerEXT +NIODirectOnly glVertexPointerEXT +# +# NIODirectOnly directives for other extensions +# +NIODirectOnly glBinormalPointerEXT +NIODirectOnly glGetBufferSubDataARB +# FIXME: should add way to restrict argument to be a direct ByteBuffer +NIODirectOnly glGetProgramStringARB +NIODirectOnly glElementPointerATI +NIODirectOnly glElementPointerNV +NIODirectOnly glElementPointerAPPLE +NIODirectOnly glFogCoordPointer +NIODirectOnly glFogCoordPointerEXT +NIODirectOnly glMatrixIndexPointerARB +NIODirectOnly glPixelDataRangeNV +NIODirectOnly glSecondaryColorPointer +NIODirectOnly glSecondaryColorPointerEXT +NIODirectOnly glTangentPointerEXT +NIODirectOnly glVertexArrayRangeNV +NIODirectOnly glVertexArrayRangeApple +NIODirectOnly glVertexAttribPointerARB +NIODirectOnly glVertexAttribPointerNV +NIODirectOnly glVertexWeightPointerEXT +NIODirectOnly glWeightPointerARB +NIODirectOnly wglFreeMemoryNV +NIODirectOnly glXFreeMemoryNV + +# 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 +ArgumentIsString glBindAttribLocation 2 +ArgumentIsString glBindAttribLocationARB 2 +ArgumentIsString glGetAttribLocation 1 +ArgumentIsString glGetAttribLocationARB 1 +ArgumentIsString glGetProgramNamedParameterfvNV 2 +ArgumentIsString glGetProgramNamedParameterdvNV 2 +ArgumentIsString glGetUniformLocation 1 +ArgumentIsString glGetUniformLocationARB 1 +ArgumentIsString glLoadProgramNV 3 +ArgumentIsString glProgramString 3 +ArgumentIsString glProgramStringARB 3 +ArgumentIsString glProgramNamedParameter4fNV 2 +ArgumentIsString glProgramNamedParameter4dNV 2 +ArgumentIsString glProgramNamedParameter4fvNV 2 +ArgumentIsString glProgramNamedParameter4dvNV 2 +ArgumentIsString glShaderSource 2 +ArgumentIsString glShaderSourceARB 2 + +ArgumentIsString glBindFragDataLocation 2 +ArgumentIsString glGetFragDataLocation 1 +ArgumentIsString glGetUniformIndices 2 +ArgumentIsString glGetUniformBlockIndex 1 +ArgumentIsString glTransformFeedbackVaryings 2 + +# String output values: +# ArgumentIsString glGetActiveAttrib 6 +# ArgumentIsString glGetActiveUniformBlockName 4 +# ArgumentIsString glGetActiveUniformName 4 +# ArgumentIsString glGetActiveUniform 6 +# ArgumentIsString glGetProgramInfoLog 3 +# ArgumentIsString glGetShaderInfoLog 3 +# ArgumentIsString glGetShaderSource 3 +# ArgumentIsString glGetTransformFeedbackVarying 6 + +# +# Use cached GL_EXTENSION if possible, +# which also allows GL3 compatibility. +# +JavaPrologue glGetString if(_context.isExtensionCacheInitialized()) { +JavaPrologue glGetString if(GL.GL_EXTENSIONS==name) { +JavaPrologue glGetString return _context.getGLExtensions(); +JavaPrologue glGetString } /* else if(GL.GL_VERSION==name) { +JavaPrologue glGetString return _context.getGLVersion(); +JavaPrologue glGetString } */ +JavaPrologue glGetString } + +# +# Directives for Vertex Buffer Object and Pixel Buffer Object checking +# +# NOTE: we currently don't emit glue code for some of these but +# include them for completeness. +# +# FIXME: what about glMultiDrawElements? Do we want to add a VBO +# variant for that, or simply add checks to the top of the current +# implementation? +# +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}); + +BufferObjectKind Array glColorPointer +BufferObjectKind Array glEdgeFlagPointer +BufferObjectKind Array glElementPointerATI +BufferObjectKind Array glFogCoordPointer +BufferObjectKind Array glFogCoordPointerEXT +# The next one is problematic. It isn't discussed by the specs and +# doesn't have any associated state. +BufferObjectKind Array glInterleavedArrays +BufferObjectKind Array glMatrixIndexPointerARB +BufferObjectKind Array glNormalPointer +BufferObjectKind Array glSecondaryColorPointer +BufferObjectKind Array glSecondaryColorPointerEXT +BufferObjectKind Array glTexCoordPointer +BufferObjectKind Array glVariantPointerEXT +BufferObjectKind Array glVertexPointer +BufferObjectKind Array glVertexAttribPointer +BufferObjectKind Array glVertexAttribPointerARB +BufferObjectKind Array glVertexAttribPointerNV +BufferObjectKind Array glVertexWeightPointerEXT +BufferObjectKind Array glWeightPointerARB + +BufferObjectKind Element glDrawElements +BufferObjectKind Element glDrawRangeElements +BufferObjectKind Element glDrawRangeElementsEXT + +# There are no PBOs in the embedded OpenGL variants right now +BufferObjectKind UnpackPixel glBitmap +BufferObjectKind UnpackPixel glColorTable +BufferObjectKind UnpackPixel glColorSubTable +BufferObjectKind UnpackPixel glCompressedTexImage1D +BufferObjectKind UnpackPixel glCompressedTexImage1DARB +BufferObjectKind UnpackPixel glCompressedTexImage2D +BufferObjectKind UnpackPixel glCompressedTexImage2DARB +BufferObjectKind UnpackPixel glCompressedTexImage3D +BufferObjectKind UnpackPixel glCompressedTexImage3DARB +BufferObjectKind UnpackPixel glCompressedTexSubImage1D +BufferObjectKind UnpackPixel glCompressedTexSubImage1DARB +BufferObjectKind UnpackPixel glCompressedTexSubImage2D +BufferObjectKind UnpackPixel glCompressedTexSubImage2DARB +BufferObjectKind UnpackPixel glCompressedTexSubImage3D +BufferObjectKind UnpackPixel glCompressedTexSubImage3DARB +BufferObjectKind UnpackPixel glConvolutionFilter1D +BufferObjectKind UnpackPixel glConvolutionFilter2D +BufferObjectKind UnpackPixel glDrawPixels +BufferObjectKind UnpackPixel glPixelMapfv +BufferObjectKind UnpackPixel glPixelMapuiv +BufferObjectKind UnpackPixel glPixelMapusv +BufferObjectKind UnpackPixel glPolygonStipple +BufferObjectKind UnpackPixel glSeparableFilter2D +BufferObjectKind UnpackPixel glTexImage1D +BufferObjectKind UnpackPixel glTexImage2D +BufferObjectKind UnpackPixel glTexImage3D +BufferObjectKind UnpackPixel glTexSubImage1D +BufferObjectKind UnpackPixel glTexSubImage2D +BufferObjectKind UnpackPixel glTexSubImage3D + +BufferObjectKind PackPixel glGetColorTable +BufferObjectKind PackPixel glGetCompressedTexImage +BufferObjectKind PackPixel glGetCompressedTexImageARB +BufferObjectKind PackPixel glGetConvolutionFilter +BufferObjectKind PackPixel glGetHistogram +BufferObjectKind PackPixel glGetMinmax +BufferObjectKind PackPixel glGetPixelMapfv +BufferObjectKind PackPixel glGetPixelMapuiv +BufferObjectKind PackPixel glGetPixelMapusv +BufferObjectKind PackPixel glGetPolygonStipple +BufferObjectKind PackPixel glGetSeparableFilter +BufferObjectKind PackPixel glGetTexImage +BufferObjectKind PackPixel glReadPixels + +# Range check directives for various routines +# 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 glEdgeFlagPointer 1 1 +RangeCheck glElementPointerATI 1 1 +RangeCheck glFogCoordPointer 2 1 +RangeCheck glFogCoordPointerEXT 2 1 +RangeCheck glInterleavedArrays 2 1 +RangeCheck glMatrixIndexPointerARB 3 1 +RangeCheck glNormalPointer 2 1 +RangeCheck glSecondaryColorPointer 3 1 +RangeCheck glSecondaryColorPointerEXT 3 1 +RangeCheck glTexCoordPointer 3 1 +RangeCheck glVariantPointerEXT 3 1 +RangeCheck glVertexPointer 3 1 +RangeCheck glVertexAttribPointer 5 1 +RangeCheck glVertexAttribPointerARB 5 1 +RangeCheck glWeightPointerARB 3 1 + +# Give ourselves the texture width and height for range checking inside glGetTexImage +JavaPrologue glGetTexImage int width = 0, height = 0, depth = 1; +JavaPrologue glGetTexImage int[] tmp = new int[1]; +JavaPrologue glGetTexImage glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, tmp, 0); +JavaPrologue glGetTexImage width = tmp[0]; +JavaPrologue glGetTexImage glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, tmp, 0); +JavaPrologue glGetTexImage height = tmp[0]; +JavaPrologue glGetTexImage if (target == GL_TEXTURE_3D) { +JavaPrologue glGetTexImage glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, tmp, 0); +JavaPrologue glGetTexImage depth = tmp[0]; +JavaPrologue glGetTexImage } + +# Range check directives for various image-related routines +RangeCheckBytes glColorTable 5 imageSizeInBytes({3}, {4}, {2} , 1 , 1 , false) +RangeCheckBytes glColorTableEXT 5 imageSizeInBytes({3}, {4}, {2} , 1 , 1 , false) +RangeCheckBytes glConvolutionFilter1D 5 imageSizeInBytes({3}, {4}, {2} , 1 , 1 , false) +RangeCheckBytes glConvolutionFilter2D 6 imageSizeInBytes({4}, {5}, {2} , {3} , 1 , false) +RangeCheckBytes glDrawPixels 4 imageSizeInBytes({2}, {3}, {0} , {1} , 1 , false) +RangeCheckBytes glReadPixels 6 imageSizeInBytes({4}, {5}, {2} , {3} , 1 , true) +RangeCheckBytes glTexImage1D 7 imageSizeInBytes({5}, {6}, {3} , 1 , 1 , false) +RangeCheckBytes glTexImage2D 8 imageSizeInBytes({6}, {7}, {3} , {4} , 1 , false) +RangeCheckBytes glTexImage3D 9 imageSizeInBytes({7}, {8}, {3} , {4} , {5} , false) +RangeCheckBytes glTexSubImage1D 6 imageSizeInBytes({4}, {5}, {3} , 1 , 1 , false) +RangeCheckBytes glTexSubImage2D 8 imageSizeInBytes({6}, {7}, {4} , {5} , 1 , false) +RangeCheckBytes glTexSubImage3D 10 imageSizeInBytes({8}, {9}, {5} , {6} , {7} , false) +# This may produce wrong answers for 1D textures +RangeCheckBytes glGetTexImage 4 imageSizeInBytes({2}, {3}, width , height , depth, true) +# Note we don't support glTexImage4DSGIS / glTexSubImage4DSGIS +# FIXME: add the following unpack operations: +# glBitmap, glPolygonStipple +# and the following pack operations: +# glGetColorTable, glGetConvolutionFilter, glGetSeparableFilter, glGetHistogram, glGetMinmax + +# Range checks for server-side object creation and deletion methods +RangeCheck glGenBuffers 1 {0} +RangeCheck glDeleteBuffers 1 {0} +RangeCheck glGenBuffersARB 1 {0} +RangeCheck glDeleteBuffersARB 1 {0} +RangeCheck glGenFencesAPPLE 1 {0} +RangeCheck glDeleteFencesAPPLE 1 {0} +RangeCheck glGenFencesNV 1 {0} +RangeCheck glDeleteFencesNV 1 {0} +RangeCheck glGenFramebuffersEXT 1 {0} +RangeCheck glDeleteFramebuffersEXT 1 {0} +RangeCheck glGenOcclusionQueriesNV 1 {0} +RangeCheck glDeleteOcclusionQueriesNV 1 {0} +RangeCheck glGenProgramsARB 1 {0} +RangeCheck glDeleteProgramsARB 1 {0} +RangeCheck glGenProgramsNV 1 {0} +RangeCheck glDeleteProgramsNV 1 {0} +RangeCheck glGenQueries 1 {0} +RangeCheck glDeleteQueries 1 {0} +RangeCheck glGenQueriesARB 1 {0} +RangeCheck glDeleteQueriesARB 1 {0} +RangeCheck glGenRenderbuffersEXT 1 {0} +RangeCheck glDeleteRenderbuffersEXT 1 {0} +RangeCheck glGenTextures 1 {0} +RangeCheck glDeleteTextures 1 {0} +RangeCheck glGenVertexArraysAPPLE 1 {0} +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 */ + +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 */ + +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 */ + +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 */ + +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 */ + +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 */ + +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 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 */ + +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 */ + +# Javadoc for the EGL class +ClassJavadoc EGL /** +ClassJavadoc EGL * Provides access to the embedded-specific OpenGL vendor extensions. +ClassJavadoc EGL * See {@link GLBase} for more information. +ClassJavadoc EGL */ + +# Javadoc for the WGL class +ClassJavadoc WGL /** +ClassJavadoc WGL * Provides access to the Windows-specific OpenGL vendor extensions. +ClassJavadoc WGL * See {@link GLBase} for more information. +ClassJavadoc WGL */ + +# Javadoc for the GLX class +ClassJavadoc GLX /** +ClassJavadoc GLX * Provides access to the X11-specific OpenGL vendor extensions. +ClassJavadoc GLX * See {@link GLBase} for more information. +ClassJavadoc GLX */ + +# Javadoc for the CGL class +ClassJavadoc CGL /** +ClassJavadoc CGL * Provides access to the MacOSX-specific OpenGL vendor extensions. +ClassJavadoc CGL * See {@link GLBase} for more information. +ClassJavadoc CGL */ + +# Javadoc for the XVisualInfo class +ClassJavadoc XVisualInfo /** +ClassJavadoc XVisualInfo * Wrapper for the XVisualInfo data structure, referenced by some GLX OpenGL +ClassJavadoc XVisualInfo * extensions. No other access is provided to these data structures so currently +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-tracker.cfg b/make/config/jogl/gl-desktop-tracker.cfg new file mode 100644 index 000000000..4b9a7edb7 --- /dev/null +++ b/make/config/jogl/gl-desktop-tracker.cfg @@ -0,0 +1,38 @@ + +# Track server-side object creation and deletion when necessary +# Note that this is only necessary when the Java 2D / JOGL bridge is active, +# so will never be needed for the embedded OpenGL variants +JavaEpilogue glGenBuffers if (tracker != null) tracker.addBuffers({0}, {1}); +JavaEpilogue glGenFencesAPPLE if (tracker != null) tracker.addFencesAPPLE({0}, {1}); +JavaEpilogue glGenFencesNV if (tracker != null) tracker.addFencesNV({0}, {1}); +JavaEpilogue glGenFragmentShadersATI if (tracker != null) tracker.addFragmentShadersATI(_res, {0}); +JavaEpilogue glGenFramebuffersEXT if (tracker != null) tracker.addFramebuffersEXT({0}, {1}); +JavaEpilogue glGenLists if (tracker != null) tracker.addLists(_res, {0}); +JavaEpilogue glGenOcclusionQueriesNV if (tracker != null) tracker.addOcclusionQueriesNV({0}, {1}); +JavaEpilogue glCreateProgram if (tracker != null) tracker.addProgramObject(_res); +JavaEpilogue glGenPrograms if (tracker != null) tracker.addPrograms({0}, {1}); +JavaEpilogue glGenQueries if (tracker != null) tracker.addQueries({0}, {1}); +JavaEpilogue glGenRenderbuffersEXT if (tracker != null) tracker.addRenderbuffersEXT({0}, {1}); +JavaEpilogue glCreateShader if (tracker != null) tracker.addShaderObject(_res); +JavaEpilogue glGenTextures if (tracker != null) tracker.addTextures({0}, {1}); +JavaEpilogue glGenVertexArraysAPPLE if (tracker != null) tracker.addVertexArraysAPPLE({0}, {1}); +JavaEpilogue glGenVertexShadersEXT if (tracker != null) tracker.addVertexShadersEXT(_res, {0}); + +JavaEpilogue glDeleteBuffers if (tracker != null) tracker.removeBuffers({0}, {1}); +JavaEpilogue glDeleteFencesAPPLE if (tracker != null) tracker.removeFencesAPPLE({0}, {1}); +JavaEpilogue glDeleteFencesNV if (tracker != null) tracker.removeFencesNV({0}, {1}); +JavaEpilogue glDeleteFragmentShaderATI if (tracker != null) tracker.removeFragmentShaderATI({0}); +JavaEpilogue glDeleteFramebuffersEXT if (tracker != null) tracker.removeFramebuffersEXT({0}, {1}); +JavaEpilogue glDeleteLists if (tracker != null) tracker.removeLists({0}, {1}); +JavaEpilogue glDeleteOcclusionQueriesNV if (tracker != null) tracker.removeOcclusionQueriesNV({0}, {1}); +JavaEpilogue glDeleteProgram if (tracker != null) tracker.removeProgramObject({0}); +JavaEpilogue glDeleteObject if (tracker != null) tracker.removeProgramOrShaderObject({0}); +JavaEpilogue glDeletePrograms if (tracker != null) tracker.removePrograms({0}, {1}); +JavaEpilogue glDeleteProgramsNV if (tracker != null) tracker.removeProgramsNV({0}, {1}); +JavaEpilogue glDeleteQueries if (tracker != null) tracker.removeQueries({0}, {1}); +JavaEpilogue glDeleteRenderbuffersEXT if (tracker != null) tracker.removeRenderbuffersEXT({0}, {1}); +JavaEpilogue glDeleteShader if (tracker != null) tracker.removeShaderObject({0}); +JavaEpilogue glDeleteTextures if (tracker != null) tracker.removeTextures({0}, {1}); +JavaEpilogue glDeleteVertexArraysAPPLE if (tracker != null) tracker.removeVertexArraysAPPLE({0}, {1}); +JavaEpilogue glDeleteVertexShaderEXT if (tracker != null) tracker.removeVertexShaderEXT({0}); + diff --git a/make/config/jogl/gl-desktop.cfg b/make/config/jogl/gl-desktop.cfg new file mode 100644 index 000000000..ce2fefe2f --- /dev/null +++ b/make/config/jogl/gl-desktop.cfg @@ -0,0 +1,62 @@ +# 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 + + +# +# Directives needed when processing wglext.h on Windows and other platforms +# +Opaque boolean BOOL +ReturnsString wglGetExtensionsStringARB +ReturnsString wglGetExtensionsStringEXT +Opaque long HANDLE +Opaque long HBITMAP +Opaque long HDC +Opaque long HGDIOBJ +Opaque long HGLRC +Opaque long HPBUFFERARB +Opaque long HPBUFFEREXT +Opaque boolean BOOL +Opaque long PROC +Opaque long void ** + +# XID needs to be treated as a long for 32/64 bit compatibility +Opaque long XID + +# +# Directives needed when processing cglext.h on MacOSX and other platforms +# +Opaque long CGContextRef +Opaque long void ** +# Implement the first argument to cglGetProcAddress as String instead +# of byte[] +ArgumentIsString cglGetProcAddress 0 + +# +# Directives needed when processing glxext.h on X11 and other platforms +# +Opaque long __GLXextFuncPtr +Opaque boolean Bool +Opaque long Display * +Opaque long GLXContext +Opaque long Visual * +# Ignore the empty Display and Visual data structures (though made +# opaque, the references from XVisualInfo and elsewhere are still +# traversed) +Ignore Display +Ignore Visual +ArgumentIsString glXGetProcAddress 0 +ArgumentIsString glXGetProcAddressARB 0 +ReturnsString glXQueryExtensionsString +ReturnsString glXQueryServerString +ReturnsString glXGetClientString +TemporaryCVariableDeclaration glXGetFBConfigs int count; +TemporaryCVariableAssignment glXGetFBConfigs count = _nelements_ptr[0]; +ReturnValueCapacity glXGetFBConfigs count * sizeof(GLXFBConfig) + diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg new file mode 100644 index 000000000..4543b7fd2 --- /dev/null +++ b/make/config/jogl/gl-es1.cfg @@ -0,0 +1,100 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/es1 + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java + +# There are a few routines we don't handle yet +Ignore glGetBufferPointervOES +Package javax.media.opengl +Style InterfaceAndImpl +JavaClass GLES1 +Extends GLES1 GLBase +Extends GLES1 GL +Extends GLES1 GL2ES1 +ImplPackage com.jogamp.opengl.impl.es1 +ImplJavaClass GLES1Impl +Implements GLES1Impl GLBase +Implements GLES1Impl GL +Implements GLES1Impl GL2ES1 +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg + +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 +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to GL_APIENTRY +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. +CustomJavaCode GLES1Impl 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; } + +CustomJavaCode GLES1Impl public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) { +CustomJavaCode GLES1Impl glOrtho((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val); } + +CustomJavaCode GLES1Impl public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { +CustomJavaCode GLES1Impl glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar); } + +CustomJavaCode GLES1Impl public void glClearDepth(double depth) { +CustomJavaCode GLES1Impl glClearDepthf((float)depth); } + +CustomJavaCode GLES1Impl public void glDepthRange(double zNear, double zFar) { +CustomJavaCode GLES1Impl glDepthRangef((float)zNear, (float)zFar); } + +CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "glext.h" are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES + +CustomCCode /* Include the OpenGL headers */ +CustomCCode /* #define GL_APICALL __declspec(dllimport) */ +CustomCCode #include <GLES/gl.h> +CustomCCode #include <GLES/glext.h> +CustomCCode #include <stdlib.h> +Include ../intptr.cfg + +IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-common.java +IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-gles1.java +IncludeAs CustomJavaCode GLES1Impl gl-impl-CustomJavaCode-embedded.java +IncludeAs CustomCCode gl-impl-CustomCCode-gles1.c + +Import javax.media.opengl.GLES1 +Import javax.media.opengl.GLES2 +Import javax.media.opengl.GL2 +Import com.jogamp.common.nio.Buffers diff --git a/make/config/jogl/gl-es2.cfg b/make/config/jogl/gl-es2.cfg new file mode 100644 index 000000000..9caa3b7f7 --- /dev/null +++ b/make/config/jogl/gl-es2.cfg @@ -0,0 +1,89 @@ +# 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 InterfaceAndImpl +JavaClass GLES2 +Extends GLES2 GLBase +Extends GLES2 GL +Extends GLES2 GL2ES2 +ImplPackage com.jogamp.opengl.impl.es2 +ImplJavaClass GLES2Impl +Implements GLES2Impl GLBase +Implements GLES2Impl GL +Implements GLES2Impl GL2ES2 +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl2_es2-common.cfg + +RenameExtensionIntoCore GL_OES_texture_3D +RenameExtensionIntoCore GL_OES_get_program_binary + +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 + +# 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 +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to GL_APIENTRY +LocalProcAddressCallingConvention __ALL__ GL_APIENTRY + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +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 .. + +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 /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "glext.h" are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES + +CustomCCode /* Include the OpenGL headers */ +CustomCCode /* #define GL_APICALL __declspec(dllimport) */ +CustomCCode #include <GLES2/gl2.h> +CustomCCode #include <GLES2/gl2ext.h> +CustomCCode #include <stdlib.h> +Include ../intptr.cfg + +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 +Import javax.media.opengl.GLArrayData +Import javax.media.opengl.GLUniformData +Import com.jogamp.common.nio.Buffers +Import java.io.PrintStream + diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg new file mode 100644 index 000000000..33105d5f0 --- /dev/null +++ b/make/config/jogl/gl-gl4bc.cfg @@ -0,0 +1,104 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +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/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL4.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3bc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java + +Package javax.media.opengl +Style InterfaceAndImpl +JavaClass GL4bc +Extends GL4bc GLBase +Extends GL4bc GL +Extends GL4bc GL2ES1 +Extends GL4bc GL2ES2 +Extends GL4bc GL2GL3 +Extends GL4bc GL2 +Extends GL4bc GL3 +Extends GL4bc GL3bc +Extends GL4bc GL4 +ImplPackage com.jogamp.opengl.impl.gl4 +ImplJavaClass GL4bcImpl +Implements GL4bcImpl GLBase +Implements GL4bcImpl GL +Implements GL4bcImpl GL2ES1 +Implements GL4bcImpl GL2ES2 +Implements GL4bcImpl GL2GL3 +Implements GL4bcImpl GL2 +Implements GL4bcImpl GL3 +Implements GL4bcImpl GL3bc +Implements GL4bcImpl GL4 + +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg +Include gl3-desktop.cfg +Include gl2_es2-common.cfg + +# 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}); + +# 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 +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to APIENTRY +LocalProcAddressCallingConvention __ALL__ APIENTRY + +EmitProcAddressTable true +ProcAddressTableClassName GL4bcProcAddressTable +GetProcAddressTableExpr ((GL4bcProcAddressTable)_context.getGLProcAddressTable()) + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +# Ignore extensions that are already picked up via the GL2ES1 interface +IgnoreExtension GL_EXT_point_parameters + +# Add PixelStorei StateTracker +CustomJavaCode GL4bcImpl private static final int params_offset = 0; // just a helper for JavaPrologue .. + +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); } + +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); } + +Include gl-headers.cfg +Include gl3ext-headers.cfg +Include ../intptr.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.GL2GL3 +Import javax.media.opengl.GL2 +Import javax.media.opengl.GL3 +Import javax.media.opengl.GL3bc +Import javax.media.opengl.GL4 +Import com.jogamp.common.nio.Buffers +Import java.io.PrintStream diff --git a/make/config/jogl/gl-headers.cfg b/make/config/jogl/gl-headers.cfg new file mode 100644 index 000000000..5a648b582 --- /dev/null +++ b/make/config/jogl/gl-headers.cfg @@ -0,0 +1,37 @@ +CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "glext.h" are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES +CustomCCode #if defined(_WIN32) +CustomCCode #define WIN32_LEAN_AND_MEAN +CustomCCode #include <windows.h> +CustomCCode #undef WIN32_LEAN_AND_MEAN +CustomCCode #include <stdlib.h> +CustomCCode #include <stddef.h> +CustomCCode #include <malloc.h> +CustomCCode /* Define WGL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "wglext.h" are parsed. */ +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 #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 /* Provide Windows typedefs */ +CustomCCode typedef void* LPVOID; +CustomCCode typedef unsigned int* PUINT; +CustomCCode #elif defined(linux) || defined(__sun) || defined(__FreeBSD__) || defined(_HPUX) +CustomCCode #include <inttypes.h> +CustomCCode #include <stdlib.h> +CustomCCode #include <X11/Xlib.h> +CustomCCode /* Define GLX_GLXEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "glxext.h" are parsed. */ +CustomCCode #define GLX_GLXEXT_PROTOTYPES +CustomCCode /* Include the OpenGL headers */ +CustomCCode #include <GL/gl.h> +CustomCCode #include <GL/glx.h> +CustomCCode #include <GL/glxext.h> +CustomCCode #endif diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl.java b/make/config/jogl/gl-if-CustomJavaCode-gl.java new file mode 100644 index 000000000..1ff8b8e8e --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl.java @@ -0,0 +1,65 @@ + + /** Common in ES1, GL2 and GL3 */ + public static final int GL_AND = 0x1501; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_AND_INVERTED = 0x1504; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_AND_REVERSE = 0x1502; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_BLEND_DST = 0x0BE0; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_BLEND_SRC = 0x0BE1; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_CLEAR = 0x1500; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_COLOR_LOGIC_OP = 0x0BF2; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_COPY = 0x1503; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_COPY_INVERTED = 0x150C; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_EQUIV = 0x1509; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_LINE_SMOOTH = 0x0B20; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_LINE_SMOOTH_HINT = 0x0C52; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_LOGIC_OP_MODE = 0x0BF0; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_MULTISAMPLE = 0x809D; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_NAND = 0x150E; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_NOOP = 0x1505; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_NOR = 0x1508; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_OR = 0x1507; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_OR_INVERTED = 0x150D; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_OR_REVERSE = 0x150B; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_POINT_SIZE = 0x0B11; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_SAMPLE_ALPHA_TO_ONE = 0x809F; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_SET = 0x150F; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; + /** Common in ES1, GL2 and GL3 */ + public static final int GL_XOR = 0x1506; + + public void glClearDepth( double depth ); + + public void glDepthRange(double zNear, double zFar); + + public int glGetBoundBuffer(int target); + + public boolean glIsVBOArrayEnabled(); + public boolean glIsVBOElementEnabled(); + diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java b/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java new file mode 100644 index 000000000..1599a89ca --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl2_es2.java @@ -0,0 +1,46 @@ + + /** Start: GL_ARB_ES2_compatibility functions, which are part of ES2 core as well */ + + /** Entry point to C language function: + * <code> void {@native glReleaseShaderCompiler}(void); </code> + * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. + * <br> Nop if no native implementation is available. */ + public void glReleaseShaderCompiler(); + + /** Entry point to C language function: + * <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> + * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. + * <br> Throws GLException if no native implementation is available. */ + public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length); + + /** Entry point to C language function: + * <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> + * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. + * <br> Throws GLException if no native implementation is available. */ + public void glShaderBinary(int n, int[] shaders, int shaders_offset, int binaryformat, Buffer binary, int length); + + /** Entry point to C language function: + * <code> void {@native glGetShaderPrecisionFormat}(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); </code> + * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. + * <br> Throws GLException if no native implementation is available. */ + public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range, IntBuffer precision); + + /** Entry point to C language function: + * <code> void {@native glGetShaderPrecisionFormat}(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); </code> + * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. + * <br> Throws GLException if no native implementation is available. */ + public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, int[] range, int range_offset, int[] precision, int precision_offset); + + /** Entry point to C language function: + * <code> void {@native glDepthRangef}(GLclampf zNear, GLclampf zFar); </code> + * <br>Part of <code>GL_ES_VERSION_2_0</code> and <code>GL_ARB_ES2_compatibility</code>. + * <br> Calls <code> void {@native glDepthRange}(GLclampd zNear, GLclampd zFar); </code> if no native implementation is available. */ + public void glDepthRangef(float zNear, float 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); + + /** End: GL_ARB_ES2_compatibility functions, which are part of ES2 core as well */ diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl2_gl3.java b/make/config/jogl/gl-if-CustomJavaCode-gl2_gl3.java new file mode 100644 index 000000000..1777c1557 --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl2_gl3.java @@ -0,0 +1,8 @@ + +/** Part of <code>GL_ARB_uniform_buffer_object</code> */ +public static final int GL_INVALID_INDEX = 0xFFFFFFFF ; + +/** Part of <code>GL_ARB_sync</code> */ +public static final long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFL ; + + diff --git a/make/config/jogl/gl-if-CustomJavaCode-gles2.java b/make/config/jogl/gl-if-CustomJavaCode-gles2.java new file mode 100644 index 000000000..ea40f6329 --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gles2.java @@ -0,0 +1,3 @@ + + public static final int GL_NVIDIA_PLATFORM_BINARY_NV = 0x890B; + diff --git a/make/config/jogl/gl-if-gl-ignores.cfg b/make/config/jogl/gl-if-gl-ignores.cfg new file mode 100644 index 000000000..94e26d856 --- /dev/null +++ b/make/config/jogl/gl-if-gl-ignores.cfg @@ -0,0 +1,553 @@ +# FIXME: some of these definitions like the ARB_imaging subset should end up in the GL interface + +# +# remove all enums/funcs which are not subset of all GL profiles +# + +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_get_program_binary +IgnoreExtension GL_OES_standard_derivatives +# subsumed, so ignore the aliased ones +IgnoreExtension GL_OES_vertex_type_10_10_10_2 +Ignore GL_UNSIGNED_INT_10_10_10_2 +Ignore GL_INT_10_10_10_2 + +IgnoreExtension GL_OES_vertex_array_object +IgnoreExtension GL_OES_texture_3D + +# isn't included in GL2 +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET + +# includes GL_STATE_RESTORE, which hasn't the QCOM suffix +IgnoreExtension GL_QCOM_extended_get +Ignore GL_STATE_RESTORE + +Ignore GL_ACTIVE_ATTRIBUTE_MAX_LENGTH +Ignore GL_ACTIVE_ATTRIBUTES +Ignore GL_ACTIVE_UNIFORM_MAX_LENGTH +Ignore GL_ACTIVE_UNIFORMS +Ignore GL_ADD +Ignore GL_ADD_SIGNED +Ignore GL_ALPHA_SCALE +Ignore GL_ALPHA_TEST +Ignore GL_ALPHA_TEST_FUNC +Ignore GL_ALPHA_TEST_REF +Ignore GL_AMBIENT +Ignore GL_AMBIENT_AND_DIFFUSE +Ignore GL_AND +Ignore GL_AND_INVERTED +Ignore GL_AND_REVERSE +Ignore GL_ATTACHED_SHADERS +Ignore GL_BLEND_COLOR +Ignore GL_BLEND_DST +#Ignore GL_BLEND_DST_ALPHA +#Ignore GL_BLEND_DST_RGB +#Ignore GL_BLEND_EQUATION +#Ignore GL_BLEND_EQUATION_ALPHA +#Ignore GL_BLEND_EQUATION_ALPHA_OES +Ignore GL_BLEND_EQUATION_OES +#Ignore GL_BLEND_EQUATION_RGB +#Ignore GL_BLEND_EQUATION_RGB_OES +Ignore GL_BLEND_SRC +#Ignore GL_BLEND_SRC_ALPHA +#Ignore GL_BLEND_SRC_ALPHA_OES +#Ignore GL_BLEND_SRC_RGB +#Ignore GL_BLEND_SRC_RGB_OES +Ignore GL_BOOL +Ignore GL_BOOL_VEC2 +Ignore GL_BOOL_VEC3 +Ignore GL_BOOL_VEC4 +Ignore GL_BUFFER_ACCESS_OES +Ignore GL_CLEAR +Ignore GL_CLIENT_ACTIVE_TEXTURE +Ignore GL_CLIP_PLANE0 +Ignore GL_CLIP_PLANE1 +Ignore GL_CLIP_PLANE2 +Ignore GL_CLIP_PLANE3 +Ignore GL_CLIP_PLANE4 +Ignore GL_CLIP_PLANE5 +Ignore GL_COLOR_ARRAY +Ignore GL_COLOR_ARRAY_BUFFER_BINDING +Ignore GL_COLOR_ARRAY_POINTER +Ignore GL_COLOR_ARRAY_SIZE +Ignore GL_COLOR_ARRAY_STRIDE +Ignore GL_COLOR_ARRAY_TYPE +Ignore GL_COLOR_LOGIC_OP +Ignore GL_COLOR_MATERIAL +Ignore GL_COMBINE +Ignore GL_COMBINE_ALPHA +Ignore GL_COMBINE_RGB +Ignore GL_COMPILE_STATUS +Ignore GL_CONSTANT +Ignore GL_CONSTANT_ALPHA +Ignore GL_CONSTANT_ATTENUATION +Ignore GL_CONSTANT_COLOR +Ignore GL_COORD_REPLACE_OES +Ignore GL_COPY +Ignore GL_COPY_INVERTED +Ignore GL_CURRENT_COLOR +Ignore GL_CURRENT_NORMAL +Ignore GL_CURRENT_PALETTE_MATRIX_OES +Ignore GL_CURRENT_PROGRAM +Ignore GL_CURRENT_TEXTURE_COORDS +Ignore GL_CURRENT_VERTEX_ATTRIB +Ignore GL_DECAL +#Ignore GL_DECR_WRAP +#Ignore GL_DECR_WRAP_OES +Ignore GL_DELETE_STATUS +Ignore GL_DEPTH_COMPONENT +Ignore GL_DEPTH_COMPONENT24_OES +Ignore GL_DEPTH_COMPONENT32_OES +Ignore GL_DIFFUSE +Ignore GL_DOT3_RGB +Ignore GL_DOT3_RGBA +Ignore GL_EMISSION +Ignore GL_EQUIV +Ignore GL_ES_VERSION_2_0 +Ignore GL_ETC1_RGB8_OES +Ignore GL_EXP +Ignore GL_EXP2 +#Ignore GL_FIXED_OES +#Ignore GL_FIXED +Ignore GL_FLAT +Ignore GL_FLOAT_MAT2 +Ignore GL_FLOAT_MAT3 +Ignore GL_FLOAT_MAT4 +Ignore GL_FLOAT_VEC2 +Ignore GL_FLOAT_VEC3 +Ignore GL_FLOAT_VEC4 +Ignore GL_FOG +Ignore GL_FOG_COLOR +Ignore GL_FOG_DENSITY +Ignore GL_FOG_END +Ignore GL_FOG_HINT +Ignore GL_FOG_MODE +Ignore GL_FOG_START +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT +Ignore GL_FRAGMENT_SHADER +Ignore GL_FRAGMENT_SHADER_DERIVATIVE_HINT +#Ignore GL_FUNC_ADD +#Ignore GL_FUNC_ADD_OES +#Ignore GL_FUNC_REVERSE_SUBTRACT +#Ignore GL_FUNC_REVERSE_SUBTRACT_OES +#Ignore GL_FUNC_SUBTRACT +#Ignore GL_FUNC_SUBTRACT_OES +Ignore GL_GENERATE_MIPMAP +Ignore GL_HIGH_FLOAT +Ignore GL_HIGH_INT +#Ignore GL_IMPLEMENTATION_COLOR_READ_FORMAT +#Ignore GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES +#Ignore GL_IMPLEMENTATION_COLOR_READ_TYPE +#Ignore GL_IMPLEMENTATION_COLOR_READ_TYPE_OES +#Ignore GL_INCR_WRAP +#Ignore GL_INCR_WRAP_OES +Ignore GL_INFO_LOG_LENGTH +Ignore GL_INT +Ignore GL_INTERPOLATE +Ignore GL_INT_VEC2 +Ignore GL_INT_VEC3 +Ignore GL_INT_VEC4 +Ignore GL_LIGHT0 +Ignore GL_LIGHT1 +Ignore GL_LIGHT2 +Ignore GL_LIGHT3 +Ignore GL_LIGHT4 +Ignore GL_LIGHT5 +Ignore GL_LIGHT6 +Ignore GL_LIGHT7 +Ignore GL_LIGHTING +Ignore GL_LIGHT_MODEL_AMBIENT +Ignore GL_LIGHT_MODEL_TWO_SIDE +Ignore GL_LINEAR_ATTENUATION +Ignore GL_LINE_SMOOTH +Ignore GL_LINE_SMOOTH_HINT +Ignore GL_LINK_STATUS +Ignore GL_LOGIC_OP_MODE +Ignore GL_LOW_FLOAT +Ignore GL_LOW_INT +Ignore GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES +Ignore GL_MATRIX_INDEX_ARRAY_OES +Ignore GL_MATRIX_INDEX_ARRAY_POINTER_OES +Ignore GL_MATRIX_INDEX_ARRAY_SIZE_OES +Ignore GL_MATRIX_INDEX_ARRAY_STRIDE_OES +Ignore GL_MATRIX_INDEX_ARRAY_TYPE_OES +Ignore GL_MATRIX_MODE +Ignore GL_MATRIX_PALETTE_OES +Ignore GL_MAX_ARRAY_TEXTURE_LAYERS_EXT +Ignore GL_MAX_CLIP_PLANES +Ignore GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS +Ignore GL_MAX_FRAGMENT_UNIFORM_VECTORS +Ignore GL_MAX_LIGHTS +Ignore GL_MAX_MODELVIEW_STACK_DEPTH +Ignore GL_MAX_PALETTE_MATRICES_OES +Ignore GL_MAX_PROJECTION_STACK_DEPTH +Ignore GL_MAX_TEXTURE_IMAGE_UNITS +Ignore GL_MAX_TEXTURE_STACK_DEPTH +Ignore GL_MAX_TEXTURE_UNITS +Ignore GL_MAX_VARYING_VECTORS +Ignore GL_MAX_VERTEX_ATTRIBS +Ignore GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS +Ignore GL_MAX_VERTEX_UNIFORM_VECTORS +Ignore GL_MAX_VERTEX_UNITS_OES +Ignore GL_MEDIUM_FLOAT +Ignore GL_MEDIUM_INT +#Ignore GL_MIRRORED_REPEAT +#Ignore GL_MIRRORED_REPEAT_OES +Ignore GL_MODELVIEW +Ignore GL_MODELVIEW_MATRIX +Ignore GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES +Ignore GL_MODELVIEW_STACK_DEPTH +Ignore GL_MODULATE +Ignore GL_MULTISAMPLE +Ignore GL_NAND +Ignore GL_NOOP +Ignore GL_NOR +Ignore GL_NORMAL_ARRAY +Ignore GL_NORMAL_ARRAY_BUFFER_BINDING +Ignore GL_NORMAL_ARRAY_POINTER +Ignore GL_NORMAL_ARRAY_STRIDE +Ignore GL_NORMAL_ARRAY_TYPE +Ignore GL_NORMALIZE +Ignore GL_NORMAL_MAP_OES +Ignore GL_NUM_SHADER_BINARY_FORMATS +Ignore GL_OES_blend_equation_separate +Ignore GL_OES_blend_func_separate +Ignore GL_OES_blend_subtract +Ignore GL_OES_byte_coordinates +Ignore GL_OES_compressed_ETC1_RGB8_texture +Ignore GL_OES_compressed_paletted_texture +Ignore GL_OES_depth24 +Ignore GL_OES_depth32 +Ignore GL_OES_draw_texture +Ignore GL_OES_element_index_uint +Ignore GL_OES_extended_matrix_palette +Ignore GL_OES_fbo_render_mipmap +Ignore GL_OES_fixed_point +Ignore GL_OES_framebuffer_object +Ignore GL_OES_matrix_get +Ignore GL_OES_matrix_palette +Ignore GL_OES_point_size_array +Ignore GL_OES_point_sprite +Ignore GL_OES_query_matrix +Ignore GL_OES_read_format +Ignore GL_OES_single_precision +Ignore GL_OES_stencil1 +Ignore GL_OES_stencil4 +Ignore GL_OES_stencil8 +Ignore GL_OES_stencil_wrap +Ignore GL_OES_texture_cube_map +Ignore GL_OES_texture_env_crossbar +Ignore GL_OES_texture_half_float +Ignore GL_OES_texture_mirrored_repeat +Ignore GL_OES_vertex_half_float +Ignore GL_ONE_MINUS_CONSTANT_ALPHA +Ignore GL_ONE_MINUS_CONSTANT_COLOR +Ignore GL_OPERAND0_ALPHA +Ignore GL_OPERAND0_RGB +Ignore GL_OPERAND1_ALPHA +Ignore GL_OPERAND1_RGB +Ignore GL_OPERAND2_ALPHA +Ignore GL_OPERAND2_RGB +Ignore GL_OR +Ignore GL_OR_INVERTED +Ignore GL_OR_REVERSE +Ignore GL_PALETTE4_R5_G6_B5_OES +Ignore GL_PALETTE4_RGB5_A1_OES +Ignore GL_PALETTE4_RGB8_OES +Ignore GL_PALETTE4_RGBA4_OES +Ignore GL_PALETTE4_RGBA8_OES +Ignore GL_PALETTE8_R5_G6_B5_OES +Ignore GL_PALETTE8_RGB5_A1_OES +Ignore GL_PALETTE8_RGB8_OES +Ignore GL_PALETTE8_RGBA4_OES +Ignore GL_PALETTE8_RGBA8_OES +Ignore GL_PERSPECTIVE_CORRECTION_HINT +Ignore GL_PLATFORM_BINARY +Ignore GL_POINT_DISTANCE_ATTENUATION +Ignore GL_POINT_FADE_THRESHOLD_SIZE +Ignore GL_POINT_SIZE +Ignore GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES +Ignore GL_POINT_SIZE_ARRAY_OES +Ignore GL_POINT_SIZE_ARRAY_POINTER_OES +Ignore GL_POINT_SIZE_ARRAY_STRIDE_OES +Ignore GL_POINT_SIZE_ARRAY_TYPE_OES +Ignore GL_POINT_SIZE_MAX +Ignore GL_POINT_SIZE_MIN +Ignore GL_POINT_SMOOTH +Ignore GL_POINT_SMOOTH_HINT +Ignore GL_POINT_SPRITE_OES +Ignore GL_POSITION +Ignore GL_PREVIOUS +Ignore GL_PRIMARY_COLOR +Ignore GL_PROJECTION +Ignore GL_PROJECTION_MATRIX +Ignore GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES +Ignore GL_PROJECTION_STACK_DEPTH +Ignore GL_QUADRATIC_ATTENUATION +Ignore GL_R11F_G11F_B10F_EXT +Ignore GL_REFLECTION_MAP_OES +Ignore GL_RESCALE_NORMAL +Ignore GL_RGBA_SIGNED_COMPONENTS_EXT +Ignore GL_RGB_SCALE +Ignore GL_SAMPLE_ALPHA_TO_ONE +Ignore GL_SAMPLER_2D +Ignore GL_SAMPLER_2D_ARRAY_EXT +Ignore GL_SAMPLER_CUBE +Ignore GL_SET +Ignore GL_SHADE_MODEL +Ignore GL_SHADER_BINARY_FORMATS +Ignore GL_SHADER_COMPILER +Ignore GL_SHADER_SOURCE_LENGTH +Ignore GL_SHADER_TYPE +Ignore GL_SHADING_LANGUAGE_VERSION +Ignore GL_SHININESS +Ignore GL_SMOOTH +Ignore GL_SMOOTH_LINE_WIDTH_RANGE +Ignore GL_SMOOTH_POINT_SIZE_RANGE +Ignore GL_SPECULAR +Ignore GL_SPOT_CUTOFF +Ignore GL_SPOT_DIRECTION +Ignore GL_SPOT_EXPONENT +Ignore GL_SRC0_ALPHA +Ignore GL_SRC0_RGB +Ignore GL_SRC1_ALPHA +Ignore GL_SRC1_RGB +Ignore GL_SRC2_ALPHA +Ignore GL_SRC2_RGB +Ignore GL_STACK_OVERFLOW +Ignore GL_STACK_UNDERFLOW +Ignore GL_STENCIL_BACK_FAIL +Ignore GL_STENCIL_BACK_FUNC +Ignore GL_STENCIL_BACK_PASS_DEPTH_FAIL +Ignore GL_STENCIL_BACK_PASS_DEPTH_PASS +Ignore GL_STENCIL_BACK_REF +Ignore GL_STENCIL_BACK_VALUE_MASK +Ignore GL_STENCIL_BACK_WRITEMASK +Ignore GL_STENCIL_INDEX +Ignore GL_STENCIL_INDEX1_OES +Ignore GL_STENCIL_INDEX4_OES +Ignore GL_STREAM_DRAW +Ignore GL_SUBTRACT +Ignore GL_TEXTURE_2D_ARRAY_EXT +Ignore GL_TEXTURE_2D_OES +Ignore GL_TEXTURE_BINDING_2D_ARRAY_EXT +Ignore GL_TEXTURE_COORD_ARRAY +Ignore GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING +Ignore GL_TEXTURE_COORD_ARRAY_POINTER +Ignore GL_TEXTURE_COORD_ARRAY_SIZE +Ignore GL_TEXTURE_COORD_ARRAY_STRIDE +Ignore GL_TEXTURE_COORD_ARRAY_TYPE +Ignore GL_TEXTURE_CROP_RECT_OES +Ignore GL_TEXTURE_ENV +Ignore GL_TEXTURE_ENV_COLOR +Ignore GL_TEXTURE_ENV_MODE +Ignore GL_TEXTURE_GEN_MODE_OES +Ignore GL_TEXTURE_GEN_STR_OES +Ignore GL_TEXTURE_MATRIX +Ignore GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES +Ignore GL_TEXTURE_RECTANGLE_NV_OES +Ignore GL_TEXTURE_STACK_DEPTH +Ignore GL_UNSIGNED_INT_10F_11F_11F_REV_EXT +Ignore GL_VALIDATE_STATUS +Ignore GL_VERTEX_ARRAY +Ignore GL_VERTEX_ARRAY_BUFFER_BINDING +Ignore GL_VERTEX_ARRAY_POINTER +Ignore GL_VERTEX_ARRAY_SIZE +Ignore GL_VERTEX_ARRAY_STRIDE +Ignore GL_VERTEX_ARRAY_TYPE +Ignore GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING +Ignore GL_VERTEX_ATTRIB_ARRAY_ENABLED +Ignore GL_VERTEX_ATTRIB_ARRAY_NORMALIZED +Ignore GL_VERTEX_ATTRIB_ARRAY_POINTER +Ignore GL_VERTEX_ATTRIB_ARRAY_SIZE +Ignore GL_VERTEX_ATTRIB_ARRAY_STRIDE +Ignore GL_VERTEX_ATTRIB_ARRAY_TYPE +Ignore GL_VERTEX_SHADER +Ignore GL_WEIGHT_ARRAY_BUFFER_BINDING_OES +Ignore GL_WEIGHT_ARRAY_OES +Ignore GL_WEIGHT_ARRAY_POINTER_OES +Ignore GL_WEIGHT_ARRAY_SIZE_OES +Ignore GL_WEIGHT_ARRAY_STRIDE_OES +Ignore GL_WEIGHT_ARRAY_TYPE_OES +Ignore GL_WRITE_ONLY_OES +Ignore GL_XOR +Ignore glIsProgram +Ignore glIsShader +#Ignore glUnmapBufferOES +Ignore glCreateProgram +Ignore glCreateShader +Ignore glGetAttribLocation +Ignore glGetUniformLocation +Ignore glAlphaFunc +Ignore glAttachShader +Ignore glBindAttribLocation +Ignore glBlendColor +#Ignore glBlendEquation +#Ignore glBlendEquationOES +#Ignore glBlendEquationSeparate +#Ignore glBlendEquationSeparateOES +#Ignore glBlendFuncSeparate +#Ignore glBlendFuncSeparateOES +Ignore glClearDepthfOES +Ignore glClientActiveTexture +Ignore glClipPlanef +Ignore glClipPlanefOES +Ignore glColor4f +Ignore glColor4ub +Ignore glColorPointer +Ignore glCompileShader +Ignore glCoverageMaskNV +Ignore glCoverageOperationNV +Ignore glDeleteProgram +Ignore glDeleteShader +Ignore glDepthRangefOES +Ignore glDetachShader +Ignore glDisableClientState +Ignore glDisableVertexAttribArray +Ignore glDrawTexfOES +Ignore glDrawTexfvOES +Ignore glDrawTexiOES +Ignore glDrawTexivOES +Ignore glDrawTexsOES +Ignore glDrawTexsvOES +Ignore glDrawTexxvOES +Ignore glEnableClientState +Ignore glEnableVertexAttribArray +Ignore glFogf +Ignore glFogfv +Ignore glFogxv +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 +Ignore glGetLightxv +Ignore glGetLightxvOES +Ignore glGetMaterialfv +Ignore glGetMaterialxv +Ignore glGetMaterialxvOES +Ignore glGetProgramInfoLog +Ignore glGetProgramiv +Ignore glGetShaderInfoLog +Ignore glGetShaderiv +Ignore glGetShaderPrecisionFormat +Ignore glGetShaderSource +Ignore glGetTexEnvfv +Ignore glGetTexEnviv +Ignore glGetTexEnvxv +Ignore glGetTexEnvxvOES +Ignore glGetTexGenfvOES +Ignore glGetTexGenivOES +Ignore glGetTexGenxvOES +Ignore glGetTexParameterxv +Ignore glGetTexParameterxvOES +Ignore glGetUniformfv +Ignore glGetUniformiv +Ignore glGetVertexAttribfv +Ignore glGetVertexAttribiv +Ignore glLightf +Ignore glLightfv +Ignore glLightModelf +Ignore glLightModelfv +Ignore glLightModelxv +Ignore glLightModelxvOES +Ignore glLightxv +Ignore glLightxvOES +Ignore glLinkProgram +Ignore glLoadIdentity +Ignore glLoadMatrixf +Ignore glLogicOp +Ignore glMaterialf +Ignore glMaterialfv +Ignore glMaterialxv +Ignore glMaterialxvOES +Ignore glMatrixIndexPointerOES +Ignore glMatrixMode +Ignore glMultiTexCoord4f +Ignore glMultMatrixf +Ignore glNormal3f +Ignore glNormalPointer +Ignore glOrthof +Ignore glOrthofOES +Ignore glPointParameterf +Ignore glPointParameterfv +Ignore glPointParameterxv +Ignore glPointParameterxvOES +Ignore glPointSize +Ignore glPointSizePointer +Ignore glReleaseShaderCompiler +Ignore glRotatef +Ignore glScalef +Ignore glShadeModel +Ignore glShaderBinary +Ignore glShaderSource +Ignore glStencilFuncSeparate +Ignore glStencilMaskSeparate +Ignore glStencilOpSeparate +Ignore glTexCoordPointer +Ignore glTexEnvf +Ignore glTexEnvfv +Ignore glTexEnvi +Ignore glTexEnviv +Ignore glTexEnvxv +Ignore glTexEnvxvOES +Ignore glTexGenfOES +Ignore glTexGenfvOES +Ignore glTexGeniOES +Ignore glTexGenivOES +Ignore glTexGenxvOES +Ignore glTexParameterxv +Ignore glTexParameterxvOES +Ignore glTranslatef +Ignore glUniform1f +Ignore glUniform1fv +Ignore glUniform1i +Ignore glUniform1iv +Ignore glUniform2f +Ignore glUniform2fv +Ignore glUniform2i +Ignore glUniform2iv +Ignore glUniform3f +Ignore glUniform3fv +Ignore glUniform3i +Ignore glUniform3iv +Ignore glUniform4f +Ignore glUniform4fv +Ignore glUniform4i +Ignore glUniform4iv +Ignore glUniformMatrix2fv +Ignore glUniformMatrix3fv +Ignore glUniformMatrix4fv +Ignore glUseProgram +Ignore glValidateProgram +Ignore glVertexAttrib1f +Ignore glVertexAttrib1fv +Ignore glVertexAttrib2f +Ignore glVertexAttrib2fv +Ignore glVertexAttrib3f +Ignore glVertexAttrib3fv +Ignore glVertexAttrib4f +Ignore glVertexAttrib4fv +Ignore glVertexAttribPointer +Ignore glVertexPointer +Ignore glWeightPointerOES diff --git a/make/config/jogl/gl-if-gl.cfg b/make/config/jogl/gl-if-gl.cfg new file mode 100644 index 000000000..2f7932b67 --- /dev/null +++ b/make/config/jogl/gl-if-gl.cfg @@ -0,0 +1,38 @@ +# This .cfg file is used to generate the GL interface and implementing class. +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL +Extends GL GLBase + +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-if-gl-ignores.cfg +Include gl-if-gl3-ignores.cfg +Include gl-if-gl4-ignores.cfg + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +# Ignore all ES 2.X only stuff .. +Ignore ^gl.*x +Ignore ^gl.*xOES +Ignore glEGL.* + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + +# 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 + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +IncludeAs CustomJavaCode GL gl-if-CustomJavaCode-gl.java diff --git a/make/config/jogl/gl-if-gl2.cfg b/make/config/jogl/gl-if-gl2.cfg new file mode 100644 index 000000000..6063bba7e --- /dev/null +++ b/make/config/jogl/gl-if-gl2.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/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/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2 +Extends GL2 GLBase +Extends GL2 GL +Extends GL2 GL2ES1 +Extends GL2 GL2ES2 +Extends GL2 GL2GL3 +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg +Include gl-if-gl3-ignores.cfg +Include gl-if-gl4-ignores.cfg + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +# 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 +Include ../intptr.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + diff --git a/make/config/jogl/gl-if-gl2_es1.cfg b/make/config/jogl/gl-if-gl2_es1.cfg new file mode 100644 index 000000000..2aaee0620 --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es1.cfg @@ -0,0 +1,117 @@ +# This .cfg file is used to generate the GL interface and implementing class. +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2ES1 +Extends GL2ES1 GLBase +Extends GL2ES1 GL +Extends GL2ES1 GLMatrixFunc +Extends GL2ES1 GLPointerFunc +Extends GL2ES1 GLLightingFunc + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +# Ignore all ES 1.X only stuff not in GL2 +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_vertex_array_object + +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 + +# 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 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 +Ignore glClearDepthx +Ignore glClipPlanex +Ignore glColor4x +Ignore glDepthRangex +Ignore glFogx +Ignore glFrustumx +Ignore glGetClipPlanex +Ignore glLightModelx +Ignore glLightx +Ignore glLineWidthx +Ignore glLoadMatrixx +Ignore glMaterialx +Ignore glMultMatrixx +Ignore glMultiTexCoord4x +Ignore glNormal3x +Ignore glOrthox +Ignore glPointParameterx +Ignore glPointSizex +Ignore glPolygonOffsetx +Ignore glQueryMatrixx +Ignore glRotatex +Ignore glSampleCoveragex +Ignore glScalex +Ignore glTexEnvx +Ignore glTexGenx +Ignore glTexParameterx +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); + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + +# 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.cfg b/make/config/jogl/gl-if-gl2_es2.cfg new file mode 100644 index 000000000..a466ea5dd --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es2.cfg @@ -0,0 +1,83 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2ES2 +Extends GL2ES2 GLBase +Extends GL2ES2 GL + +HierarchicalNativeOutput false +Include gl-common.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 + +# 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 + +# Ignore GL_ARB_ES2_compatibility functions for interface code generation +# since we need our own javadoc header for a detailed description +Ignore glReleaseShaderCompiler +Ignore glShaderBinary +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 + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + +# 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 + +# 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_gl3.cfg b/make/config/jogl/gl-if-gl2_gl3.cfg new file mode 100644 index 000000000..99e241f23 --- /dev/null +++ b/make/config/jogl/gl-if-gl2_gl3.cfg @@ -0,0 +1,54 @@ +# This .cfg file is used to generate the GL interface and implementing class. +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2GL3 +Extends GL2GL3 GLBase +Extends GL2GL3 GL +Extends GL2GL3 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/GL3Subset.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg +Include gl-if-gl4-ignores.cfg + +IncludeAs CustomJavaCode GL2GL3 gl-if-CustomJavaCode-gl2_gl3.java + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +# +# Same name but different signature .. +# No collisions found .. good! + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + +# 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 + +# 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 +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 + +# Ignore extensions that are already picked up via the GL2ES1 interface +IgnoreExtension GL_EXT_point_parameters + +Import java.io.PrintStream diff --git a/make/config/jogl/gl-if-gl3-ignores.cfg b/make/config/jogl/gl-if-gl3-ignores.cfg new file mode 100644 index 000000000..672c62278 --- /dev/null +++ b/make/config/jogl/gl-if-gl3-ignores.cfg @@ -0,0 +1,21 @@ +# +# Generated Configuration File +# Use make-glextension-depignore.sh to update! +# + +# +# OpenGL 3.x dependencies +# +# We allow GL_VERSION_3_0 within GL2 +IgnoreExtension GL_VERSION_3_1 +IgnoreExtension GL_VERSION_3_2 +IgnoreExtension GL_VERSION_3_3 +IgnoreExtension GL_VERSION_3_4 +IgnoreExtension GL_ARB_sync +IgnoreExtension GL_ARB_texture_compression_bptc +IgnoreExtension GL_ARB_draw_indirect +IgnoreExtension GL_ARB_gpu_shader5 +IgnoreExtension GL_ARB_gpu_shader_fp64 +IgnoreExtension GL_ARB_tessellation_shader +IgnoreExtension GL_NV_gpu_shader5 + diff --git a/make/config/jogl/gl-if-gl3-subset.cfg b/make/config/jogl/gl-if-gl3-subset.cfg new file mode 100644 index 000000000..85797894d --- /dev/null +++ b/make/config/jogl/gl-if-gl3-subset.cfg @@ -0,0 +1,15 @@ +# This .cfg file is used to generate the common GL2 GL3 set +JavaOutputDir ../../build-temp/gluegen-set + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL3Subset +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl3-desktop.cfg +Include gl-if-gl3-ignores.cfg +Include gl-if-gl4-ignores.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff diff --git a/make/config/jogl/gl-if-gl3.cfg b/make/config/jogl/gl-if-gl3.cfg new file mode 100644 index 000000000..6682e4145 --- /dev/null +++ b/make/config/jogl/gl-if-gl3.cfg @@ -0,0 +1,39 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +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/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL3 +Extends GL3 GLBase +Extends GL3 GL +Extends GL3 GL2ES2 +Extends GL3 GL2GL3 +ImplPackage com.jogamp.opengl.impl.gl3 +ImplJavaClass GL3Impl +Implements GL3Impl GLBase +Implements GL3Impl GL +Implements GL3Impl GL2ES2 +Implements GL3Impl GL2GL3 +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl3-desktop.cfg +Include gl-if-gl4-ignores.cfg + +EmitProcAddressTable false + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +Include gl3-headers.cfg +Include ../intptr.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + diff --git a/make/config/jogl/gl-if-gl3bc.cfg b/make/config/jogl/gl-if-gl3bc.cfg new file mode 100644 index 000000000..f23d3710d --- /dev/null +++ b/make/config/jogl/gl-if-gl3bc.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/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/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL2.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL3bc +Extends GL3bc GLBase +Extends GL3bc GL +Extends GL3bc GL2ES1 +Extends GL3bc GL2ES2 +Extends GL3bc GL2GL3 +Extends GL3bc GL2 +Extends GL3bc GL3 + +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg +Include gl3-desktop.cfg +Include gl-if-gl4-ignores.cfg + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +# Ignore extensions that are already picked up via the GL2ES1 interface +IgnoreExtension GL_EXT_point_parameters + +Include gl-headers.cfg +Include gl3ext-headers.cfg +Include ../intptr.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + diff --git a/make/config/jogl/gl-if-gl4-ignores.cfg b/make/config/jogl/gl-if-gl4-ignores.cfg new file mode 100644 index 000000000..4948b64df --- /dev/null +++ b/make/config/jogl/gl-if-gl4-ignores.cfg @@ -0,0 +1,13 @@ +# +# Generated Configuration File +# Use make-glextension-depignore.sh to update! +# + +# +# OpenGL 4.x dependencies +# +IgnoreExtension GL_VERSION_4_0 +IgnoreExtension GL_VERSION_4_1 +IgnoreExtension GL_VERSION_4_2 +IgnoreExtension GL_ARB_shader_precision + diff --git a/make/config/jogl/gl-if-gl4.cfg b/make/config/jogl/gl-if-gl4.cfg new file mode 100644 index 000000000..b660bfaac --- /dev/null +++ b/make/config/jogl/gl-if-gl4.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/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/GL2GL3.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/javax/media/opengl/GL3.java +ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.java + +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL4 +Extends GL4 GLBase +Extends GL4 GL +Extends GL4 GL2ES2 +Extends GL4 GL2GL3 +Extends GL4 GL3 +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl3-desktop.cfg + +EmitProcAddressTable false +ProcAddressTableClassName DontGenerateProcAddressTableStuff +GetProcAddressTableExpr DontGenerateProcAddressTableStuff + + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +Include gl3-headers.cfg +Include ../intptr.cfg + diff --git a/make/config/jogl/gl-impl-CustomCCode-gl4bc.c b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c new file mode 100644 index 000000000..778559eba --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gl4bc.c @@ -0,0 +1,39 @@ +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.gl4.GL4bcImpl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_jogamp_opengl_impl_gl4_GL4bcImpl_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: com.jogamp.opengl.impl.gl4.GL4bcImpl + * Java method: long dispatch_glMapNamedBufferEXT(int target, int access) + * C function: void * glMapNamedBufferEXT(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_jogamp_opengl_impl_gl4_GL4bcImpl_dispatch_1glMapNamedBufferEXT(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { + PFNGLMAPNAMEDBUFFEREXTPROC ptr_glMapNamedBufferEXT; + void * _res; + ptr_glMapNamedBufferEXT = (PFNGLMAPNAMEDBUFFEREXTPROC) (intptr_t) glProcAddress; + assert(ptr_glMapNamedBufferEXT != NULL); + _res = (* ptr_glMapNamedBufferEXT) ((GLenum) target, (GLenum) access); + return (jlong) (intptr_t) _res; +} + +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.gl4.GL4bcImpl + * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); + * C function: jobject newDirectByteBuffer(jlong addr, jlong capacity); + */ +JNIEXPORT jobject JNICALL +Java_com_jogamp_opengl_impl_gl4_GL4bcImpl_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-gles1.c b/make/config/jogl/gl-impl-CustomCCode-gles1.c new file mode 100644 index 000000000..422935ba7 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gles1.c @@ -0,0 +1,25 @@ +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.es1.GLES1Impl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_jogamp_opengl_impl_es1_GLES1Impl_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: com.jogamp.opengl.impl.es1.GLES1Impl + * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); + * C function: jobject newDirectByteBuffer(jlong addr, jlong capacity); + */ +JNIEXPORT jobject JNICALL +Java_com_jogamp_opengl_impl_es1_GLES1Impl_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-gles2.c b/make/config/jogl/gl-impl-CustomCCode-gles2.c new file mode 100644 index 000000000..86fc47b4b --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gles2.c @@ -0,0 +1,25 @@ +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.es2.GLES2Impl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_jogamp_opengl_impl_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: com.jogamp.opengl.impl.es2.GLES2Impl + * Java method: ByteBuffer newDirectByteBuffer(long addr, long capacity); + * C function: jobject newDirectByteBuffer(jlong addr, jlong capacity); + */ +JNIEXPORT jobject JNICALL +Java_com_jogamp_opengl_impl_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-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java new file mode 100644 index 000000000..4872490b0 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -0,0 +1,58 @@ + public GLProfile getGLProfile() { + return this.glProfile; + } + private GLProfile glProfile; + + public int glGetBoundBuffer(int target) { + return bufferStateTracker.getBoundBufferObject(target, this); + } + + public boolean glIsVBOArrayEnabled() { + return checkArrayVBOEnabled(false); + } + + public boolean glIsVBOElementEnabled() { + return checkElementVBOEnabled(false); + } + + public final boolean isGL() { + return true; + } + + public final GL getGL() throws GLException { + return this; + } + + public boolean isFunctionAvailable(String glFunctionName) { + return _context.isFunctionAvailable(glFunctionName); + } + + public boolean isExtensionAvailable(String glExtensionName) { + return _context.isExtensionAvailable(glExtensionName); + } + + public Object getExtension(String extensionName) { + // At this point we don't expose any extensions using this mechanism + return null; + } + + /** Returns the context this GL object is associated with for better + error checking by DebugGL. */ + public GLContext getContext() { + return _context; + } + + private GLContextImpl _context; + + public void setSwapInterval(int interval) { + _context.setSwapInterval(interval); + } + + public int getSwapInterval() { + return _context.getSwapInterval(); + } + + public Object getPlatformGLExtensions() { + return _context.getPlatformGLExtensions(); + } + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java new file mode 100644 index 000000000..93a275269 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java @@ -0,0 +1,191 @@ + private int[] imageSizeTemp = new int[1]; + + /** Helper for more precise computation of number of bytes that will + be touched by a pixel pack or unpack operation. */ + private int imageSizeInBytes(int bytesPerElement, + int width, int height, int depth, boolean pack) { + int rowLength = 0; + int skipRows = 0; + int skipPixels = 0; + int alignment = 1; + int imageHeight = 0; + int skipImages = 0; + + if (pack) { + glGetIntegerv(GL_PACK_ROW_LENGTH, imageSizeTemp, 0); + rowLength = imageSizeTemp[0]; + glGetIntegerv(GL_PACK_SKIP_ROWS, imageSizeTemp, 0); + skipRows = imageSizeTemp[0]; + glGetIntegerv(GL_PACK_SKIP_PIXELS, imageSizeTemp, 0); + skipPixels = imageSizeTemp[0]; + glGetIntegerv(GL_PACK_ALIGNMENT, imageSizeTemp, 0); + alignment = imageSizeTemp[0]; + if (depth > 1) { + glGetIntegerv(GL_PACK_IMAGE_HEIGHT, imageSizeTemp, 0); + imageHeight = imageSizeTemp[0]; + glGetIntegerv(GL_PACK_SKIP_IMAGES, imageSizeTemp, 0); + skipImages = imageSizeTemp[0]; + } + } else { + glGetIntegerv(GL_UNPACK_ROW_LENGTH, imageSizeTemp, 0); + rowLength = imageSizeTemp[0]; + glGetIntegerv(GL_UNPACK_SKIP_ROWS, imageSizeTemp, 0); + skipRows = imageSizeTemp[0]; + glGetIntegerv(GL_UNPACK_SKIP_PIXELS, imageSizeTemp, 0); + skipPixels = imageSizeTemp[0]; + glGetIntegerv(GL_UNPACK_ALIGNMENT, imageSizeTemp, 0); + alignment = imageSizeTemp[0]; + if (depth > 1) { + glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, imageSizeTemp, 0); + imageHeight = imageSizeTemp[0]; + glGetIntegerv(GL_UNPACK_SKIP_IMAGES, imageSizeTemp, 0); + skipImages = imageSizeTemp[0]; + } + } + // Try to deal somewhat correctly with potentially invalid values + width = Math.max(0, width ); + height = Math.max(1, height); // min 1D + depth = Math.max(1, depth ); // min 1 * imageSize + skipRows = Math.max(0, skipRows); + skipPixels = Math.max(0, skipPixels); + alignment = Math.max(1, alignment); + skipImages = Math.max(0, skipImages); + + imageHeight = ( imageHeight > 0 ) ? imageHeight : height; + rowLength = ( rowLength > 0 ) ? rowLength : width; + + int rowLengthInBytes = rowLength * bytesPerElement; + + if (alignment > 1) { + int padding = rowLengthInBytes % alignment; + if (padding > 0) { + rowLengthInBytes += alignment - padding; + } + } + + /** + * skipPixels and skipRows is a static one time offset. + * + * skipImages and depth are in multiples of image size. + * + * rowlenght is the actual repeating offset + * to go from line n to line n+1 at the same x-axis position. + */ + return + ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // whole images + ( skipRows + height - 1 ) * rowLengthInBytes + // lines with padding + ( skipPixels + width ) * bytesPerElement; // last line + } + + public final boolean isGL4bc() { + return _context.isGL4bc(); + } + + public final boolean isGL4() { + return _context.isGL4(); + } + + public final boolean isGL3bc() { + return _context.isGL3bc(); + } + + public final boolean isGL3() { + return _context.isGL3(); + } + + public final boolean isGL2() { + return _context.isGL2(); + } + + public final boolean isGL2ES1() { + return _context.isGL2ES1(); + } + + public final boolean isGL2ES2() { + return _context.isGL2ES2(); + } + + public final boolean isGL2GL3() { + return _context.isGL2GL3(); + } + + public final boolean hasGLSL() { + return _context.hasGLSL(); + } + + public final GL4bc getGL4bc() throws GLException { + if(!isGL4bc()) { + throw new GLException("Not a GL4bc implementation"); + } + return this; + } + + public final GL4 getGL4() throws GLException { + if(!isGL4bc()) { + throw new GLException("Not a GL4 implementation"); + } + return this; + } + + public final GL3bc getGL3bc() throws GLException { + if(!isGL3bc()) { + throw new GLException("Not a GL3bc implementation"); + } + return this; + } + + public final GL3 getGL3() throws GLException { + if(!isGL3()) { + throw new GLException("Not a GL3 implementation"); + } + return this; + } + + public final GL2 getGL2() throws GLException { + if(!isGL2()) { + throw new GLException("Not a GL2 implementation"); + } + return this; + } + + public final GL2ES1 getGL2ES1() throws GLException { + if(!isGL2ES1()) { + throw new GLException("Not a GL2ES1 implementation"); + } + return this; + } + + public final GL2ES2 getGL2ES2() throws GLException { + if(!isGL2ES2()) { + throw new GLException("Not a GL2ES2 implementation"); + } + return this; + } + + public final GL2GL3 getGL2GL3() throws GLException { + if(!isGL2GL3()) { + throw new GLException("Not a GL2GL3 implementation"); + } + return this; + } + + public final boolean isGLES1() { + return false; + } + + public final boolean isGLES2() { + return false; + } + + public final boolean isGLES() { + return false; + } + + public final GLES1 getGLES1() throws GLException { + throw new GLException("Not a GLES1 implementation"); + } + + public final GLES2 getGLES2() throws GLException { + throw new GLException("Not a GLES2 implementation"); + } + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-embedded.java b/make/config/jogl/gl-impl-CustomJavaCode-embedded.java new file mode 100644 index 000000000..0408c21a1 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-embedded.java @@ -0,0 +1,42 @@ +private int[] imageSizeTemp = new int[1]; + +/** Helper for more precise computation of number of bytes that will + be touched by a pixel pack or unpack operation. */ +private int imageSizeInBytes(int bytesPerElement, + int rowLength, int imageHeight, int depth, boolean pack) { + int alignment = 1; + + if (pack) { + glGetIntegerv(GL_PACK_ALIGNMENT, imageSizeTemp, 0); + alignment = imageSizeTemp[0]; + } else { + glGetIntegerv(GL_UNPACK_ALIGNMENT, imageSizeTemp, 0); + alignment = imageSizeTemp[0]; + } + // Try to deal somewhat correctly with potentially invalid values + rowLength = Math.max(0, rowLength ); + imageHeight = Math.max(1, imageHeight); // min 1D + depth = Math.max(1, depth ); // min 1 * imageSize + alignment = Math.max(1, alignment); + + int rowLengthInBytes = rowLength * bytesPerElement; + + if (alignment > 1) { + int padding = rowLengthInBytes % alignment; + if (padding > 0) { + rowLengthInBytes += alignment - padding; + } + } + + /** + * depth is in multiples of image size. + * + * rowlenght is the actual repeating offset + * to go from line n to line n+1 at the same x-axis position. + */ + return + ( depth - 1 ) * imageHeight * rowLengthInBytes + // whole images + ( imageHeight - 1 ) * rowLengthInBytes + // lines with padding + ( rowLength ) * bytesPerElement; // last line +} + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java new file mode 100644 index 000000000..d99f46ec1 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java @@ -0,0 +1,61 @@ + public void glVertexAttribPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glVertexAttribPointer(array.getLocation(), array.getComponentNumber(), array.getComponentType(), + array.getNormalized(), array.getStride(), array.getOffset()); + } else { + glVertexAttribPointer(array.getLocation(), array.getComponentNumber(), array.getComponentType(), + array.getNormalized(), array.getStride(), array.getBuffer()); + } + } + + public void glUniform(GLUniformData data) { + boolean done=false; + if(data.isBuffer()) { + Buffer buffer = data.getBuffer(); + if(data.isMatrix()) { + if(buffer instanceof FloatBuffer) { + switch(data.columns()) { + case 2: glUniformMatrix2fv(data.getLocation(), data.count(), false, (FloatBuffer)buffer); done=true; break; + case 3: glUniformMatrix3fv(data.getLocation(), data.count(), false, (FloatBuffer)buffer); done=true; break; + case 4: glUniformMatrix4fv(data.getLocation(), data.count(), false, (FloatBuffer)buffer); done=true; break; + } + } + if(!done) { + throw new GLException("glUniformMatrix only available for 2fv, 3fv and 4fv"); + } + } else { + if(buffer instanceof IntBuffer) { + switch(data.components()) { + case 1: glUniform1iv(data.getLocation(), data.count(), (IntBuffer)buffer); done=true; break; + case 2: glUniform2iv(data.getLocation(), data.count(), (IntBuffer)buffer); done=true; break; + case 3: glUniform3iv(data.getLocation(), data.count(), (IntBuffer)buffer); done=true; break; + case 4: glUniform4iv(data.getLocation(), data.count(), (IntBuffer)buffer); done=true; break; + } + } else if(buffer instanceof FloatBuffer) { + switch(data.components()) { + case 1: glUniform1fv(data.getLocation(), data.count(), (FloatBuffer)buffer); done=true; break; + case 2: glUniform2fv(data.getLocation(), data.count(), (FloatBuffer)buffer); done=true; break; + case 3: glUniform3fv(data.getLocation(), data.count(), (FloatBuffer)buffer); done=true; break; + case 4: glUniform4fv(data.getLocation(), data.count(), (FloatBuffer)buffer); done=true; break; + } + } + if(!done) { + throw new GLException("glUniform vector only available for 1[if]v 2[if]v, 3[if]v and 4[if]v"); + } + } + } else { + Object obj = data.getObject(); + if(obj instanceof Integer) { + glUniform1i(data.getLocation(), ((Integer)obj).intValue()); + done=true; + } else if (obj instanceof Float) { + glUniform1f(data.getLocation(), ((Float)obj).floatValue()); + done=true; + } + if(!done) { + throw new GLException("glUniform atom only available for 1i and 1f"); + } + } + } + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java new file mode 100644 index 000000000..6776feeb7 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -0,0 +1,394 @@ +// Tracks glBegin/glEnd calls to determine whether it is legal to +// query Vertex Buffer Object state +private boolean inBeginEndPair; + +/* FIXME: refactor dependence on Java 2D / JOGL bridge + +// Tracks creation and destruction of server-side OpenGL objects when +// the Java2D/OpenGL pipeline is enabled and it is using frame buffer +// objects (FBOs) to do its rendering +private GLObjectTracker tracker; + +public void setObjectTracker(GLObjectTracker tracker) { + this.tracker = tracker; +} + +*/ + +public GL4bcImpl(GLProfile glp, GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + this.glProfile = glp; +} + +/** + * Provides platform-independent access to the wglAllocateMemoryNV / + * glXAllocateMemoryNV extension. + */ +public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { + return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is computed as closely as possible based on the + pixel pack or unpack parameters. The logic in this routine is + based on code in the SGI OpenGL sample implementation. */ + +private int imageSizeInBytes(int format, int type, int w, int h, int d, + boolean pack) { + int elements = 0; + int esize = 0; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + case GL_DEPTH_COMPONENT: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + case GL_BGR: + elements = 3; + break; + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + elements = 4; + break; + /* FIXME ?? + case GL_HILO_NV: + elements = 2; + break; */ + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (d * (h * ((w+7)/8))); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return imageSizeInBytes(elements * esize, w, h, d, pack); +} + +private GLBufferSizeTracker bufferSizeTracker; +private GLBufferStateTracker bufferStateTracker; +private GLStateTracker glStateTracker; + +private boolean bufferObjectExtensionsInitialized = false; +private boolean haveARBPixelBufferObject; +private boolean haveEXTPixelBufferObject; +private boolean haveGL15; +private boolean haveGL21; +private boolean haveARBVertexBufferObject; + +private 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 boolean checkBufferObject(boolean extension1, + boolean extension2, + boolean extension3, + boolean enabled, + int state, + String kind, boolean throwException) { + if (inBeginEndPair) { + throw new GLException("May not call this between glBegin and glEnd"); + } + boolean avail = (extension1 || extension2 || extension3); + 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 boolean checkArrayVBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveGL15, + haveARBVertexBufferObject, + false, + false, + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private boolean checkArrayVBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveGL15, + haveARBVertexBufferObject, + false, + true, + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private boolean checkElementVBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveGL15, + haveARBVertexBufferObject, + false, + false, + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private boolean checkElementVBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveGL15, + haveARBVertexBufferObject, + false, + true, + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private boolean checkUnpackPBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveARBPixelBufferObject, + haveEXTPixelBufferObject, + haveGL21, + false, + GL2.GL_PIXEL_UNPACK_BUFFER, + "unpack pixel_buffer_object", throwException); +} + +private boolean checkUnpackPBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveARBPixelBufferObject, + haveEXTPixelBufferObject, + haveGL21, + true, + GL2.GL_PIXEL_UNPACK_BUFFER, + "unpack pixel_buffer_object", throwException); +} + +private boolean checkPackPBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveARBPixelBufferObject, + haveEXTPixelBufferObject, + haveGL21, + false, + GL2.GL_PIXEL_PACK_BUFFER, + "pack pixel_buffer_object", throwException); +} + +private boolean checkPackPBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(haveARBPixelBufferObject, + haveEXTPixelBufferObject, + haveGL21, + true, + GL2.GL_PIXEL_PACK_BUFFER, + "pack pixel_buffer_object", throwException); +} + +public boolean glIsPBOPackEnabled() { + return checkPackPBOEnabled(false); +} + +public boolean glIsPBOUnpackEnabled() { + return checkUnpackPBOEnabled(false); +} + +private HashMap/*<MemoryObject>*/ arbMemCache = new HashMap(); + +/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ +public 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"); + } + 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); + +/** 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 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(); + } + 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; +} + +private native long dispatch_glMapNamedBufferEXT(int buffer, int access, long procAddress); + +native private ByteBuffer newDirectByteBuffer(long addr, long capacity); + + public void glVertexPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glVertexPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glVertexPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); + } + } + public void glColorPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glColorPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glColorPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); + } + + } + public void glNormalPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.getComponentNumber()!=3) { + throw new GLException("Only 3 components per normal allowed"); + } + if(array.isVBO()) { + glNormalPointer(array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glNormalPointer(array.getComponentType(), array.getStride(), array.getBuffer()); + } + } + public void glTexCoordPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glTexCoordPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glTexCoordPointer(array.getComponentNumber(), 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 new file mode 100644 index 000000000..faff8b89f --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -0,0 +1,331 @@ +public GLES1Impl(GLProfile glp, GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + this.glProfile = glp; +} + +public final boolean isGL4bc() { + return false; +} + +public final boolean isGL4() { + return false; +} + +public final boolean isGL3bc() { + return false; +} + +public final boolean isGL3() { + return false; +} + +public final boolean isGL2() { + return false; +} + +public final boolean isGLES1() { + return true; +} + +public final boolean isGLES2() { + return false; +} + +public final boolean isGLES() { + return true; +} + +public final boolean isGL2ES1() { + return true; +} + +public final boolean isGL2ES2() { + return false; +} + +public final boolean isGL2GL3() { + return false; +} + +public final boolean hasGLSL() { + return false; +} + +public final GL4bc getGL4bc() throws GLException { + throw new GLException("Not a GL4bc implementation"); +} + +public final GL4 getGL4() throws GLException { + throw new GLException("Not a GL4 implementation"); +} + +public final GL3bc getGL3bc() throws GLException { + throw new GLException("Not a GL3bc implementation"); +} + +public final GL3 getGL3() throws GLException { + throw new GLException("Not a GL3 implementation"); +} + +public final GL2 getGL2() throws GLException { + throw new GLException("Not a GL2 implementation"); +} + +public final GLES1 getGLES1() throws GLException { + return this; +} + +public final GLES2 getGLES2() throws GLException { + throw new GLException("Not a GLES2 implementation"); +} + +public final GL2ES1 getGL2ES1() throws GLException { + return this; +} + +public final GL2ES2 getGL2ES2() throws GLException { + throw new GLException("Not a GL2ES2 implementation"); +} + +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is computed as closely as possible based on the + pixel pack or unpack parameters. The logic in this routine is + based on code in the SGI OpenGL sample implementation. */ + +private int imageSizeInBytes(int format, int type, int w, int h, int d, + boolean pack) { + int elements = 0; + int esize = 0; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + esize = 2; + elements = 1; + break; + case GL_FLOAT: + esize = 4; + break; + default: + return 0; + } + return imageSizeInBytes(elements * esize, w, h, d, pack); +} + +private GLBufferSizeTracker bufferSizeTracker; +private GLBufferStateTracker bufferStateTracker; +private GLStateTracker glStateTracker; + +private boolean bufferObjectExtensionsInitialized = false; +private boolean haveOESFramebufferObject; + +private void initBufferObjectExtensionChecks() { + if (bufferObjectExtensionsInitialized) + return; + bufferObjectExtensionsInitialized = true; + haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object"); +} + +private 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 boolean checkArrayVBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + false, + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private boolean checkArrayVBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + true, + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private boolean checkElementVBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + false, + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private boolean checkElementVBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + true, + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private boolean checkUnpackPBODisabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return true; +} + +private boolean checkUnpackPBOEnabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return false; +} + +private boolean checkPackPBODisabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return true; +} + +private boolean checkPackPBOEnabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return false; +} + +private HashMap/*<MemoryObject>*/ arbMemCache = new HashMap(); + +/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ +public 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); + +public void glVertexPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glVertexPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glVertexPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); + } +} +public void glColorPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glColorPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glColorPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); + } + +} +public void glNormalPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.getComponentNumber()!=3) { + throw new GLException("Only 3 components per normal allowed"); + } + if(array.isVBO()) { + glNormalPointer(array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glNormalPointer(array.getComponentType(), array.getStride(), array.getBuffer()); + } +} +public void glTexCoordPointer(GLArrayData array) { + if(array.getComponentNumber()==0) return; + if(array.isVBO()) { + glTexCoordPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getOffset()); + } else { + glTexCoordPointer(array.getComponentNumber(), array.getComponentType(), array.getStride(), array.getBuffer()); + } +} + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java new file mode 100644 index 000000000..e096d2185 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -0,0 +1,312 @@ +// Tracks glBegin/glEnd calls to determine whether it is legal to +// query Vertex Buffer Object state +private boolean inBeginEndPair; + +public GLES2Impl(GLProfile glp, GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + this.glProfile = glp; +} + +public final boolean isGL4bc() { + return false; +} + +public final boolean isGL4() { + return false; +} + +public final boolean isGL3bc() { + return false; +} + +public final boolean isGL3() { + return false; +} + +public final boolean isGL2() { + return false; +} + +public final boolean isGLES1() { + return false; +} + +public final boolean isGLES2() { + return true; +} + +public final boolean isGLES() { + return true; +} + +public final boolean isGL2ES1() { + return false; +} + +public final boolean isGL2ES2() { + return true; +} + +public final boolean isGL2GL3() { + return false; +} + +public final boolean hasGLSL() { + return true; +} + +public final GL4bc getGL4bc() throws GLException { + throw new GLException("Not a GL4bc implementation"); +} + +public final GL4 getGL4() throws GLException { + throw new GLException("Not a GL4 implementation"); +} + +public final GL3bc getGL3bc() throws GLException { + throw new GLException("Not a GL3bc implementation"); +} + +public final GL3 getGL3() throws GLException { + throw new GLException("Not a GL3 implementation"); +} + +public final GL2 getGL2() throws GLException { + throw new GLException("Not a GL2 implementation"); +} + +public final GLES1 getGLES1() throws GLException { + throw new GLException("Not a GLES1 implementation"); +} + +public final GLES2 getGLES2() throws GLException { + return this; +} + +public final GL2ES1 getGL2ES1() throws GLException { + throw new GLException("Not a GL2ES1 implementation"); +} + +public final GL2ES2 getGL2ES2() throws GLException { + return this; +} + +public final GL2GL3 getGL2GL3() throws GLException { + throw new GLException("Not a GL2GL3 implementation"); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is computed as closely as possible based on the + pixel pack or unpack parameters. The logic in this routine is + based on code in the SGI OpenGL sample implementation. */ + +private int imageSizeInBytes(int format, int type, int w, int h, int d, + boolean pack) { + int elements = 0; + int esize = 0; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_STENCIL_INDEX: + elements = 1; + break; + case GL_ALPHA: + case GL_LUMINANCE: + case GL_DEPTH_COMPONENT: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + default: + return 0; + } + return imageSizeInBytes(elements * esize, w, h, d, pack); +} + +private GLBufferSizeTracker bufferSizeTracker; +private GLBufferStateTracker bufferStateTracker; +private GLStateTracker glStateTracker; + +private boolean bufferObjectExtensionsInitialized = false; +private boolean haveOESFramebufferObject; + +private void initBufferObjectExtensionChecks() { + if (bufferObjectExtensionsInitialized) + return; + bufferObjectExtensionsInitialized = true; + haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object"); +} + +private 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 boolean checkArrayVBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + false, + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private boolean checkArrayVBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + true, + GL.GL_ARRAY_BUFFER, + "array vertex_buffer_object", throwException); +} + +private boolean checkElementVBODisabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + false, + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private boolean checkElementVBOEnabled(boolean throwException) { + initBufferObjectExtensionChecks(); + return checkBufferObject(true, + true, + GL.GL_ELEMENT_ARRAY_BUFFER, + "element vertex_buffer_object", throwException); +} + +private boolean checkUnpackPBODisabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return true; +} + +private boolean checkUnpackPBOEnabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return false; +} + +private boolean checkPackPBODisabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return true; +} + +private boolean checkPackPBOEnabled(boolean throwException) { + // PBO n/a for ES 1.1 or ES 2.0 + return false; +} + +private HashMap/*<MemoryObject>*/ arbMemCache = new HashMap(); + +/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ +public 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); + +public void glClearDepth(double depth) { + glClearDepthf((float)depth); +} + +public void glDepthRange(double zNear, double zFar) { + glDepthRangef((float)zNear, (float)zFar); +} + diff --git a/make/config/jogl/gl-macosx-nsig.cfg b/make/config/jogl/gl-macosx-nsig.cfg new file mode 100644 index 000000000..6a4bc0a06 --- /dev/null +++ b/make/config/jogl/gl-macosx-nsig.cfg @@ -0,0 +1,2 @@ +Include nsig.cfg +Include gl-macosx.cfg diff --git a/make/config/jogl/gl-win32-nsig.cfg b/make/config/jogl/gl-win32-nsig.cfg new file mode 100644 index 000000000..b7c4973d4 --- /dev/null +++ b/make/config/jogl/gl-win32-nsig.cfg @@ -0,0 +1,2 @@ +Include nsig.cfg +Include gl-win32.cfg diff --git a/make/config/jogl/gl-x11-nsig.cfg b/make/config/jogl/gl-x11-nsig.cfg new file mode 100644 index 000000000..bb8a76821 --- /dev/null +++ b/make/config/jogl/gl-x11-nsig.cfg @@ -0,0 +1,2 @@ +Include nsig.cfg +Include gl-x11.cfg diff --git a/make/config/jogl/gl2_es2-common.cfg b/make/config/jogl/gl2_es2-common.cfg new file mode 100644 index 000000000..89f30a941 --- /dev/null +++ b/make/config/jogl/gl2_es2-common.cfg @@ -0,0 +1,23 @@ + +JavaPrologue glReleaseShaderCompiler if ( !_context.hasNativeES2Methods() ) { +JavaPrologue glReleaseShaderCompiler return; +JavaPrologue glReleaseShaderCompiler } + +JavaPrologue glShaderBinary if ( !_context.hasNativeES2Methods() ) { +JavaPrologue glShaderBinary throw new GLException("Method \"glShaderBinary\" not available"); +JavaPrologue glShaderBinary } + +JavaPrologue glGetShaderPrecisionFormat if ( !_context.hasNativeES2Methods() ) { +JavaPrologue glGetShaderPrecisionFormat throw new GLException("Method \"glGetShaderPrecisionFormat\" not available"); +JavaPrologue glGetShaderPrecisionFormat } + +JavaPrologue glDepthRangef if ( !_context.hasNativeES2Methods() ) { +JavaPrologue glDepthRangef glDepthRange( (double)zNear, (double)zFar ); +JavaPrologue glDepthRangef return; +JavaPrologue glDepthRangef } + +JavaPrologue glClearDepthf if ( !_context.hasNativeES2Methods() ) { +JavaPrologue glClearDepthf glClearDepth( (double)depth ); +JavaPrologue glClearDepthf return; +JavaPrologue glClearDepthf } + diff --git a/make/config/jogl/gl3-desktop.cfg b/make/config/jogl/gl3-desktop.cfg new file mode 100644 index 000000000..19eef4270 --- /dev/null +++ b/make/config/jogl/gl3-desktop.cfg @@ -0,0 +1,58 @@ +# 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 + +# +# Directives needed when processing wglext.h on Windows and other platforms +# +Opaque boolean BOOL +ReturnsString wglGetExtensionsStringARB +ReturnsString wglGetExtensionsStringEXT +Opaque long HANDLE +Opaque long HBITMAP +Opaque long HDC +Opaque long HGDIOBJ +Opaque long HGLRC +Opaque long HPBUFFERARB +Opaque long HPBUFFEREXT +Opaque boolean BOOL +Opaque long PROC +Opaque long void ** + +# +# Directives needed when processing cglext.h on MacOSX and other platforms +# +Opaque long CGContextRef +Opaque long void ** +# Implement the first argument to cglGetProcAddress as String instead +# of byte[] +ArgumentIsString cglGetProcAddress 0 + +# +# Directives needed when processing glxext.h on X11 and other platforms +# +Opaque long __GLXextFuncPtr +Opaque boolean Bool +Opaque long Display * +Opaque long GLXContext +Opaque long Visual * +# Ignore the empty Display and Visual data structures (though made +# opaque, the references from XVisualInfo and elsewhere are still +# traversed) +Ignore Display +Ignore Visual +ArgumentIsString glXGetProcAddress 0 +ArgumentIsString glXGetProcAddressARB 0 +ReturnsString glXQueryExtensionsString +ReturnsString glXQueryServerString +ReturnsString glXGetClientString +TemporaryCVariableDeclaration glXGetFBConfigs int count; +TemporaryCVariableAssignment glXGetFBConfigs count = _nelements_ptr[0]; +ReturnValueCapacity glXGetFBConfigs count * sizeof(GLXFBConfig) + diff --git a/make/config/jogl/gl3-headers.cfg b/make/config/jogl/gl3-headers.cfg new file mode 100644 index 000000000..8af9157cf --- /dev/null +++ b/make/config/jogl/gl3-headers.cfg @@ -0,0 +1,25 @@ +CustomCCode /* Define GL3_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "gl3.h" are parsed. */ +CustomCCode #define GL3_PROTOTYPES +CustomCCode #if defined(_WIN32) +CustomCCode #define WIN32_LEAN_AND_MEAN +CustomCCode #include <windows.h> +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 <inttypes.h> +CustomCCode #include <stdlib.h> +CustomCCode #include <GL3/gl3.h> +CustomCCode #include </usr/include/machine/types.h> +CustomCCode /* Provide Windows typedefs */ +CustomCCode typedef void* LPVOID; +CustomCCode typedef unsigned int* PUINT; +CustomCCode #elif defined(linux) || defined(__sun) || defined(__FreeBSD__) || defined(_HPUX) +CustomCCode #include <inttypes.h> +CustomCCode #include <stdlib.h> +CustomCCode #include <X11/Xlib.h> +CustomCCode #include <GL3/gl3.h> +CustomCCode #endif diff --git a/make/config/jogl/gl3ext-headers.cfg b/make/config/jogl/gl3ext-headers.cfg new file mode 100644 index 000000000..dfc4ea796 --- /dev/null +++ b/make/config/jogl/gl3ext-headers.cfg @@ -0,0 +1,5 @@ +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> diff --git a/make/config/jogl/gl4-desktop-tracker.cfg b/make/config/jogl/gl4-desktop-tracker.cfg new file mode 100644 index 000000000..4b9a7edb7 --- /dev/null +++ b/make/config/jogl/gl4-desktop-tracker.cfg @@ -0,0 +1,38 @@ + +# Track server-side object creation and deletion when necessary +# Note that this is only necessary when the Java 2D / JOGL bridge is active, +# so will never be needed for the embedded OpenGL variants +JavaEpilogue glGenBuffers if (tracker != null) tracker.addBuffers({0}, {1}); +JavaEpilogue glGenFencesAPPLE if (tracker != null) tracker.addFencesAPPLE({0}, {1}); +JavaEpilogue glGenFencesNV if (tracker != null) tracker.addFencesNV({0}, {1}); +JavaEpilogue glGenFragmentShadersATI if (tracker != null) tracker.addFragmentShadersATI(_res, {0}); +JavaEpilogue glGenFramebuffersEXT if (tracker != null) tracker.addFramebuffersEXT({0}, {1}); +JavaEpilogue glGenLists if (tracker != null) tracker.addLists(_res, {0}); +JavaEpilogue glGenOcclusionQueriesNV if (tracker != null) tracker.addOcclusionQueriesNV({0}, {1}); +JavaEpilogue glCreateProgram if (tracker != null) tracker.addProgramObject(_res); +JavaEpilogue glGenPrograms if (tracker != null) tracker.addPrograms({0}, {1}); +JavaEpilogue glGenQueries if (tracker != null) tracker.addQueries({0}, {1}); +JavaEpilogue glGenRenderbuffersEXT if (tracker != null) tracker.addRenderbuffersEXT({0}, {1}); +JavaEpilogue glCreateShader if (tracker != null) tracker.addShaderObject(_res); +JavaEpilogue glGenTextures if (tracker != null) tracker.addTextures({0}, {1}); +JavaEpilogue glGenVertexArraysAPPLE if (tracker != null) tracker.addVertexArraysAPPLE({0}, {1}); +JavaEpilogue glGenVertexShadersEXT if (tracker != null) tracker.addVertexShadersEXT(_res, {0}); + +JavaEpilogue glDeleteBuffers if (tracker != null) tracker.removeBuffers({0}, {1}); +JavaEpilogue glDeleteFencesAPPLE if (tracker != null) tracker.removeFencesAPPLE({0}, {1}); +JavaEpilogue glDeleteFencesNV if (tracker != null) tracker.removeFencesNV({0}, {1}); +JavaEpilogue glDeleteFragmentShaderATI if (tracker != null) tracker.removeFragmentShaderATI({0}); +JavaEpilogue glDeleteFramebuffersEXT if (tracker != null) tracker.removeFramebuffersEXT({0}, {1}); +JavaEpilogue glDeleteLists if (tracker != null) tracker.removeLists({0}, {1}); +JavaEpilogue glDeleteOcclusionQueriesNV if (tracker != null) tracker.removeOcclusionQueriesNV({0}, {1}); +JavaEpilogue glDeleteProgram if (tracker != null) tracker.removeProgramObject({0}); +JavaEpilogue glDeleteObject if (tracker != null) tracker.removeProgramOrShaderObject({0}); +JavaEpilogue glDeletePrograms if (tracker != null) tracker.removePrograms({0}, {1}); +JavaEpilogue glDeleteProgramsNV if (tracker != null) tracker.removeProgramsNV({0}, {1}); +JavaEpilogue glDeleteQueries if (tracker != null) tracker.removeQueries({0}, {1}); +JavaEpilogue glDeleteRenderbuffersEXT if (tracker != null) tracker.removeRenderbuffersEXT({0}, {1}); +JavaEpilogue glDeleteShader if (tracker != null) tracker.removeShaderObject({0}); +JavaEpilogue glDeleteTextures if (tracker != null) tracker.removeTextures({0}, {1}); +JavaEpilogue glDeleteVertexArraysAPPLE if (tracker != null) tracker.removeVertexArraysAPPLE({0}, {1}); +JavaEpilogue glDeleteVertexShaderEXT if (tracker != null) tracker.removeVertexShaderEXT({0}); + diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java new file mode 100644 index 000000000..8d2ebe662 --- /dev/null +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -0,0 +1,1468 @@ +/** + * Returns true if the specified GLU core- or extension-function can be + * successfully used through this GLU instance. By "successfully" we mean + * that the function is both <i>callable</i> on the machine running the + * program and <i>available</i> on the current display.<P> + * + * A GLU function is <i>callable</i> if it is a GLU core- or extension-function + * that is supported by the underlying GLU implementation. The function is + * <i>available</i> if the OpenGL implementation on the display meets the + * requirements of the GLU function being called (because GLU functions utilize + * OpenGL functions). <P> + * + * Whether or not a GLU function is <i>callable</i> is determined as follows: + * <ul> + * <li>If the function is a GLU core function (i.e., not an + * extension), <code>gluGetString(GLU_VERSION)</code> is used to determine the + * version number of the underlying GLU implementation on the host. + * then the function name is cross-referenced with that specification to + * see if it is part of that version's specification. + * + * <li> If the function is a GLU extension, the function name is + * cross-referenced with the list returned by + * <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of + * the extensions that is supported by the underlying GLU implementation. + * </ul> + * + * Whether or not a GLU function is <i>available</i> is determined as follows: + * <ul> + * <li>If the function is a GLU core function then the function is first + * cross-referenced with the GLU specifications to find the minimum GLU + * version required to <i>call</i> that GLU function. Then the following table + * is consulted to determine the minimum GL version required for that version + * of GLU: + * <ul> + * <li> GLU 1.0 requires OpenGL 1.0 + * <li> GLU 1.1 requires OpenGL 1.0 + * <li> GLU 1.2 requires OpenGL 1.1 + * <li> GLU 1.3 requires OpenGL 1.2 + * </ul> + * Finally, <code>glGetString(GL_VERSION)</code> is used to determine the + * highest OpenGL version that both host and display support, and from that it + * is possible to determine if the GL facilities required by the GLU function + * are <i>available</i> on the display. + * + * <li> If the function is a GLU extension, the function name is + * cross-referenced with the list returned by + * <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of + * the extensions that is supported by the underlying GLU implementation. + * </ul> + * + * <b>NOTE:</b>The availability of a function may change at runtime in + * response to changes in the display environment. For example, when a window + * is dragged from one display to another on a multi-display system, or when + * the properties of the display device are modified (e.g., changing the color + * depth of the display). Any application that is concerned with handling + * these situations correctly should confirm availability after a display + * change before calling a questionable OpenGL function. To detect a change in + * the display device, please see {@link + * GLEventListener#displayChanged(GLAutoDrawable,boolean,boolean)}. + * + * @param gluFunctionName the name of the OpenGL function (e.g., use + * "gluNurbsCallbackDataEXT" to check if the <code> + * gluNurbsCallbackDataEXT(GLUnurbs, GLvoid)</code> extension is available). + */ +public boolean isFunctionAvailable(String gluFunctionName) +{ + // if (useJavaMipmapCode) { + // All GLU functions are available in Java port + return true; + // } + // return (gluProcAddressTable.getAddressFor(gluFunctionName) != 0); +} + + +//---------------------------------------------------------------------- +// Utility routines +// + +private static final Class gl2Class; +private static final Class gl2es1Class; + +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"); + } catch (Throwable t) {} + gl2Class = _gl2Class; + gl2es1Class = _gl2es1Class; +} + +/** + * Instantiates a GLU implementation object in respect to the given GL profile + * of this thread current GL. + */ +public static final GLU createGLU() throws GLException { + return createGLU(getCurrentGL()); +} + +/** + * Instantiates a GLU implementation object in respect to the given GL profile + * of the given GL. + */ +public static final GLU createGLU(GL gl) throws GLException { + try { + Class c = null; + if(gl.isGL2() && null!=gl2Class) { + c = gl2Class; + } else if(gl.isGL2ES1() && null!=gl2es1Class) { + c = gl2es1Class; + /** There is no specialized ES 2 GLU at this time + } else if(gl.isGL2ES2() && null!=gl2es2Class) { + c = gl2es2Class; */ + } else { + c = GLU.class; + } + return (GLU) c.newInstance(); + } catch (Exception e) { + throw new GLException(e); + } +} + +public GLU() +{ + this.project = new ProjectFloat(); +} + +public void destroy() { + if(null!=this.project) { + this.project.destroy(); + this.project=null; + } +} + +public static final GL getCurrentGL() throws GLException { + GLContext curContext = GLContext.getCurrent(); + if (curContext == null) { + throw new GLException("No OpenGL context current on this thread"); + } + return curContext.getGL(); +} + +public final String gluErrorString(int errorCode) { + return Error.gluErrorString(errorCode); +} + +/* extName is an extension name. + * extString is a string of extensions separated by blank(s). There may or + * may not be leading or trailing blank(s) in extString. + * This works in cases of extensions being prefixes of another like + * GL_EXT_texture and GL_EXT_texture3D. + * Returns true if extName is found otherwise it returns false. + */ +public final boolean gluCheckExtension(java.lang.String extName, java.lang.String extString) { + return Registry.gluCheckExtension(extName, extString); +} + +public final String gluGetString(int name) { + return Registry.gluGetString(name); +} + +//---------------------------------------------------------------------- +// Tessellation routines +// + +protected static boolean availableGLUtessellatorImpl = false; +protected static boolean checkedGLUtessellatorImpl = false; + +protected static final void validateGLUtessellatorImpl() { + if(!checkedGLUtessellatorImpl) { + availableGLUtessellatorImpl = ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.glu.tessellator.GLUtessellatorImpl", GLU.class.getClassLoader()); + checkedGLUtessellatorImpl = true; + } + if(!availableGLUtessellatorImpl) { + throw new GLException("GLUtessellator not available (GLUtessellatorImpl)"); + } +} + +/***************************************************************************** + * <b>gluNewTess</b> creates and returns a new tessellation object. This + * object must be referred to when calling tesselation methods. A return + * value of null means that there was not enough memeory to allocate the + * object. + * + * Optional, throws GLException if not available in profile + * + * @return A new tessellation object. + * + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluDeleteTess gluDeleteTess + * @see #gluTessCallback gluTessCallback + ****************************************************************************/ +public static final GLUtessellator gluNewTess() { + validateGLUtessellatorImpl(); + return GLUtessellatorImpl.gluNewTess(); +} + +/***************************************************************************** + * <b>gluDeleteTess</b> destroys the indicated tessellation object (which was + * created with {@link #gluNewTess gluNewTess}). + * + * Optional, throws GLException if not available in profile + * + * @param tessellator + * Specifies the tessellation object to destroy. + * + * @see #gluBeginPolygon gluBeginPolygon + * @see #gluNewTess gluNewTess + * @see #gluTessCallback gluTessCallback + ****************************************************************************/ +public static final void gluDeleteTess(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluDeleteTess(); +} + +/***************************************************************************** + * <b>gluTessProperty</b> is used to control properites stored in a + * tessellation object. These properties affect the way that the polygons are + * interpreted and rendered. The legal value for <i>which</i> are as + * follows:<P> + * + * Optional, throws GLException if not available in profile + * + * <b>GLU_TESS_WINDING_RULE</b> + * <UL> + * Determines which parts of the polygon are on the "interior". + * <em>value</em> may be set to one of + * <BR><b>GLU_TESS_WINDING_ODD</b>, + * <BR><b>GLU_TESS_WINDING_NONZERO</b>, + * <BR><b>GLU_TESS_WINDING_POSITIVE</b>, or + * <BR><b>GLU_TESS_WINDING_NEGATIVE</b>, or + * <BR><b>GLU_TESS_WINDING_ABS_GEQ_TWO</b>.<P> + * + * To understand how the winding rule works, consider that the input + * contours partition the plane into regions. The winding rule determines + * which of these regions are inside the polygon.<P> + * + * For a single contour C, the winding number of a point x is simply the + * signed number of revolutions we make around x as we travel once around C + * (where CCW is positive). When there are several contours, the individual + * winding numbers are summed. This procedure associates a signed integer + * value with each point x in the plane. Note that the winding number is + * the same for all points in a single region.<P> + * + * The winding rule classifies a region as "inside" if its winding number + * belongs to the chosen category (odd, nonzero, positive, negative, or + * absolute value of at least two). The previous GLU tessellator (prior to + * GLU 1.2) used the "odd" rule. The "nonzero" rule is another common way + * to define the interior. The other three rules are useful for polygon CSG + * operations. + * </UL> + * <BR><b>GLU_TESS_BOUNDARY_ONLY</b> + * <UL> + * Is a boolean value ("value" should be set to GL_TRUE or GL_FALSE). When + * set to GL_TRUE, a set of closed contours separating the polygon interior + * and exterior are returned instead of a tessellation. Exterior contours + * are oriented CCW with respect to the normal; interior contours are + * oriented CW. The <b>GLU_TESS_BEGIN</b> and <b>GLU_TESS_BEGIN_DATA</b> + * callbacks use the type GL_LINE_LOOP for each contour. + * </UL> + * <BR><b>GLU_TESS_TOLERANCE</b> + * <UL> + * Specifies a tolerance for merging features to reduce the size of the + * output. For example, two vertices that are very close to each other + * might be replaced by a single vertex. The tolerance is multiplied by the + * largest coordinate magnitude of any input vertex; this specifies the + * maximum distance that any feature can move as the result of a single + * merge operation. If a single feature takes part in several merge + * operations, the toal distance moved could be larger.<P> + * + * Feature merging is completely optional; the tolerance is only a hint. + * The implementation is free to merge in some cases and not in others, or + * to never merge features at all. The initial tolerance is 0.<P> + * + * The current implementation merges vertices only if they are exactly + * coincident, regardless of the current tolerance. A vertex is spliced + * into an edge only if the implementation is unable to distinguish which + * side of the edge the vertex lies on. Two edges are merged only when both + * endpoints are identical. + * </UL> + * + * @param tessellator + * Specifies the tessellation object created with + * {@link #gluNewTess gluNewTess} + * @param which + * Specifies the property to be set. Valid values are + * <b>GLU_TESS_WINDING_RULE</b>, <b>GLU_TESS_BOUNDARDY_ONLY</b>, + * <b>GLU_TESS_TOLERANCE</b>. + * @param value + * Specifices the value of the indicated property. + * + * @see #gluGetTessProperty gluGetTessProperty + * @see #gluNewTess gluNewTess + ****************************************************************************/ +public static final void gluTessProperty(GLUtessellator tessellator, int which, double value) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessProperty(which, value); +} + +/***************************************************************************** + * <b>gluGetTessProperty</b> retrieves properties stored in a tessellation + * object. These properties affect the way that tessellation objects are + * interpreted and rendered. See the + * {@link #gluTessProperty gluTessProperty} reference + * page for information about the properties and what they do. + * + * Optional, throws GLException if not available in profile + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * @param which + * Specifies the property whose value is to be fetched. Valid values + * are <b>GLU_TESS_WINDING_RULE</b>, <b>GLU_TESS_BOUNDARY_ONLY</b>, + * and <b>GLU_TESS_TOLERANCES</b>. + * @param value + * Specifices an array into which the value of the named property is + * written. + * + * @see #gluNewTess gluNewTess + * @see #gluTessProperty gluTessProperty + ****************************************************************************/ +public static final void gluGetTessProperty(GLUtessellator tessellator, int which, double[] value, int value_offset) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluGetTessProperty(which, value, value_offset); +} + +/***************************************************************************** + * <b>gluTessNormal</b> describes a normal for a polygon that the program is + * defining. All input data will be projected onto a plane perpendicular to + * the one of the three coordinate axes before tessellation and all output + * triangles will be oriented CCW with repsect to the normal (CW orientation + * can be obtained by reversing the sign of the supplied normal). For + * example, if you know that all polygons lie in the x-y plane, call + * <b>gluTessNormal</b>(tess, 0.0, 0.0, 0.0) before rendering any polygons.<P> + * + * If the supplied normal is (0.0, 0.0, 0.0)(the initial value), the normal + * is determined as follows. The direction of the normal, up to its sign, is + * found by fitting a plane to the vertices, without regard to how the + * vertices are connected. It is expected that the input data lies + * approximately in the plane; otherwise, projection perpendicular to one of + * the three coordinate axes may substantially change the geometry. The sign + * of the normal is chosen so that the sum of the signed areas of all input + * contours is nonnegative (where a CCW contour has positive area).<P> + * + * The supplied normal persists until it is changed by another call to + * <b>gluTessNormal</b>. + * + * Optional, throws GLException if not available in profile + * + * @param tessellator + * Specifies the tessellation object (created by + * {@link #gluNewTess gluNewTess}). + * @param x + * Specifies the first component of the normal. + * @param y + * Specifies the second component of the normal. + * @param z + * Specifies the third component of the normal. + * + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessEndPolygon gluTessEndPolygon + ****************************************************************************/ +public static final void gluTessNormal(GLUtessellator tessellator, double x, double y, double z) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessNormal(x, y, z); +} + +/***************************************************************************** + * <b>gluTessCallback</b> is used to indicate a callback to be used by a + * tessellation object. If the specified callback is already defined, then it + * is replaced. If <i>aCallback</i> is null, then the existing callback + * becomes undefined.<P> + * + * Optional, throws GLException if not available in profile + * + * These callbacks are used by the tessellation object to describe how a + * polygon specified by the user is broken into triangles. Note that there are + * two versions of each callback: one with user-specified polygon data and one + * without. If both versions of a particular callback are specified, then the + * callback with user-specified polygon data will be used. Note that the + * polygonData parameter used by some of the methods is a copy of the + * reference that was specified when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The legal callbacks are as follows:<P> + * + * <b>GLU_TESS_BEGIN</b> + * <UL> + * The begin callback is invoked like {@link javax.media.opengl.GL#glBegin + * glBegin} to indicate the start of a (triangle) primitive. The method + * takes a single argument of type int. If the + * <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_FALSE</b>, then + * the argument is set to either <b>GL_TRIANGLE_FAN</b>, + * <b>GL_TRIANGLE_STRIP</b>, or <b>GL_TRIANGLES</b>. If the + * <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_TRUE</b>, then the + * argument will be set to <b>GL_LINE_LOOP</b>. The method prototype for + * this callback is: + * </UL> + * + * <PRE> + * void begin(int type);</PRE><P> + * + * <b>GLU_TESS_BEGIN_DATA</b> + * <UL> + * The same as the <b>GLU_TESS_BEGIN</b> callback except + * that it takes an additional reference argument. This reference is + * identical to the opaque reference provided when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void beginData(int type, Object polygonData);</PRE> + * + * <b>GLU_TESS_EDGE_FLAG</b> + * <UL> + * The edge flag callback is similar to + * {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes + * a single boolean boundaryEdge that indicates which edges lie on the + * polygon boundary. If the boundaryEdge is <b>GL_TRUE</b>, then each vertex + * that follows begins an edge that lies on the polygon boundary, that is, + * an edge that separates an interior region from an exterior one. If the + * boundaryEdge is <b>GL_FALSE</b>, then each vertex that follows begins an + * edge that lies in the polygon interior. The edge flag callback (if + * defined) is invoked before the first vertex callback.<P> + * + * Since triangle fans and triangle strips do not support edge flags, the + * begin callback is not called with <b>GL_TRIANGLE_FAN</b> or + * <b>GL_TRIANGLE_STRIP</b> if a non-null edge flag callback is provided. + * (If the callback is initialized to null, there is no impact on + * performance). Instead, the fans and strips are converted to independent + * triangles. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void edgeFlag(boolean boundaryEdge);</PRE> + * + * <b>GLU_TESS_EDGE_FLAG_DATA</b> + * <UL> + * The same as the <b>GLU_TESS_EDGE_FLAG</b> callback except that it takes + * an additional reference argument. This reference is identical to the + * opaque reference provided when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void edgeFlagData(boolean boundaryEdge, Object polygonData);</PRE> + * + * <b>GLU_TESS_VERTEX</b> + * <UL> + * The vertex callback is invoked between the begin and end callbacks. It is + * similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f}, and it + * defines the vertices of the triangles created by the tessellation + * process. The method takes a reference as its only argument. This + * reference is identical to the opaque reference provided by the user when + * the vertex was described (see + * {@link #gluTessVertex gluTessVertex}). The method + * prototype for this callback is: + * </UL> + * + * <PRE> + * void vertex(Object vertexData);</PRE> + * + * <b>GLU_TESS_VERTEX_DATA</b> + * <UL> + * The same as the <b>GLU_TESS_VERTEX</b> callback except that it takes an + * additional reference argument. This reference is identical to the opaque + * reference provided when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void vertexData(Object vertexData, Object polygonData);</PRE> + * + * <b>GLU_TESS_END</b> + * <UL> + * The end callback serves the same purpose as + * {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a + * primitive and it takes no arguments. The method prototype for this + * callback is: + * </UL> + * + * <PRE> + * void end();</PRE> + * + * <b>GLU_TESS_END_DATA</b> + * <UL> + * The same as the <b>GLU_TESS_END</b> callback except that it takes an + * additional reference argument. This reference is identical to the opaque + * reference provided when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void endData(Object polygonData);</PRE> + * + * <b>GLU_TESS_COMBINE</b> + * <UL> + * The combine callback is called to create a new vertex when the + * tessellation detects an intersection, or wishes to merge features. The + * method takes four arguments: an array of three elements each of type + * double, an array of four references, an array of four elements each of + * type float, and a reference to a reference. The prototype is: + * </UL> + * + * <PRE> + * void combine(double[] coords, Object[] data, + * float[] weight, Object[] outData);</PRE> + * + * <UL> + * The vertex is defined as a linear combination of up to four existing + * vertices, stored in <i>data</i>. The coefficients of the linear + * combination are given by <i>weight</i>; these weights always add up to 1. + * All vertex pointers are valid even when some of the weights are 0. + * <i>coords</i> gives the location of the new vertex.<P> + * + * The user must allocate another vertex, interpolate parameters using + * <i>data</i> and <i>weight</i>, and return the new vertex pointer + * in <i>outData</i>. This handle is supplied during rendering callbacks. + * The user is responsible for freeing the memory some time after + * {@link #gluTessEndPolygon gluTessEndPolygon} is + * called.<P> + * + * For example, if the polygon lies in an arbitrary plane in 3-space, and a + * color is associated with each vertex, the <b>GLU_TESS_COMBINE</b> + * callback might look like this: + * </UL> + * <PRE> + * void myCombine(double[] coords, Object[] data, + * float[] weight, Object[] outData) + * { + * MyVertex newVertex = new MyVertex(); + * + * newVertex.x = coords[0]; + * newVertex.y = coords[1]; + * newVertex.z = coords[2]; + * newVertex.r = weight[0]*data[0].r + + * weight[1]*data[1].r + + * weight[2]*data[2].r + + * weight[3]*data[3].r; + * newVertex.g = weight[0]*data[0].g + + * weight[1]*data[1].g + + * weight[2]*data[2].g + + * weight[3]*data[3].g; + * newVertex.b = weight[0]*data[0].b + + * weight[1]*data[1].b + + * weight[2]*data[2].b + + * weight[3]*data[3].b; + * newVertex.a = weight[0]*data[0].a + + * weight[1]*data[1].a + + * weight[2]*data[2].a + + * weight[3]*data[3].a; + * outData = newVertex; + * }</PRE> + * + * <UL> + * If the tessellation detects an intersection, then the + * <b>GLU_TESS_COMBINE</b> or <b>GLU_TESS_COMBINE_DATA</b> callback (see + * below) must be defined, and it must write a non-null reference into + * <i>outData</i>. Otherwise the <b>GLU_TESS_NEED_COMBINE_CALLBACK</b> error + * occurs, and no output is generated. + * </UL> + * + * <b>GLU_TESS_COMBINE_DATA</b> + * <UL> + * The same as the <b>GLU_TESS_COMBINE</b> callback except that it takes an + * additional reference argument. This reference is identical to the opaque + * reference provided when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void combineData(double[] coords, Object[] data, + float[] weight, Object[] outData, + Object polygonData);</PRE> + * + * <b>GLU_TESS_ERROR</b> + * <UL> + * The error callback is called when an error is encountered. The one + * argument is of type int; it indicates the specific error that occurred + * and will be set to one of <b>GLU_TESS_MISSING_BEGIN_POLYGON</b>, + * <b>GLU_TESS_MISSING_END_POLYGON</b>, + * <b>GLU_TESS_MISSING_BEGIN_CONTOUR</b>, + * <b>GLU_TESS_MISSING_END_CONTOUR</b>, <b>GLU_TESS_COORD_TOO_LARGE</b>, + * <b>GLU_TESS_NEED_COMBINE_CALLBACK</b> or <b>GLU_OUT_OF_MEMORY</b>. + * Character strings describing these errors can be retrieved with the + * {@link #gluErrorString gluErrorString} call. The + * method prototype for this callback is: + * </UL> + * + * <PRE> + * void error(int errnum);</PRE> + * + * <UL> + * The GLU library will recover from the first four errors by inserting the + * missing call(s). <b>GLU_TESS_COORD_TOO_LARGE</b> indicates that some + * vertex coordinate exceeded the predefined constant + * <b>GLU_TESS_MAX_COORD</b> in absolute value, and that the value has been + * clamped. (Coordinate values must be small enough so that two can be + * multiplied together without overflow.) + * <b>GLU_TESS_NEED_COMBINE_CALLBACK</b> indicates that the tessellation + * detected an intersection between two edges in the input data, and the + * <b>GLU_TESS_COMBINE</b> or <b>GLU_TESS_COMBINE_DATA</b> callback was not + * provided. No output is generated. <b>GLU_OUT_OF_MEMORY</b> indicates that + * there is not enough memory so no output is generated. + * </UL> + * + * <b>GLU_TESS_ERROR_DATA</b> + * <UL> + * The same as the GLU_TESS_ERROR callback except that it takes an + * additional reference argument. This reference is identical to the opaque + * reference provided when + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * was called. The method prototype for this callback is: + * </UL> + * + * <PRE> + * void errorData(int errnum, Object polygonData);</PRE> + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * @param which + * Specifies the callback being defined. The following values are + * valid: <b>GLU_TESS_BEGIN</b>, <b>GLU_TESS_BEGIN_DATA</b>, + * <b>GLU_TESS_EDGE_FLAG</b>, <b>GLU_TESS_EDGE_FLAG_DATA</b>, + * <b>GLU_TESS_VERTEX</b>, <b>GLU_TESS_VERTEX_DATA</b>, + * <b>GLU_TESS_END</b>, <b>GLU_TESS_END_DATA</b>, + * <b>GLU_TESS_COMBINE</b>, <b>GLU_TESS_COMBINE_DATA</b>, + * <b>GLU_TESS_ERROR</b>, and <b>GLU_TESS_ERROR_DATA</b>. + * @param aCallback + * Specifies the callback object to be called. + * + * @see javax.media.opengl.GL#glBegin glBegin + * @see javax.media.opengl.GL#glEdgeFlag glEdgeFlag + * @see javax.media.opengl.GL#glVertex3f glVertex3f + * @see #gluNewTess gluNewTess + * @see #gluErrorString gluErrorString + * @see #gluTessVertex gluTessVertex + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessBeginContour gluTessBeginContour + * @see #gluTessProperty gluTessProperty + * @see #gluTessNormal gluTessNormal + ****************************************************************************/ +public static final void gluTessCallback(GLUtessellator tessellator, int which, GLUtessellatorCallback aCallback) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessCallback(which, aCallback); +} + +/***************************************************************************** + * <b>gluTessVertex</b> describes a vertex on a polygon that the program + * defines. Successive <b>gluTessVertex</b> calls describe a closed contour. + * For example, to describe a quadrilateral <b>gluTessVertex</b> should be + * called four times. <b>gluTessVertex</b> can only be called between + * {@link #gluTessBeginContour gluTessBeginContour} and + * {@link #gluTessBeginContour gluTessEndContour}.<P> + * + * Optional, throws GLException if not available in profile + * + * <b>data</b> normally references to a structure containing the vertex + * location, as well as other per-vertex attributes such as color and normal. + * This reference is passed back to the user through the + * <b>GLU_TESS_VERTEX</b> or <b>GLU_TESS_VERTEX_DATA</b> callback after + * tessellation (see the {@link #gluTessCallback + * gluTessCallback} reference page). + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * @param coords + * Specifies the coordinates of the vertex. + * @param data + * Specifies an opaque reference passed back to the program with the + * vertex callback (as specified by + * {@link #gluTessCallback gluTessCallback}). + * + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluNewTess gluNewTess + * @see #gluTessBeginContour gluTessBeginContour + * @see #gluTessCallback gluTessCallback + * @see #gluTessProperty gluTessProperty + * @see #gluTessNormal gluTessNormal + * @see #gluTessEndPolygon gluTessEndPolygon + ****************************************************************************/ +public static final void gluTessVertex(GLUtessellator tessellator, double[] coords, int coords_offset, Object data) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessVertex(coords, coords_offset, data); +} + +/***************************************************************************** + * <b>gluTessBeginPolygon</b> and + * {@link #gluTessEndPolygon gluTessEndPolygon} delimit + * the definition of a convex, concave or self-intersecting polygon. Within + * each <b>gluTessBeginPolygon</b>/ + * {@link #gluTessEndPolygon gluTessEndPolygon} pair, + * there must be one or more calls to + * {@link #gluTessBeginContour gluTessBeginContour}/ + * {@link #gluTessEndContour gluTessEndContour}. Within + * each contour, there are zero or more calls to + * {@link #gluTessVertex gluTessVertex}. The vertices + * specify a closed contour (the last vertex of each contour is automatically + * linked to the first). See the {@link #gluTessVertex + * gluTessVertex}, {@link #gluTessBeginContour + * gluTessBeginContour}, and {@link #gluTessEndContour + * gluTessEndContour} reference pages for more details.<P> + * + * Optional, throws GLException if not available in profile + * + * <b>data</b> is a reference to a user-defined data structure. If the + * appropriate callback(s) are specified (see + * {@link #gluTessCallback gluTessCallback}), then this + * reference is returned to the callback method(s). Thus, it is a convenient + * way to store per-polygon information.<P> + * + * Once {@link #gluTessEndPolygon gluTessEndPolygon} is + * called, the polygon is tessellated, and the resulting triangles are + * described through callbacks. See + * {@link #gluTessCallback gluTessCallback} for + * descriptions of the callback methods. + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * @param data + * Specifies a reference to user polygon data. + * + * @see #gluNewTess gluNewTess + * @see #gluTessBeginContour gluTessBeginContour + * @see #gluTessVertex gluTessVertex + * @see #gluTessCallback gluTessCallback + * @see #gluTessProperty gluTessProperty + * @see #gluTessNormal gluTessNormal + * @see #gluTessEndPolygon gluTessEndPolygon + ****************************************************************************/ +public static final void gluTessBeginPolygon(GLUtessellator tessellator, Object data) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessBeginPolygon(data); +} + +/***************************************************************************** + * <b>gluTessBeginContour</b> and + * {@link #gluTessEndContour gluTessEndContour} delimit + * the definition of a polygon contour. Within each + * <b>gluTessBeginContour</b>/ + * {@link #gluTessEndContour gluTessEndContour} pair, + * there can be zero or more calls to + * {@link #gluTessVertex gluTessVertex}. The vertices + * specify a closed contour (the last vertex of each contour is automatically + * linked to the first). See the {@link #gluTessVertex + * gluTessVertex} reference page for more details. <b>gluTessBeginContour</b> + * can only be called between + * {@link #gluTessBeginPolygon gluTessBeginPolygon} and + * {@link #gluTessEndPolygon gluTessEndPolygon}. + * + * Optional, throws GLException if not available in profile + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * + * @see #gluNewTess gluNewTess + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessVertex gluTessVertex + * @see #gluTessCallback gluTessCallback + * @see #gluTessProperty gluTessProperty + * @see #gluTessNormal gluTessNormal + * @see #gluTessEndPolygon gluTessEndPolygon + ****************************************************************************/ +public static final void gluTessBeginContour(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessBeginContour(); +} + +/***************************************************************************** + * <b>gluTessEndContour</b> and + * {@link #gluTessBeginContour gluTessBeginContour} + * delimit the definition of a polygon contour. Within each + * {@link #gluTessBeginContour gluTessBeginContour}/ + * <b>gluTessEndContour</b> pair, there can be zero or more calls to + * {@link #gluTessVertex gluTessVertex}. The vertices + * specify a closed contour (the last vertex of each contour is automatically + * linked to the first). See the {@link #gluTessVertex + * gluTessVertex} reference page for more details. + * {@link #gluTessBeginContour gluTessBeginContour} can + * only be called between {@link #gluTessBeginPolygon + * gluTessBeginPolygon} and + * {@link #gluTessEndPolygon gluTessEndPolygon}. + * + * Optional, throws GLException if not available in profile + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * + * @see #gluNewTess gluNewTess + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessVertex gluTessVertex + * @see #gluTessCallback gluTessCallback + * @see #gluTessProperty gluTessProperty + * @see #gluTessNormal gluTessNormal + * @see #gluTessEndPolygon gluTessEndPolygon + ****************************************************************************/ +public static final void gluTessEndContour(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessEndContour(); +} + +/***************************************************************************** + * <b>gluTessEndPolygon</b> and + * {@link #gluTessBeginPolygon gluTessBeginPolygon} + * delimit the definition of a convex, concave or self-intersecting polygon. + * Within each {@link #gluTessBeginPolygon + * gluTessBeginPolygon}/<b>gluTessEndPolygon</b> pair, there must be one or + * more calls to {@link #gluTessBeginContour + * gluTessBeginContour}/{@link #gluTessEndContour + * gluTessEndContour}. Within each contour, there are zero or more calls to + * {@link #gluTessVertex gluTessVertex}. The vertices + * specify a closed contour (the last vertex of each contour is automatically + * linked to the first). See the {@link #gluTessVertex + * gluTessVertex}, {@link #gluTessBeginContour + * gluTessBeginContour} and {@link #gluTessEndContour + * gluTessEndContour} reference pages for more details.<P> + * + * Optional, throws GLException if not available in profile + * + * Once <b>gluTessEndPolygon</b> is called, the polygon is tessellated, and + * the resulting triangles are described through callbacks. See + * {@link #gluTessCallback gluTessCallback} for + * descriptions of the callback functions. + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * + * @see #gluNewTess gluNewTess + * @see #gluTessBeginContour gluTessBeginContour + * @see #gluTessVertex gluTessVertex + * @see #gluTessCallback gluTessCallback + * @see #gluTessProperty gluTessProperty + * @see #gluTessNormal gluTessNormal + * @see #gluTessBeginPolygon gluTessBeginPolygon + ****************************************************************************/ +public static final void gluTessEndPolygon(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluTessEndPolygon(); +} + +/***************************************************************************** + + * <b>gluBeginPolygon</b> and {@link #gluEndPolygon gluEndPolygon} + * delimit the definition of a nonconvex polygon. To define such a + * polygon, first call <b>gluBeginPolygon</b>. Then define the + * contours of the polygon by calling {@link #gluTessVertex + * gluTessVertex} for each vertex and {@link #gluNextContour + * gluNextContour} to start each new contour. Finally, call {@link + * #gluEndPolygon gluEndPolygon} to signal the end of the + * definition. See the {@link #gluTessVertex gluTessVertex} and {@link + * #gluNextContour gluNextContour} reference pages for more + * details.<P> + * + * Optional, throws GLException if not available in profile + * + * Once {@link #gluEndPolygon gluEndPolygon} is called, + * the polygon is tessellated, and the resulting triangles are described + * through callbacks. See {@link #gluTessCallback + * gluTessCallback} for descriptions of the callback methods. + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * + * @see #gluNewTess gluNewTess + * @see #gluNextContour gluNextContour + * @see #gluTessCallback gluTessCallback + * @see #gluTessVertex gluTessVertex + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessBeginContour gluTessBeginContour + ****************************************************************************/ +public static final void gluBeginPolygon(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluBeginPolygon(); +} + +/***************************************************************************** + * <b>gluNextContour</b> is used to describe polygons with multiple + * contours. After you describe the first contour through a series of + * {@link #gluTessVertex gluTessVertex} calls, a + * <b>gluNextContour</b> call indicates that the previous contour is complete + * and that the next contour is about to begin. Perform another series of + * {@link #gluTessVertex gluTessVertex} calls to + * describe the new contour. Repeat this process until all contours have been + * described.<P> + * + * Optional, throws GLException if not available in profile + * + * The type parameter defines what type of contour follows. The following + * values are valid. <P> + * + * <b>GLU_EXTERIOR</b> + * <UL> + * An exterior contour defines an exterior boundary of the polygon. + * </UL> + * <b>GLU_INTERIOR</b> + * <UL> + * An interior contour defines an interior boundary of the polygon (such as + * a hole). + * </UL> + * <b>GLU_UNKNOWN</b> + * <UL> + * An unknown contour is analyzed by the library to determine whether it is + * interior or exterior. + * </UL> + * <b>GLU_CCW, GLU_CW</b> + * <UL> + * The first <b>GLU_CCW</b> or <b>GLU_CW</b> contour defined is considered + * to be exterior. All other contours are considered to be exterior if they + * are oriented in the same direction (clockwise or counterclockwise) as the + * first contour, and interior if they are not. If one contour is of type + * <b>GLU_CCW</b> or <b>GLU_CW</b>, then all contours must be of the same + * type (if they are not, then all <b>GLU_CCW</b> and <b>GLU_CW</b> contours + * will be changed to <b>GLU_UNKNOWN</b>). Note that there is no + * real difference between the <b>GLU_CCW</b> and <b>GLU_CW</b> contour + * types. + * </UL><P> + * + * To define the type of the first contour, you can call <b>gluNextContour</b> + * before describing the first contour. If you do not call + * <b>gluNextContour</b> before the first contour, the first contour is marked + * <b>GLU_EXTERIOR</b>.<P> + * + * <UL> + * <b>Note:</b> The <b>gluNextContour</b> function is obsolete and is + * provided for backward compatibility only. The <b>gluNextContour</b> + * function is mapped to {@link #gluTessEndContour + * gluTessEndContour} followed by + * {@link #gluTessBeginContour gluTessBeginContour}. + * </UL> + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * @param type + * The type of the contour being defined. + * + * @see #gluNewTess gluNewTess + * @see #gluTessBeginContour gluTessBeginContour + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessCallback gluTessCallback + * @see #gluTessEndContour gluTessEndContour + * @see #gluTessVertex gluTessVertex + ****************************************************************************/ +public static final void gluNextContour(GLUtessellator tessellator, int type) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluNextContour(type); +} + +/***************************************************************************** + * <b>gluEndPolygon</b> and {@link #gluBeginPolygon + * gluBeginPolygon} delimit the definition of a nonconvex polygon. To define + * such a polygon, first call {@link #gluBeginPolygon + * gluBeginPolygon}. Then define the contours of the polygon by calling + * {@link #gluTessVertex gluTessVertex} for each vertex + * and {@link #gluNextContour gluNextContour} to start + * each new contour. Finally, call <b>gluEndPolygon</b> to signal the end of + * the definition. See the {@link #gluTessVertex + * gluTessVertex} and {@link #gluNextContour + * gluNextContour} reference pages for more details.<P> + * + * Optional, throws GLException if not available in profile + * + * Once <b>gluEndPolygon</b> is called, the polygon is tessellated, and the + * resulting triangles are described through callbacks. See + * {@link #gluTessCallback gluTessCallback} for + * descriptions of the callback methods. + * + * @param tessellator + * Specifies the tessellation object (created with + * {@link #gluNewTess gluNewTess}). + * + * @see #gluNewTess gluNewTess + * @see #gluNextContour gluNextContour + * @see #gluTessCallback gluTessCallback + * @see #gluTessVertex gluTessVertex + * @see #gluTessBeginPolygon gluTessBeginPolygon + * @see #gluTessBeginContour gluTessBeginContour + ****************************************************************************/ +public static final void gluEndPolygon(GLUtessellator tessellator) { + validateGLUtessellatorImpl(); + GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator; + tess.gluEndPolygon(); +} + +// Boolean +public static final int GLU_FALSE = 0; +public static final int GLU_TRUE = 1; + +// String Name +public static final int GLU_VERSION = 100800; +public static final int GLU_EXTENSIONS = 100801; + +// Extensions +public static final String versionString = "1.3"; +public static final String extensionString = "GLU_EXT_nurbs_tessellator " + + "GLU_EXT_object_space_tess "; + +// ErrorCode +public static final int GLU_INVALID_ENUM = 100900; +public static final int GLU_INVALID_VALUE = 100901; +public static final int GLU_OUT_OF_MEMORY = 100902; +public static final int GLU_INVALID_OPERATION = 100904; + + +// QuadricDrawStyle +public static final int GLU_POINT = 100010; +public static final int GLU_LINE = 100011; +public static final int GLU_FILL = 100012; +public static final int GLU_SILHOUETTE = 100013; + +// QuadricCallback +// GLU_ERROR + +// QuadricNormal +public static final int GLU_SMOOTH = 100000; +public static final int GLU_FLAT = 100001; +public static final int GLU_NONE = 100002; + +// QuadricOrientation +public static final int GLU_OUTSIDE = 100020; +public static final int GLU_INSIDE = 100021; + +// NurbsDisplay +// GLU_FILL +//public static final int GLU_OUTLINE_POLYGON = 100240; +//public static final int GLU_OUTLINE_PATCH = 100241; + +// NurbsCallback +//public static final int GLU_NURBS_ERROR = 100103; +public static final int GLU_ERROR = 100103; +//public static final int GLU_NURBS_BEGIN = 100164; +//public static final int GLU_NURBS_BEGIN_EXT = 100164; +//public static final int GLU_NURBS_VERTEX = 100165; +//public static final int GLU_NURBS_VERTEX_EXT = 100165; +//public static final int GLU_NURBS_NORMAL = 100166; +//public static final int GLU_NURBS_NORMAL_EXT = 100166; +//public static final int GLU_NURBS_COLOR = 100167; +//public static final int GLU_NURBS_COLOR_EXT = 100167; +//public static final int GLU_NURBS_TEXTURE_COORD = 100168; +//public static final int GLU_NURBS_TEX_COORD_EXT = 100168; +//public static final int GLU_NURBS_END = 100169; +//public static final int GLU_NURBS_END_EXT = 100169; +//public static final int GLU_NURBS_BEGIN_DATA = 100170; +//public static final int GLU_NURBS_BEGIN_DATA_EXT = 100170; +//public static final int GLU_NURBS_VERTEX_DATA = 100171; +//public static final int GLU_NURBS_VERTEX_DATA_EXT = 100171; +//public static final int GLU_NURBS_NORMAL_DATA = 100172; +//public static final int GLU_NURBS_NORMAL_DATA_EXT = 100172; +//public static final int GLU_NURBS_COLOR_DATA = 100173; +//public static final int GLU_NURBS_COLOR_DATA_EXT = 100173; +//public static final int GLU_NURBS_TEXTURE_COORD_DATA = 100174; +//public static final int GLU_NURBS_TEX_COORD_DATA_EXT = 100174; +//public static final int GLU_NURBS_END_DATA = 100175; +//public static final int GLU_NURBS_END_DATA_EXT = 100175; + +// NurbsError +//public static final int GLU_NURBS_ERROR1 = 100251; +//public static final int GLU_NURBS_ERROR2 = 100252; +//public static final int GLU_NURBS_ERROR3 = 100253; +//public static final int GLU_NURBS_ERROR4 = 100254; +//public static final int GLU_NURBS_ERROR5 = 100255; +//public static final int GLU_NURBS_ERROR6 = 100256; +//public static final int GLU_NURBS_ERROR7 = 100257; +//public static final int GLU_NURBS_ERROR8 = 100258; +//public static final int GLU_NURBS_ERROR9 = 100259; +//public static final int GLU_NURBS_ERROR10 = 100260; +//public static final int GLU_NURBS_ERROR11 = 100261; +//public static final int GLU_NURBS_ERROR12 = 100262; +//public static final int GLU_NURBS_ERROR13 = 100263; +//public static final int GLU_NURBS_ERROR14 = 100264; +//public static final int GLU_NURBS_ERROR15 = 100265; +//public static final int GLU_NURBS_ERROR16 = 100266; +//public static final int GLU_NURBS_ERROR17 = 100267; +//public static final int GLU_NURBS_ERROR18 = 100268; +//public static final int GLU_NURBS_ERROR19 = 100269; +//public static final int GLU_NURBS_ERROR20 = 100270; +//public static final int GLU_NURBS_ERROR21 = 100271; +//public static final int GLU_NURBS_ERROR22 = 100272; +//public static final int GLU_NURBS_ERROR23 = 100273; +//public static final int GLU_NURBS_ERROR24 = 100274; +//public static final int GLU_NURBS_ERROR25 = 100275; +//public static final int GLU_NURBS_ERROR26 = 100276; +//public static final int GLU_NURBS_ERROR27 = 100277; +//public static final int GLU_NURBS_ERROR28 = 100278; +//public static final int GLU_NURBS_ERROR29 = 100279; +//public static final int GLU_NURBS_ERROR30 = 100280; +//public static final int GLU_NURBS_ERROR31 = 100281; +//public static final int GLU_NURBS_ERROR32 = 100282; +//public static final int GLU_NURBS_ERROR33 = 100283; +//public static final int GLU_NURBS_ERROR34 = 100284; +//public static final int GLU_NURBS_ERROR35 = 100285; +//public static final int GLU_NURBS_ERROR36 = 100286; +//public static final int GLU_NURBS_ERROR37 = 100287; + +// NurbsProperty +//public static final int GLU_AUTO_LOAD_MATRIX = 100200; +//public static final int GLU_CULLING = 100201; +//public static final int GLU_SAMPLING_TOLERANCE = 100203; +//public static final int GLU_DISPLAY_MODE = 100204; +//public static final int GLU_PARAMETRIC_TOLERANCE = 100202; +//public static final int GLU_SAMPLING_METHOD = 100205; +//public static final int GLU_U_STEP = 100206; +//public static final int GLU_V_STEP = 100207; +//public static final int GLU_NURBS_MODE = 100160; +//public static final int GLU_NURBS_MODE_EXT = 100160; +//public static final int GLU_NURBS_TESSELLATOR = 100161; +//public static final int GLU_NURBS_TESSELLATOR_EXT = 100161; +//public static final int GLU_NURBS_RENDERER = 100162; +//public static final int GLU_NURBS_RENDERER_EXT = 100162; + +// NurbsSampling +//public static final int GLU_OBJECT_PARAMETRIC_ERROR = 100208; +//public static final int GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; +//public static final int GLU_OBJECT_PATH_LENGTH = 100209; +//public static final int GLU_OBJECT_PATH_LENGTH_EXT = 100209; +//public static final int GLU_PATH_LENGTH = 100215; +//public static final int GLU_PARAMETRIC_ERROR = 100216; +//public static final int GLU_DOMAIN_DISTANCE = 100217; + +// NurbsTrim +//public static final int GLU_MAP1_TRIM_2 = 100210; +//public static final int GLU_MAP1_TRIM_3 = 100211; + +// QuadricCallback +// GLU_ERROR + +// TessCallback +public static final int GLU_TESS_BEGIN = 100100; +public static final int GLU_BEGIN = 100100; +public static final int GLU_TESS_VERTEX = 100101; +public static final int GLU_VERTEX = 100101; +public static final int GLU_TESS_END = 100102; +public static final int GLU_END = 100102; +public static final int GLU_TESS_ERROR = 100103; +public static final int GLU_TESS_EDGE_FLAG = 100104; +public static final int GLU_EDGE_FLAG = 100104; +public static final int GLU_TESS_COMBINE = 100105; +public static final int GLU_TESS_BEGIN_DATA = 100106; +public static final int GLU_TESS_VERTEX_DATA = 100107; +public static final int GLU_TESS_END_DATA = 100108; +public static final int GLU_TESS_ERROR_DATA = 100109; +public static final int GLU_TESS_EDGE_FLAG_DATA = 100110; +public static final int GLU_TESS_COMBINE_DATA = 100111; + +// TessContour +public static final int GLU_CW = 100120; +public static final int GLU_CCW = 100121; +public static final int GLU_INTERIOR = 100122; +public static final int GLU_EXTERIOR = 100123; +public static final int GLU_UNKNOWN = 100124; + +// TessProperty +public static final int GLU_TESS_WINDING_RULE = 100140; +public static final int GLU_TESS_BOUNDARY_ONLY = 100141; +public static final int GLU_TESS_TOLERANCE = 100142; +// JOGL-specific boolean property, false by default, that may improve the tessellation +public static final int GLU_TESS_AVOID_DEGENERATE_TRIANGLES = 100149; + +// TessError +public static final int GLU_TESS_ERROR1 = 100151; +public static final int GLU_TESS_ERROR2 = 100152; +public static final int GLU_TESS_ERROR3 = 100153; +public static final int GLU_TESS_ERROR4 = 100154; +public static final int GLU_TESS_ERROR5 = 100155; +public static final int GLU_TESS_ERROR6 = 100156; +public static final int GLU_TESS_ERROR7 = 100157; +public static final int GLU_TESS_ERROR8 = 100158; +public static final int GLU_TESS_MISSING_BEGIN_POLYGON = 100151; +public static final int GLU_TESS_MISSING_BEGIN_CONTOUR = 100152; +public static final int GLU_TESS_MISSING_END_POLYGON = 100153; +public static final int GLU_TESS_MISSING_END_CONTOUR = 100154; +public static final int GLU_TESS_COORD_TOO_LARGE = 100155; +public static final int GLU_TESS_NEED_COMBINE_CALLBACK = 100156; + +// TessWinding +public static final int GLU_TESS_WINDING_ODD = 100130; +public static final int GLU_TESS_WINDING_NONZERO = 100131; +public static final int GLU_TESS_WINDING_POSITIVE = 100132; +public static final int GLU_TESS_WINDING_NEGATIVE = 100133; +public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; +public static final double GLU_TESS_MAX_COORD = 1.0e150; + +//---------------------------------------------------------------------- +// Quadric functionality +// + +protected static boolean availableGLUquadricImpl = false; +protected static boolean checkedGLUquadricImpl = false; +protected static volatile Object syncObject = new Object(); + +/** + * Optional, throws GLException if not available in profile + */ +protected static final void validateGLUquadricImpl() { + if(!checkedGLUquadricImpl) { + synchronized (syncObject) { + if(!checkedGLUquadricImpl) { + availableGLUquadricImpl = ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.glu.GLUquadricImpl", GLU.class.getClassLoader()); + checkedGLUquadricImpl = true; + } + } + } + if(!availableGLUquadricImpl) { + throw new GLException("GLUquadric not available (GLUquadricImpl)"); + } +} + + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluCylinder(GLUquadric * quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code> */ +public final void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawCylinder(getCurrentGL(), (float) base, (float) top, (float) height, slices, stacks); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric * quad); </code> */ +public final void gluDeleteQuadric(GLUquadric quad) { + validateGLUquadricImpl(); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ +public final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops); +} + +/** 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); +} + +public final GLUquadric gluNewQuadric(boolean useGLSL) { + GL gl = getCurrentGL(); + if(useGLSL && !gl.isGL2ES2()) { + throw new GLException("GLUquadric GLSL implementation not supported for profile: "+gl); + } + validateGLUquadricImpl(); + return new GLUquadricImpl(gl, useGLSL); +} + +/** 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> */ +public final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric * quad, GLenum draw); </code> */ +public final void gluQuadricDrawStyle(GLUquadric quad, int draw) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setDrawStyle(draw); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric * quad, GLenum normal); </code> */ +public final void gluQuadricNormals(GLUquadric quad, int normal) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setNormals(normal); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric * quad, GLenum orientation); </code> */ +public final void gluQuadricOrientation(GLUquadric quad, int orientation) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setOrientation(orientation); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric * quad, GLboolean texture); </code> */ +public final void gluQuadricTexture(GLUquadric quad, boolean texture) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).setTextureFlag(texture); +} + +/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluSphere(GLUquadric * quad, GLdouble radius, GLint slices, GLint stacks); </code> */ +public final void gluSphere(GLUquadric quad, double radius, int slices, int stacks) { + validateGLUquadricImpl(); + ((GLUquadricImpl) quad).drawSphere(getCurrentGL(), (float) radius, slices, stacks); +} + +//---------------------------------------------------------------------- +// Projection routines +// + +private ProjectFloat project; + +public void gluOrtho2D(float left, float right, float bottom, float top) { + project.gluOrtho2D(getCurrentGL().getGL2ES1(), left, right, bottom, top); +} + +public void gluPerspective(float fovy, float aspect, float zNear, float zFar) { + project.gluPerspective(getCurrentGL().getGL2ES1(), fovy, aspect, zNear, zFar); +} + +public void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { + project.gluLookAt(getCurrentGL().getGL2ES1(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); +} + +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single array. + */ +public boolean gluProject(float objX, float objY, float objZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] winPos, int winPos_offset) { + return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single buffer. + */ +public boolean gluProject(float objX, float objY, float objZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer winPos) { + return project.gluProject(objX, objY, objZ, model, proj, view, winPos); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code> + * <P> Accepts the outgoing object coordinates (a 3-vector) as a single array. + */ +public boolean gluUnProject(float winX, float winY, float winZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] objPos, int objPos_offset) { + return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code> + * <P> Accepts the outgoing object coordinates (a 3-vector) as a single buffer. + */ +public boolean gluUnProject(float winX, float winY, float winZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer objPos) { + return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code> + * <P> Accepts the outgoing object coordinates (a 4-vector) as a single array. + */ +public boolean gluUnProject4(float winX, float winY, float winZ, float clipW, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float nearVal, float farVal, float[] objPos, int objPos_offset) { + return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, objPos, objPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code> + * <P> Accepts the outgoing object coordinates (a 4-vector) as a single buffer. + */ +public boolean gluUnProject4(float winX, float winY, float winZ, float clipW, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, float nearVal, float farVal, java.nio.FloatBuffer objPos) { + return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos); +} + +public void gluPickMatrix(float x, float y, float delX, float delY, int[] viewport, int viewport_offset) { + project.gluPickMatrix(getCurrentGL().getGL2ES1(), x, y, delX, delY, viewport, viewport_offset); +} + +public void gluPickMatrix(float x, float y, float delX, float delY, java.nio.IntBuffer viewport) { + project.gluPickMatrix(getCurrentGL().getGL2ES1(), x, y, delX, delY, viewport); +} + +public void gluOrtho2D(double left, double right, double bottom, double top) { + project.gluOrtho2D(getCurrentGL().getGL2ES1(), (float)left, (float)right, (float)bottom, (float)top); +} + +public void gluPerspective(double fovy, double aspect, double zNear, double zFar) { + project.gluPerspective(getCurrentGL().getGL2ES1(), (float)fovy, (float)aspect, (float)zNear, (float)zFar); +} + +public void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) { + project.gluLookAt(getCurrentGL().getGL2ES1(), (float)eyeX, (float)eyeY, (float)eyeZ, (float)centerX, (float)centerY, (float)centerZ, (float)upX, (float)upY, (float)upZ); +} + +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single array. + */ +public boolean gluProject(double objX, double objY, double objZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] winPos, int winPos_offset) { + return project.gluProject((float)objX, (float)objY, (float)objZ, Buffers.getFloatArray(model), model_offset, Buffers.getFloatArray(proj), proj_offset, view, view_offset, Buffers.getFloatArray(winPos), winPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code> + * <P> Accepts the outgoing object coordinates (a 3-vector) as a single array. + */ +public boolean gluUnProject(double winX, double winY, double winZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] objPos, int objPos_offset) { + return project.gluUnProject((float)winX, (float)winY, (float)winZ, Buffers.getFloatArray(model), model_offset, Buffers.getFloatArray(proj), proj_offset, view, view_offset, Buffers.getFloatArray(objPos), objPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code> + * <P> Accepts the outgoing object coordinates (a 4-vector) as a single array. + */ +public boolean gluUnProject4(double winX, double winY, double winZ, double clipW, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double nearVal, double farVal, double[] objPos, int objPos_offset) { + return project.gluUnProject4((float)winX, (float)winY, (float)winZ, (float)clipW, Buffers.getFloatArray(model), model_offset, Buffers.getFloatArray(proj), proj_offset, view, view_offset, (float)nearVal, (float)farVal, Buffers.getFloatArray(objPos), objPos_offset); +} + +public void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) { + project.gluPickMatrix(getCurrentGL().getGL2ES1(), (float)x, (float)y, (float)delX, (float)delY, viewport, viewport_offset); +} + +public void gluPickMatrix(double x, double y, double delX, double delY, IntBuffer viewport) { + project.gluPickMatrix(getCurrentGL().getGL2ES1(), (float)x, (float)y, (float)delX, (float)delY, viewport); +} + +/** + * Optional, throws GLException if not available in profile + */ +public int gluScaleImage( int format, int widthin, int heightin, + int typein, java.nio.Buffer datain, int widthout, int heightout, + int typeout, java.nio.Buffer dataout ) { + throw new GLException("not implemented"); +} + +/** + * Optional, throws GLException if not available in profile + */ +public int gluBuild1DMipmapLevels( int target, int internalFormat, int width, + int format, int type, int userLevel, int baseLevel, int maxLevel, + java.nio.Buffer data ) { + throw new GLException("not implemented"); +} +/** + * Optional, throws GLException if not available in profile + */ +public int gluBuild1DMipmaps( int target, int internalFormat, int width, + int format, int type, java.nio.Buffer data ) { + throw new GLException("not implemented"); +} + +/** + * Optional, throws GLException if not available in profile + */ +public int gluBuild2DMipmapLevels( int target, int internalFormat, int width, + int height, int format, int type, int userLevel, int baseLevel, + int maxLevel, java.nio.Buffer data ) { + throw new GLException("not implemented"); +} + +/** + * Optional, throws GLException if not available in profile + */ +public int gluBuild2DMipmaps( int target, int internalFormat, int width, + int height, int format, int type, java.nio.Buffer data ) { + throw new GLException("not implemented"); +} + +/** + * Optional, throws GLException if not available in profile + */ +public int gluBuild3DMipmapLevels( int target, int internalFormat, int width, + int height, int depth, int format, int type, int userLevel, int baseLevel, + int maxLevel, java.nio.Buffer data) { + throw new GLException("not implemented"); +} + +/** + * Optional, throws GLException if not available in profile + */ +public int gluBuild3DMipmaps( int target, int internalFormat, int width, + int height, int depth, int format, int type, java.nio.Buffer data ) { + throw new GLException("not implemented"); +} + diff --git a/make/config/jogl/glu-CustomJavaCode-gl2.java b/make/config/jogl/glu-CustomJavaCode-gl2.java new file mode 100644 index 000000000..4dcb5691e --- /dev/null +++ b/make/config/jogl/glu-CustomJavaCode-gl2.java @@ -0,0 +1,553 @@ +private static boolean useJavaMipmapCode = true; + +static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String val = System.getProperty("jogl.glu.nojava"); + if (val != null && !val.toLowerCase().equals("false")) { + useJavaMipmapCode = false; + } + return null; + } + }); +} + +/** + * Instantiates a new OpenGL Utility Library object. A GLU object may + * be instantiated at any point in the application and is not + * inherently tied to any particular OpenGL context; however, the GLU + * object may only be used when an OpenGL context is current on the + * current thread. Attempts to call most of the methods in the GLU + * library when no OpenGL context is current will cause an exception + * to be thrown. + * + * <P> + * + * The returned GLU object is not guaranteed to be thread-safe and + * should only be used from one thread at a time. Multiple GLU objects + * may be instantiated to be used from different threads + * simultaneously. + */ + +public GLUgl2() +{ + this.project = new ProjectDouble(); +} + +public void destroy() { + if(null!=this.project) { + this.project.destroy(); + this.project=null; + } + super.destroy(); +} + + +//---------------------------------------------------------------------- +// Utility routines +// + +public static final GL2 getCurrentGL2() throws GLException { + GLContext curContext = GLContext.getCurrent(); + if (curContext == null) { + throw new GLException("No OpenGL context current on this thread"); + } + return curContext.getGL().getGL2(); +} + +/** + * Returns true if the specified GLU core- or extension-function can be + * successfully used through this GLU instance. By "successfully" we mean + * that the function is both <i>callable</i> on the machine running the + * program and <i>available</i> on the current display.<P> + * + * A GLU function is <i>callable</i> if it is a GLU core- or extension-function + * that is supported by the underlying GLU implementation. The function is + * <i>available</i> if the OpenGL implementation on the display meets the + * requirements of the GLU function being called (because GLU functions utilize + * OpenGL functions). <P> + * + * Whether or not a GLU function is <i>callable</i> is determined as follows: + * <ul> + * <li>If the function is a GLU core function (i.e., not an + * extension), <code>gluGetString(GLU_VERSION)</code> is used to determine the + * version number of the underlying GLU implementation on the host. + * then the function name is cross-referenced with that specification to + * see if it is part of that version's specification. + * + * <li> If the function is a GLU extension, the function name is + * cross-referenced with the list returned by + * <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of + * the extensions that is supported by the underlying GLU implementation. + * </ul> + * + * Whether or not a GLU function is <i>available</i> is determined as follows: + * <ul> + * <li>If the function is a GLU core function then the function is first + * cross-referenced with the GLU specifications to find the minimum GLU + * version required to <i>call</i> that GLU function. Then the following table + * is consulted to determine the minimum GL version required for that version + * of GLU: + * <ul> + * <li> GLU 1.0 requires OpenGL 1.0 + * <li> GLU 1.1 requires OpenGL 1.0 + * <li> GLU 1.2 requires OpenGL 1.1 + * <li> GLU 1.3 requires OpenGL 1.2 + * </ul> + * Finally, <code>glGetString(GL_VERSION)</code> is used to determine the + * highest OpenGL version that both host and display support, and from that it + * is possible to determine if the GL facilities required by the GLU function + * are <i>available</i> on the display. + * + * <li> If the function is a GLU extension, the function name is + * cross-referenced with the list returned by + * <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of + * the extensions that is supported by the underlying GLU implementation. + * </ul> + * + * <b>NOTE:</b>The availability of a function may change at runtime in + * response to changes in the display environment. For example, when a window + * is dragged from one display to another on a multi-display system, or when + * the properties of the display device are modified (e.g., changing the color + * depth of the display). Any application that is concerned with handling + * these situations correctly should confirm availability after a display + * change before calling a questionable OpenGL function. To detect a change in + * the display device, please see {@link + * GLEventListener#displayChanged(GLAutoDrawable,boolean,boolean)}. + * + * @param gluFunctionName the name of the OpenGL function (e.g., use + * "gluNurbsCallbackDataEXT" to check if the <code> + * gluNurbsCallbackDataEXT(GLUnurbs, GLvoid)</code> extension is available). + */ +public final boolean isFunctionAvailable(String gluFunctionName) +{ + if (useJavaMipmapCode) { + // All GLU functions are available in Java port + return true; + } + return (gluProcAddressTable.getAddressFor(gluFunctionName) != 0); +} + +//---------------------------------------------------------------------- +// Projection routines +// + +private 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); + +} + +public final void gluOrtho2D(double left, double right, double bottom, double top) { + project.gluOrtho2D(getCurrentGL2(), left, right, bottom, top); +} + +public final void gluPerspective(float fovy, float aspect, float zNear, float zFar) { + project.gluPerspective(getCurrentGL2(), (double)fovy, (double)aspect, (double)zNear, (double)zFar); +} + +public final void gluPerspective(double fovy, double aspect, double zNear, double zFar) { + project.gluPerspective(getCurrentGL2(), fovy, aspect, zNear, zFar); +} + +public final void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { + project.gluLookAt(getCurrentGL2(), (double)eyeX, (double)eyeY, (double)eyeZ, (double)centerX, (double)centerY, (double)centerZ, (double)upX, (double)upY, (double)upZ); +} + +public final void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) { + project.gluLookAt(getCurrentGL2(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); +} + +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single array. + */ +public final boolean gluProject(double objX, double objY, double objZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] winPos, int winPos_offset) { + return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code> + * <P> Accepts the outgoing window coordinates as a single buffer. + */ +public final boolean gluProject(double objX, double objY, double objZ, DoubleBuffer model, DoubleBuffer proj, IntBuffer view, DoubleBuffer winPos) { + return project.gluProject(objX, objY, objZ, model, proj, view, winPos); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code> + * <P> Accepts the outgoing object coordinates (a 3-vector) as a single array. + */ +public final boolean gluUnProject(double winX, double winY, double winZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] objPos, int objPos_offset) { + return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code> + * <P> Accepts the outgoing object coordinates (a 3-vector) as a single buffer. + */ +public final boolean gluUnProject(double winX, double winY, double winZ, DoubleBuffer model, DoubleBuffer proj, IntBuffer view, DoubleBuffer objPos) { + return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code> + * <P> Accepts the outgoing object coordinates (a 4-vector) as a single array. + */ +public final boolean gluUnProject4(double winX, double winY, double winZ, double clipW, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double nearVal, double farVal, double[] objPos, int objPos_offset) { + return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, objPos, objPos_offset); +} + +/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code> + * <P> Accepts the outgoing object coordinates (a 4-vector) as a single buffer. + */ +public final boolean gluUnProject4(double winX, double winY, double winZ, double clipW, DoubleBuffer model, DoubleBuffer proj, IntBuffer view, double nearVal, double farVal, DoubleBuffer objPos) { + return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos); +} + +public final void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) { + project.gluPickMatrix(getCurrentGL2(), x, y, delX, delY, viewport, viewport_offset); +} + +public final void gluPickMatrix(double x, double y, double delX, double delY, IntBuffer viewport) { + project.gluPickMatrix(getCurrentGL2(), x, y, delX, delY, viewport); +} + +//---------------------------------------------------------------------- +// Mipmap and image scaling functionality + + +private final ByteBuffer copyToByteBuffer(Buffer buf) { + if (buf instanceof ByteBuffer) { + if (buf.position() == 0) { + return (ByteBuffer) buf; + } + return Buffers.copyByteBuffer((ByteBuffer) buf); + } else if (buf instanceof ShortBuffer) { + return Buffers.copyShortBufferAsByteBuffer((ShortBuffer) buf); + } else if (buf instanceof IntBuffer) { + return Buffers.copyIntBufferAsByteBuffer((IntBuffer) buf); + } else if (buf instanceof FloatBuffer) { + return Buffers.copyFloatBufferAsByteBuffer((FloatBuffer) buf); + } else { + throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)"); + } +} + +private final int gluScaleImageJava( int format, int widthin, int heightin, + int typein, Buffer datain, int widthout, int heightout, + int typeout, Buffer dataout ) { + ByteBuffer in = null; + ByteBuffer out = null; + in = copyToByteBuffer(datain); + if( dataout instanceof ByteBuffer ) { + out = (ByteBuffer)dataout; + } else if( dataout instanceof ShortBuffer ) { + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_SHORT); + } else if ( dataout instanceof IntBuffer ) { + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_INT); + } else if ( dataout instanceof FloatBuffer ) { + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_FLOAT); + } else { + throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)"); + } + int errno = Mipmap.gluScaleImage( getCurrentGL2(), format, widthin, heightin, typein, in, + widthout, heightout, typeout, out ); + if( errno == 0 ) { + out.rewind(); + if (out != dataout) { + if( dataout instanceof ShortBuffer ) { + ((ShortBuffer) dataout).put(out.asShortBuffer()); + } else if( dataout instanceof IntBuffer ) { + ((IntBuffer) dataout).put(out.asIntBuffer()); + } else if( dataout instanceof FloatBuffer ) { + ((FloatBuffer) dataout).put(out.asFloatBuffer()); + } else { + throw new RuntimeException("Should not reach here"); + } + } + } + return( errno ); +} + + +private final int gluBuild1DMipmapLevelsJava( int target, int internalFormat, int width, + int format, int type, int userLevel, int baseLevel, int maxLevel, + Buffer data ) { + ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild1DMipmapLevels( getCurrentGL2(), target, internalFormat, width, + format, type, userLevel, baseLevel, maxLevel, buffer ) ); +} + + +private final int gluBuild1DMipmapsJava( int target, int internalFormat, int width, + int format, int type, Buffer data ) { + ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild1DMipmaps( getCurrentGL2(), target, internalFormat, width, format, + type, buffer ) ); +} + + +private final int gluBuild2DMipmapLevelsJava( int target, int internalFormat, int width, + int height, int format, int type, int userLevel, int baseLevel, + int maxLevel, Buffer data ) { + // While the code below handles other data types, it doesn't handle non-ByteBuffers + data = copyToByteBuffer(data); + return( Mipmap.gluBuild2DMipmapLevels( getCurrentGL2(), target, internalFormat, width, + height, format, type, userLevel, baseLevel, maxLevel, data ) ); +} + +private final int gluBuild2DMipmapsJava( int target, int internalFormat, int width, + int height, int format, int type, Buffer data ) { + // While the code below handles other data types, it doesn't handle non-ByteBuffers + data = copyToByteBuffer(data); + return( Mipmap.gluBuild2DMipmaps( getCurrentGL2(), target, internalFormat, width, height, + format, type, data) ); +} + +private final int gluBuild3DMipmapLevelsJava( int target, int internalFormat, int width, + int height, int depth, int format, int type, int userLevel, int baseLevel, + int maxLevel, Buffer data) { + ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild3DMipmapLevels( getCurrentGL2(), target, internalFormat, width, + height, depth, format, type, userLevel, baseLevel, maxLevel, buffer) ); +} + +private final int gluBuild3DMipmapsJava( int target, int internalFormat, int width, + int height, int depth, int format, int type, Buffer data ) { + ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild3DMipmaps( getCurrentGL2(), target, internalFormat, width, height, + depth, format, type, buffer ) ); +} + + +//---------------------------------------------------------------------- +// Wrappers for mipmap and image scaling entry points which dispatch either +// to the Java or C versions. +// + +/** Interface to C language function: <br> <code> GLint gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void * data); </code> */ +public final int gluBuild1DMipmapLevels(int target, int internalFormat, int width, int format, int type, int level, int base, int max, java.nio.Buffer data) { + if (useJavaMipmapCode) { + return gluBuild1DMipmapLevelsJava(target, internalFormat, width, format, type, level, base, max, data); + } else { + return gluBuild1DMipmapLevelsC(target, internalFormat, width, format, type, level, base, max, data); + } +} + +/** Interface to C language function: <br> <code> GLint gluBuild1DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void * data); </code> */ +public final int gluBuild1DMipmaps(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data) { + if (useJavaMipmapCode) { + return gluBuild1DMipmapsJava(target, internalFormat, width, format, type, data); + } else { + return gluBuild1DMipmapsC(target, internalFormat, width, format, type, data); + } +} + +/** Interface to C language function: <br> <code> GLint gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void * data); </code> */ +public final int gluBuild2DMipmapLevels(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, java.nio.Buffer data) { + if (useJavaMipmapCode) { + return gluBuild2DMipmapLevelsJava(target, internalFormat, width, height, format, type, level, base, max, data); + } else { + return gluBuild2DMipmapLevelsC(target, internalFormat, width, height, format, type, level, base, max, data); + } +} + + +/** Interface to C language function: <br> <code> GLint gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * data); </code> */ +public final int gluBuild2DMipmaps(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data) { + if (useJavaMipmapCode) { + return gluBuild2DMipmapsJava(target, internalFormat, width, height, format, type, data); + } else { + return gluBuild2DMipmapsC(target, internalFormat, width, height, format, type, data); + } +} + + +/** Interface to C language function: <br> <code> GLint gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void * data); </code> */ +public final int gluBuild3DMipmapLevels(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, java.nio.Buffer data) { + if (useJavaMipmapCode) { + return gluBuild3DMipmapLevelsJava(target, internalFormat, width, height, depth, format, type, level, base, max, data); + } else { + return gluBuild3DMipmapLevelsC(target, internalFormat, width, height, depth, format, type, level, base, max, data); + } +} + +/** Interface to C language function: <br> <code> GLint gluBuild3DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * data); </code> */ +public final int gluBuild3DMipmaps(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data) { + if (useJavaMipmapCode) { + return gluBuild3DMipmapsJava(target, internalFormat, width, height, depth, format, type, data); + } else { + return gluBuild3DMipmapsC(target, internalFormat, width, height, depth, format, type, data); + } +} + + +/** Interface to C language function: <br> <code> GLint gluScaleImage(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void * dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid * dataOut); </code> */ +public final int gluScaleImage(int format, int wIn, int hIn, int typeIn, java.nio.Buffer dataIn, int wOut, int hOut, int typeOut, java.nio.Buffer dataOut) { + if (useJavaMipmapCode) { + return gluScaleImageJava(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut); + } else { + return gluScaleImageC(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut); + } +} + +//---------------------------------------------------------------------- +// NURBS functionality +// + +/** + * Sets a property on a NURBS object. (NOTE: this function is not currently implemented.) + * + * @param r + * GLUnurbs object holding NURBS to which a property should be + * set + * @param property + * property id + * @param value + * property value + */ +public final void gluNurbsProperty(GLUnurbs r, int property, float value) { + // TODO glunurbsproperty + float nurbsValue; + switch (property) { + default: + // System.out.println("TODO gluwnurbs.glunurbsproperty"); + break; + } +} + +/** + * Creates a new GLUnurbs object. + * + * @return GLUnurbs object + */ +public final GLUnurbs gluNewNurbsRenderer() { + // DONE + return new GLUgl2nurbsImpl(); +} + +/** + * Begins a curve definition. + * + * @param r + * GLUnurbs object to specify curve to + */ +public final void gluBeginCurve(GLUnurbs r) { + // DONE + ((GLUgl2nurbsImpl) r).bgncurve(); +} + +/** + * Begins a surface definition. + * + * @param r + * GLUnurbs object to specify surface to + */ +public final void gluBeginSurface(GLUnurbs r) { + // DONE + ((GLUgl2nurbsImpl) r).bgnsurface(); +} + +/** + * Ends a surface. + * + * @param r + * GLUnurbs object holding surface + */ +public final void gluEndSurface(GLUnurbs r) { + // DONE + ((GLUgl2nurbsImpl) r).endsurface(); +} + +/** + * Makes a NURBS surface. + * + * @param r + * GLUnurbs object holding the surface + * @param sknot_count + * number of knots in s direction + * @param sknot + * knots in s direction + * @param tknot_count + * number of knots in t direction + * @param tknot + * knots in t direction + * @param s_stride + * number of control points coordinates in s direction + * @param t_stride + * number of control points coordinates in t direction + * @param ctlarray + * control points + * @param sorder + * order of surface in s direction + * @param torder + * order of surface in t direction + * @param type + * surface type + */ +public final void gluNurbsSurface(GLUnurbs r, int sknot_count, float[] sknot, + int tknot_count, float[] tknot, int s_stride, int t_stride, + float[] ctlarray, int sorder, int torder, int type) { + // DONE + ((GLUgl2nurbsImpl) r).nurbssurface(sknot_count, sknot, tknot_count, tknot, s_stride, + t_stride, ctlarray, sorder, torder, type); +} + +/** + * Make a NURBS curve. + * + * @param r + * GLUnurbs object holding the curve + * @param nknots + * number of knots + * @param knot + * knot vector + * @param stride + * number of control point coordinates + * @param ctlarray + * control points + * @param order + * order of the curve + * @param type + * curve type + */ +public final void gluNurbsCurve(GLUnurbs r, int nknots, float[] knot, int stride, + float[] ctlarray, int order, int type) { + int realType; + switch (type) { + // TODO GLU_MAP1_TRIM_2 etc. + default: + realType = type; + break; + } + ((GLUgl2nurbsImpl) r).nurbscurve(nknots, knot, stride, ctlarray, order, realType); +} + +/** + * Ends a curve definition. + * + * @param r + * GLUnurbs object holding the curve + */ +public final void gluEndCurve(GLUnurbs r) { + //DONE + ((GLUgl2nurbsImpl) r).endcurve(); +} + +//---------------------------------------------------------------------- +// GLUProcAddressTable handling +// + +private static GLUgl2ProcAddressTable gluProcAddressTable; + +private static final GLUgl2ProcAddressTable getGLUProcAddressTable() { + if (gluProcAddressTable == null) { + GLContext curContext = GLContext.getCurrent(); + if (curContext == null) { + throw new GLException("No OpenGL context current on this thread"); + } + GLDynamicLookupHelper glLookupHelper = ((GLDrawableImpl) curContext.getGLDrawable()).getGLDynamicLookupHelper(); + glLookupHelper.loadGLULibrary(); + GLUgl2ProcAddressTable tmp = new GLUgl2ProcAddressTable(new GLProcAddressResolver()); + tmp.reset(glLookupHelper); + gluProcAddressTable = tmp; + } + return gluProcAddressTable; +} diff --git a/make/config/jogl/glu-CustomJavaCode-gl2es1.java b/make/config/jogl/glu-CustomJavaCode-gl2es1.java new file mode 100644 index 000000000..3f520498b --- /dev/null +++ b/make/config/jogl/glu-CustomJavaCode-gl2es1.java @@ -0,0 +1,227 @@ +/* +private static boolean useJavaMipmapCode = true; + +static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String val = System.getProperty("jogl.glu.nojava"); + if (val != null && !val.toLowerCase().equals("false")) { + useJavaMipmapCode = false; + } + return null; + } + }); +} +*/ + +/** + * Instantiates a new OpenGL Utility Library object. A GLU object may + * be instantiated at any point in the application and is not + * inherently tied to any particular OpenGL context; however, the GLU + * object may only be used when an OpenGL context is current on the + * current thread. Attempts to call most of the methods in the GLU + * library when no OpenGL context is current will cause an exception + * to be thrown. + * + * <P> + * + * The returned GLU object is not guaranteed to be thread-safe and + * should only be used from one thread at a time. Multiple GLU objects + * may be instantiated to be used from different threads + * simultaneously. + */ + +public GLUgl2es1() +{ + super(); +} + +public void destroy() { + super.destroy(); +} + +//---------------------------------------------------------------------- +// Utility routines +// + +public static final GL2ES1 getCurrentGL2ES1() throws GLException { + GLContext curContext = GLContext.getCurrent(); + if (curContext == null) { + throw new GLException("No OpenGL context current on this thread"); + } + return curContext.getGL().getGL2ES1(); +} + + +/* +public String gluErrorString(int errorCode) { + return Error.gluErrorString(errorCode); +} +*/ + +/* extName is an extension name. + * extString is a string of extensions separated by blank(s). There may or + * may not be leading or trailing blank(s) in extString. + * This works in cases of extensions being prefixes of another like + * GL_EXT_texture and GL_EXT_texture3D. + * Returns true if extName is found otherwise it returns false. + */ +/* +public boolean gluCheckExtension(java.lang.String extName, java.lang.String extString) { + return Registry.gluCheckExtension(extName, extString); +} +*/ + +/* +public String gluGetString(int name) { + return Registry.gluGetString(name); +} +*/ + +//---------------------------------------------------------------------- +// Mipmap and image scaling functionality + +protected static boolean availableMipmap = false; +protected static boolean checkedMipmap = false; + +protected static final void validateMipmap() { + if(!checkedMipmap) { + availableMipmap = ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.glu.mipmap.Mipmap", GLU.class.getClassLoader()); + checkedMipmap = true; + } + if(!availableMipmap) { + throw new GLException("Mipmap not available"); + } +} + +private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) { + if (buf instanceof java.nio.ByteBuffer) { + if (buf.position() == 0) { + return (java.nio.ByteBuffer) buf; + } + return Buffers.copyByteBuffer((java.nio.ByteBuffer) buf); + } else if (buf instanceof java.nio.ShortBuffer) { + return Buffers.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf); + } else if (buf instanceof java.nio.IntBuffer) { + return Buffers.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf); + } else if (buf instanceof java.nio.FloatBuffer) { + return Buffers.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf); + } else { + throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)"); + } +} + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluScaleImage( int format, int widthin, int heightin, + int typein, java.nio.Buffer datain, int widthout, int heightout, + int typeout, java.nio.Buffer dataout ) { + validateMipmap(); + java.nio.ByteBuffer in = null; + java.nio.ByteBuffer out = null; + in = copyToByteBuffer(datain); + if( dataout instanceof java.nio.ByteBuffer ) { + out = (java.nio.ByteBuffer)dataout; + } else if( dataout instanceof java.nio.ShortBuffer ) { + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_SHORT); + } else if ( dataout instanceof java.nio.IntBuffer ) { + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_INT); + } else if ( dataout instanceof java.nio.FloatBuffer ) { + out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_FLOAT); + } else { + throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)"); + } + int errno = Mipmap.gluScaleImage( getCurrentGL2ES1(), format, widthin, heightin, typein, in, + widthout, heightout, typeout, out ); + if( errno == 0 ) { + out.rewind(); + if (out != dataout) { + if( dataout instanceof java.nio.ShortBuffer ) { + ((java.nio.ShortBuffer) dataout).put(out.asShortBuffer()); + } else if( dataout instanceof java.nio.IntBuffer ) { + ((java.nio.IntBuffer) dataout).put(out.asIntBuffer()); + } else if( dataout instanceof java.nio.FloatBuffer ) { + ((java.nio.FloatBuffer) dataout).put(out.asFloatBuffer()); + } else { + throw new RuntimeException("Should not reach here"); + } + } + } + return( errno ); +} + + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluBuild1DMipmapLevels( int target, int internalFormat, int width, + int format, int type, int userLevel, int baseLevel, int maxLevel, + java.nio.Buffer data ) { + validateMipmap(); + java.nio.ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild1DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width, + format, type, userLevel, baseLevel, maxLevel, buffer ) ); +} + + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluBuild1DMipmaps( int target, int internalFormat, int width, + int format, int type, java.nio.Buffer data ) { + validateMipmap(); + java.nio.ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild1DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, format, + type, buffer ) ); +} + + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluBuild2DMipmapLevels( int target, int internalFormat, int width, + int height, int format, int type, int userLevel, int baseLevel, + int maxLevel, java.nio.Buffer data ) { + validateMipmap(); + // While the code below handles other data types, it doesn't handle non-ByteBuffers + data = copyToByteBuffer(data); + return( Mipmap.gluBuild2DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width, + height, format, type, userLevel, baseLevel, maxLevel, data ) ); +} + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluBuild2DMipmaps( int target, int internalFormat, int width, + int height, int format, int type, java.nio.Buffer data ) { + validateMipmap(); + // While the code below handles other data types, it doesn't handle non-ByteBuffers + data = copyToByteBuffer(data); + return( Mipmap.gluBuild2DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, height, + format, type, data) ); +} + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluBuild3DMipmapLevels( int target, int internalFormat, int width, + int height, int depth, int format, int type, int userLevel, int baseLevel, + int maxLevel, java.nio.Buffer data) { + validateMipmap(); + java.nio.ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild3DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width, + height, depth, format, type, userLevel, baseLevel, maxLevel, buffer) ); +} + +/** + * Optional, throws GLException if not available in profile + */ +public final int gluBuild3DMipmaps( int target, int internalFormat, int width, + int height, int depth, int format, int type, java.nio.Buffer data ) { + validateMipmap(); + java.nio.ByteBuffer buffer = copyToByteBuffer(data); + return( Mipmap.gluBuild3DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, height, + depth, format, type, buffer ) ); +} + diff --git a/make/config/jogl/glu-base.cfg b/make/config/jogl/glu-base.cfg new file mode 100644 index 000000000..d859225ec --- /dev/null +++ b/make/config/jogl/glu-base.cfg @@ -0,0 +1,28 @@ +# This .cfg file is used to generate the GLU implementation for OpenGL ES 1.0, +# where it is pure Java. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +Style ImplOnly +ImplPackage javax.media.opengl.glu +ImplJavaClass GLU +AccessControl GLU PUBLIC + +Ignore gluBuild1DMipmapLevels +Ignore gluBuild1DMipmaps +Ignore gluBuild2DMipmapLevels +Ignore gluBuild2DMipmaps +Ignore gluBuild3DMipmapLevels +Ignore gluBuild3DMipmaps +Ignore gluScaleImage + +# Custom Java code for GLU class +IncludeAs CustomJavaCode GLU glu-CustomJavaCode-base.java + +# Imports for the Error and Registry classes +Import com.jogamp.opengl.impl.glu.error.Error +Import com.jogamp.opengl.impl.glu.registry.Registry + +Include glu-common.cfg + +Import java.lang.reflect.* diff --git a/make/config/jogl/glu-common.cfg b/make/config/jogl/glu-common.cfg new file mode 100644 index 000000000..f5fc7c1b3 --- /dev/null +++ b/make/config/jogl/glu-common.cfg @@ -0,0 +1,178 @@ +GLHeader GL/glu.h + +# This .cfg file provides common options used among all GLU glue code +HierarchicalNativeOutput false + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +# +# Imports needed by all glue code +# +Import javax.media.opengl.* +Import javax.media.opengl.glu.* +Import com.jogamp.opengl.impl.* +Import com.jogamp.opengl.impl.glu.* +Import com.jogamp.opengl.impl.glu.tessellator.GLUtessellatorImpl +Import com.jogamp.common.util.ReflectionUtil + +# Raise GLException instead of RuntimeException in glue code +RuntimeExceptionType GLException +UnsupportedExceptionType GLException + +# +# Opaques and other directives for platform-independent routines +# + +Opaque boolean GLboolean +Opaque boolean BOOL + +# +# Don't output #defines of GLU version identifier strings as constants, +# because we don't need them java-side. +# +Ignore GLU_VERSION_.+ + +# +# Ignore the non-GLU functions +# +Ignore gl[^u].+ + +# +# Ignore the non-GLU constants +# +Ignore GL[^U]?_.+ + +# +# Ignore the GLU extension constants, since we don't need them java-side +# +Ignore GLU_EXT_.+ + +# Javadoc for the GLU class +ClassJavadoc GLU /** +ClassJavadoc GLU * Provides access to the OpenGL Utility Library (GLU). This library +ClassJavadoc GLU * provides standard methods for setting up view volumes, building +ClassJavadoc GLU * mipmaps and performing other common operations. The GLU NURBS +ClassJavadoc GLU * routines are not currently exposed. +ClassJavadoc GLU * +ClassJavadoc GLU * <P> +ClassJavadoc GLU * +ClassJavadoc GLU * Notes from the Reference Implementation for this class: +ClassJavadoc GLU * Thanks to the contributions of many individuals, this class is a +ClassJavadoc GLU * pure Java port of SGI's original C sources. All of the projection, +ClassJavadoc GLU * mipmap, scaling, and tessellation routines that are exposed are +ClassJavadoc GLU * compatible with the GLU 1.3 specification. The GLU NURBS routines +ClassJavadoc GLU * are not currently exposed. +ClassJavadoc GLU */ + +# +# We ignore most of the function declarations in glu.h because we +# provide a pure Java implementation of most of GLU. Currently the +# only reason we generate glue code for this class is to provide a +# fallback path to the C code for the mipmap routines in case of bugs +# with the Java port (although it has been pretty thoroughly debugged +# at this point). +# + +# +# ------------------------ +# Utility routines +# ------------------------ +# + +# These are implemented by pure Java +Ignore gluCheckExtension +Ignore gluErrorString +Ignore gluGetString + +# +# ------------------------ +# NURBS +# ------------------------ +# + +# +# !!!!!!!!!!!!! FIXME: +# Ignore these Nurbs things until we get other stuff working +# +Ignore gluBeginCurve +Ignore gluBeginSurface +Ignore gluBeginTrim +Ignore gluEndCurve +Ignore gluEndSurface +Ignore gluEndTrim +Ignore gluLoadSamplingMatrices +Ignore gluPwlCurve +Ignore gluNewNurbsRenderer +Ignore gluDeleteNurbsRenderer +Ignore gluNurbsProperty +Ignore gluGetNurbsProperty +Ignore gluNurbsCallback.* +Ignore gluNurbsCurve +Ignore gluNurbsSurface +Ignore GLU_NURB.+ +Ignore GLU_.*PARAMETRIC.+ +Ignore GLUnurbs + +# +# ------------------------ +# Tesselators +# ------------------------ +# + +# +# Ignore these methods; we must manually implement their C and Java code +# +Ignore gluBeginPolygon +Ignore gluTessCallback +Ignore gluDeleteTess +Ignore gluEndPolygon +Ignore gluGetTessProperty +Ignore gluNewTess +Ignore gluNextContour +Ignore gluTessBeginContour +Ignore gluTessBeginPolygon +Ignore gluTessEndContour +Ignore gluTessEndPolygon +Ignore gluTessNormal +Ignore gluTessProperty +Ignore gluTessVertex +Ignore gluTessCallback.* +Ignore GLUtesselator + +# +# ------------------------ +# Quadrics +# ------------------------ +# +# +# !!!!!!!!!!!!! FIXME: +# Ignore these Quadric things until we get other stuff working +# +Ignore gluQuadricCallback.* + +# Manually implement the GLU quadric functionality to mostly conform +# to the C APIs +Ignore GLUquadric +Ignore gluCylinder +Ignore gluDeleteQuadric +Ignore gluDisk +Ignore gluNewQuadric +Ignore gluPartialDisk +Ignore gluQuadricDrawStyle +Ignore gluQuadricNormals +Ignore gluQuadricOrientation +Ignore gluQuadricTexture +Ignore gluSphere + +# Ignore a few of the projection/unprojection APIs altogether because +# their signatures aren't specified correctly in the header file +Ignore gluProject +Ignore gluUnProject +Ignore gluUnProject4 + +# Manually implement the rest of the projection / unprojection APIs +Ignore gluOrtho2D +Ignore gluPerspective +Ignore gluLookAt +Ignore gluPickMatrix diff --git a/make/config/jogl/glu-gl2.cfg b/make/config/jogl/glu-gl2.cfg new file mode 100644 index 000000000..aec0c446a --- /dev/null +++ b/make/config/jogl/glu-gl2.cfg @@ -0,0 +1,80 @@ +# This .cfg file provides common options used among gl2 GLU glue code +# generated for Jogl on all platforms. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/gl2 + +Style ImplOnly +ImplPackage javax.media.opengl.glu.gl2 +ImplJavaClass GLUgl2 +ParentClass GLUgl2 GLU + +CustomCCode #if defined(WIN32) +CustomCCode #define WIN32_LEAN_AND_MEAN +CustomCCode #include <windows.h> +CustomCCode #undef WIN32_LEAN_AND_MEAN +CustomCCode +CustomCCode #include <stddef.h> +CustomCCode #elif defined(macosx) +CustomCCode #include <inttypes.h> +CustomCCode #include <jni.h> +CustomCCode #include </usr/include/machine/types.h> +CustomCCode #elif defined(linux) || defined(__sun) || defined(__FreeBSD__) || defined(_HPUX) +CustomCCode #include <inttypes.h> +CustomCCode #endif + +Include ../intptr.cfg + +EmitProcAddressTable true +ProcAddressTablePackage com.jogamp.opengl.impl.glu.gl2 +ProcAddressTableClassName GLUgl2ProcAddressTable +GetProcAddressTableExpr getGLUProcAddressTable() + +CustomCCode /* Include the OpenGL GLU header */ +CustomCCode #include <GL/glu.h> + +# Custom Java code for GLU class +IncludeAs CustomJavaCode GLUgl2 glu-CustomJavaCode-gl2.java + +# GLU needs access to the GLUtesselatorImpl class for GLUtesselator, +# to the Mipmap class for scaling and mipmap generation, +# and to the nurbs.* package for the NURBS functionality +Import com.jogamp.opengl.impl.glu.nurbs.* +Import java.security.* +Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver +Import com.jogamp.opengl.impl.glu.gl2.nurbs.* +Import com.jogamp.opengl.impl.glu.mipmap.Mipmap +Import com.jogamp.opengl.impl.glu.gl2.* +Import javax.media.opengl.GL2 +Import com.jogamp.opengl.impl.gl2.ProjectDouble + +# +# ------------------------ +# Mipmape +# ------------------------ +# +# Ignore the C versions of the mipmap code in the public interface and +# use GKW's Java port instead. The bindings to the C entry points are +# still being left in for now, but only for debugging purposes and the +# intent is to remove them in a future release. + +# Emit these entry points as private + +AccessControl gluBuild1DMipmapLevels PRIVATE +AccessControl gluBuild1DMipmaps PRIVATE +AccessControl gluBuild2DMipmapLevels PRIVATE +AccessControl gluBuild2DMipmaps PRIVATE +AccessControl gluBuild3DMipmapLevels PRIVATE +AccessControl gluBuild3DMipmaps PRIVATE +AccessControl gluScaleImage PRIVATE + +# Rename these methods in the implementing class + +RenameJavaMethod gluBuild1DMipmapLevels gluBuild1DMipmapLevelsC +RenameJavaMethod gluBuild1DMipmaps gluBuild1DMipmapsC +RenameJavaMethod gluBuild2DMipmapLevels gluBuild2DMipmapLevelsC +RenameJavaMethod gluBuild2DMipmaps gluBuild2DMipmapsC +RenameJavaMethod gluBuild3DMipmapLevels gluBuild3DMipmapLevelsC +RenameJavaMethod gluBuild3DMipmaps gluBuild3DMipmapsC +RenameJavaMethod gluScaleImage gluScaleImageC + +Include glu-common.cfg diff --git a/make/config/jogl/glu-gl2es1.cfg b/make/config/jogl/glu-gl2es1.cfg new file mode 100644 index 000000000..af89014f4 --- /dev/null +++ b/make/config/jogl/glu-gl2es1.cfg @@ -0,0 +1,26 @@ +# This .cfg file is used to generate the GLU implementation for OpenGL ES 1.0, +# where it is pure Java. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/gl2es1 + +Style ImplOnly +ImplPackage javax.media.opengl.glu.gl2es1 +ImplJavaClass GLUgl2es1 +ParentClass GLUgl2es1 GLU + +Ignore gluBuild1DMipmapLevels +Ignore gluBuild1DMipmaps +Ignore gluBuild2DMipmapLevels +Ignore gluBuild2DMipmaps +Ignore gluBuild3DMipmapLevels +Ignore gluBuild3DMipmaps +Ignore gluScaleImage + +# Custom Java code for GLU class +IncludeAs CustomJavaCode GLUgl2es1 glu-CustomJavaCode-gl2es1.java + +Import javax.media.opengl.GLES1 +Import com.jogamp.opengl.impl.glu.mipmap.Mipmap + + +Include glu-common.cfg diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c new file mode 100644 index 000000000..dec3f4583 --- /dev/null +++ b/make/config/jogl/glx-CustomCCode.c @@ -0,0 +1,167 @@ +#include <inttypes.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <GL/glx.h> +/* Linux headers don't work properly */ +#define __USE_GNU +#include <dlfcn.h> +#undef __USE_GNU + +/* HP-UX doesn't define RTLD_DEFAULT. */ +#if defined(_HPUX) && !defined(RTLD_DEFAULT) +#define RTLD_DEFAULT NULL +#endif + +/* 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_com_jogamp_opengl_impl_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_com_jogamp_opengl_impl_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_com_jogamp_opengl_impl_x11_glx_GLX: can't find %s\n", clazzNameByteBuffer); + (*env)->FatalError(env, clazzNameByteBuffer); + } + clazzByteBuffer = (jclass)(*env)->NewGlobalRef(env, c); + if(NULL==c) { + fprintf(stderr, "FatalError: Java_com_jogamp_opengl_impl_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_com_jogamp_opengl_impl_x11_glx_GLX:: can't create %s.%s %s\n", + clazzNameBuffers, + clazzNameBuffersStaticCstrName, clazzNameBuffersStaticCstrSignature); + (*env)->FatalError(env, clazzNameBuffersStaticCstrName); + } +} + +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.x11.glx.GLX + * Java method: XVisualInfo glXGetVisualFromFBConfig(long dpy, long config) + * C function: XVisualInfo * glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); + */ +JNIEXPORT jobject JNICALL +Java_com_jogamp_opengl_impl_x11_glx_GLX_dispatch_1glXGetVisualFromFBConfig(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jlong procAddress) { + 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); + XFree(_res); + + return jbyteCopy; +} + +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.x11.glx.GLX + * Java method: java.nio.LongBuffer 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_com_jogamp_opengl_impl_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; + GLXFBConfig * _res; + int count; + jobject jbyteSource; + jobject jbyteCopy; + ptr_glXChooseFBConfig = (_local_PFNGLXCHOOSEFBCONFIG) (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); + } + if (_res == NULL) return NULL; + + _initClazzAccess(env); + + jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(GLXFBConfig)); + jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource); + (*env)->DeleteLocalRef(env, jbyteSource); + XFree(_res); + + return jbyteCopy; +} + +/* Java->C glue code: + * Java package: com.jogamp.opengl.impl.x11.glx.GLX + * Java method: XVisualInfo glXChooseVisual(long dpy, int screen, java.nio.IntBuffer attribList) + * C function: XVisualInfo * glXChooseVisual(Display * dpy, int screen, int * attribList); + */ +JNIEXPORT jobject JNICALL +Java_com_jogamp_opengl_impl_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; + XVisualInfo * _res; + jobject jbyteSource; + jobject jbyteCopy; + ptr_glXChooseVisual = (_local_PFNGLXCHOOSEVISUAL) (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); + + (*env)->DeleteLocalRef(env, jbyteSource); + XFree(_res); + + return jbyteCopy; +} + diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java new file mode 100644 index 000000000..0c3693b8b --- /dev/null +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -0,0 +1,58 @@ + + /** 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) + { + final long __addr_ = glxProcAddressTable._addressof_glXGetVisualFromFBConfig; + if (__addr_ == 0) { + throw new GLException("Method \"glXGetVisualFromFBConfig\" not available"); + } + java.nio.ByteBuffer _res; + _res = dispatch_glXGetVisualFromFBConfig(dpy, config, __addr_); + if (_res == null) return null; + return XVisualInfo.create(_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) + { + final long __addr_ = glxProcAddressTable._addressof_glXChooseFBConfig; + if (__addr_ == 0) { + throw new GLException("Method \"glXGetVisualFromFBConfig\" 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_); + + if (_res == null) return null; + return PointerBuffer.wrap(_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); + + /** 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) + { + final long __addr_ = glxProcAddressTable._addressof_glXChooseVisual; + if (__addr_ == 0) { + 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_); + + if (_res == null) return null; + return XVisualInfo.create(_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); + diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg new file mode 100644 index 000000000..dee1d015f --- /dev/null +++ b/make/config/jogl/glx-x11.cfg @@ -0,0 +1,100 @@ +# This .cfg file is used to generate the interface to the GLX routines +# used internally by the X11GLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/X11 + +Package com.jogamp.opengl.impl.x11.glx +JavaClass GLX +Style AllStatic +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +GLHeader GL/glx.h +GLHeader GL/glxext.h + +ForceProcAddressGen __ALL__ +LocalProcAddressCallingConvention __ALL__ APIENTRY + +AllowNonGLExtensions true +EmitProcAddressTable true +ProcAddressTableClassName GLXProcAddressTable +GetProcAddressTableExpr glxProcAddressTable + +Import com.jogamp.nativewindow.impl.x11.* +Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver + +CustomJavaCode GLX private static GLXProcAddressTable glxProcAddressTable = new GLXProcAddressTable(new GLProcAddressResolver()); +CustomJavaCode GLX public static GLXProcAddressTable getGLXProcAddressTable() { return glxProcAddressTable; } + +IncludeAs CustomJavaCode GLX glx-CustomJavaCode.java +IncludeAs CustomCCode glx-CustomCCode.c + +ArgumentIsString XOpenDisplay 0 + +Opaque long GLXFBConfig + +Ignore glXCreateContextAttribsARB + +# +# We have manual code for the following (copying the return values) +Ignore glXGetVisualFromFBConfigSGIX +ManuallyImplement glXGetVisualFromFBConfig +ManuallyImplement glXChooseFBConfig +ManuallyImplement glXChooseVisual +ForceProcAddressGen glXGetVisualFromFBConfig +ForceProcAddressGen glXChooseFBConfig +ForceProcAddressGen glXChooseVisual + +# Ignore everything not in the GLX core (up through GLX 1.4) +# FIXME: this needs to be kept in sync with the stub headers more than usual +Ignore glXFreeContextEXT +Ignore glXGetContextIDEXT +Ignore glXGetCurrentDisplayEXT +Ignore glXImportContextEXT +Ignore glXQueryContextInfoEXT + +Ignore glXGetSyncValues +Ignore glXGetMscRate +Ignore glXSwapBuffersMsc +Ignore glXWaitForMsc +Ignore glXWaitForSbc + +# Ignore non-GLX GL routines and constants +Ignore ^GL_.+ +Ignore TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB +Ignore CLAMP_TO_EDGE_EXT +Ignore ^gl[^X].+ +Ignore ^X.+ +Ignore ^Visual.+ + +DropUniqVendorExtensions AMD +# We need GL_APPLE_float_pixels for our pbuffer implementation +# DropUniqVendorExtensions APPLE +DropUniqVendorExtensions ATI +DropUniqVendorExtensions HP +DropUniqVendorExtensions IBM +DropUniqVendorExtensions MESA +DropUniqVendorExtensions MESAX +DropUniqVendorExtensions NV +DropUniqVendorExtensions SGI +DropUniqVendorExtensions SGIS +DropUniqVendorExtensions SGIX +DropUniqVendorExtensions SUN +DropUniqVendorExtensions WIN + +# Ignore the SGI hyperpipe extension, which will require more GlueGen +# work to expose the pipeName fields in the various structs +Ignore GLXHyperpipeNetworkSGIX +Ignore GLXHyperpipeConfigSGIX +Ignore GLXPipeRect +Ignore GLXPipeRectLimits + +CustomJavaCode GLX protected static long glXGetProcAddress(long glXGetProcAddressHandle, java.lang.String procname) +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 } + diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg new file mode 100644 index 000000000..aeed3af4e --- /dev/null +++ b/make/config/jogl/glxext.cfg @@ -0,0 +1,135 @@ +# This .cfg file is used to generate the interface and implementing +# class for the GLX extensions. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/X11 + +Package com.jogamp.opengl.impl.x11.glx +Style InterfaceAndImpl +JavaClass GLXExt +ImplPackage com.jogamp.opengl.impl.x11.glx +ImplJavaClass GLXExtImpl + +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/opengl/impl/x11/glx/GLX.java +Include gl-common.cfg +Include gl-desktop.cfg + +GLHeader GL/glx.h +GLHeader GL/glxext.h + +EmitProcAddressTable true +ProcAddressTableClassName GLXExtProcAddressTable +GetProcAddressTableExpr _context.getGLXExtProcAddressTable() + +Import com.jogamp.nativewindow.impl.x11.* + +# Ignore everything that doesn't start with glX or GLX +IgnoreNot ^(glX|GLX).+ + +Include gl-headers.cfg +Include ../intptr.cfg + +CustomCCode /* Provide Windows typedefs */ +CustomCCode typedef void* LPVOID; +CustomCCode typedef unsigned int* PUINT; + +CustomJavaCode GLXExt public boolean isFunctionAvailable(String glFunctionName); +CustomJavaCode GLXExt public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode GLXExtImpl public GLXExtImpl(X11GLXContext context) { +CustomJavaCode GLXExtImpl this._context = context; +CustomJavaCode GLXExtImpl } + +CustomJavaCode GLXExtImpl public boolean isFunctionAvailable(String glFunctionName) +CustomJavaCode GLXExtImpl { +CustomJavaCode GLXExtImpl return _context.isFunctionAvailable(glFunctionName); +CustomJavaCode GLXExtImpl } + +CustomJavaCode GLXExtImpl public boolean isExtensionAvailable(String glExtensionName) +CustomJavaCode GLXExtImpl { +CustomJavaCode GLXExtImpl return _context.isExtensionAvailable(glExtensionName); +CustomJavaCode GLXExtImpl } + +CustomJavaCode GLXExtImpl private X11GLXContext _context; + + +# These Ignores cause the core GLX routines to be ignored from the +# GLXExt interface and GLXExtImpl implementing class. +Ignore glXGetVisualFromFBConfig +Ignore glXGetVisualFromFBConfigSGIX +Ignore glXChooseFBConfig +Ignore glXChooseVisual +Ignore glXCreateContext +Ignore glXDestroyContext +Ignore glXMakeCurrent +Ignore glXCopyContext +Ignore glXSwapBuffers +Ignore glXCreateGLXPixmap +Ignore glXDestroyGLXPixmap +Ignore glXQueryExtension +Ignore glXQueryVersion +Ignore glXIsDirect +Ignore glXGetConfig +Ignore glXGetCurrentContext +Ignore glXGetCurrentDrawable +Ignore glXWaitGL +Ignore glXWaitX +Ignore glXUseXFont +Ignore glXQueryExtensionsString +Ignore glXQueryServerString +Ignore glXGetClientString +Ignore glXGetCurrentDisplay +Ignore glXChooseFBConfig +Ignore glXGetFBConfigAttrib +Ignore glXGetFBConfigs +Ignore glXGetVisualFromFBConfig +Ignore glXCreateWindow +Ignore glXDestroyWindow +Ignore glXCreatePixmap +Ignore glXDestroyPixmap +Ignore glXCreatePbuffer +Ignore glXDestroyPbuffer +Ignore glXQueryDrawable +Ignore glXCreateNewContext +Ignore glXMakeContextCurrent +Ignore glXGetCurrentReadDrawable +Ignore glXQueryContext +Ignore glXSelectEvent +Ignore glXGetSelectedEvent + +# Ignore a few extensions that bring in data types we don't want to +# expose in the public API (and that are useless anyway without +# exposing more of the implementation) +Ignore glXGetFBConfigAttribSGIX +Ignore glXChooseFBConfigSGIX +Ignore glXCreateGLXPixmapWithConfigSGIX +Ignore glXCreateContextWithConfigSGIX +Ignore glXGetVisualFromFBConfigSGIX +Ignore glXGetFBConfigFromVisualSGIX +Ignore glXCreateGLXPbufferSGIX +Ignore glXDestroyGLXPbufferSGIX +Ignore glXQueryGLXPbufferSGIX +Ignore glXSelectEventSGIX +Ignore glXGetSelectedEventSGIX +Ignore glXCreateGLXPixmapMESA + +Opaque long GLXFBConfig + +# Now we can ignore the GLXFBConfig and XVisualInfo data types +# Ignore GLXFBConfig +Ignore XVisualInfo + +# Ignore the SGI hyperpipe extension, which will require more GlueGen +# work to expose the pipeName fields in the various structs +Ignore glXQueryHyperpipeNetworkSGIX +Ignore glXHyperpipeConfigSGIX +Ignore glXQueryHyperpipeConfigSGIX +Ignore glXDestroyHyperpipeConfigSGIX +Ignore glXBindHyperpipeSGIX +Ignore glXQueryHyperpipeBestAttribSGIX +Ignore glXHyperpipeAttribSGIX +Ignore glXQueryHyperpipeAttribSGIX +Ignore GLXHyperpipeNetworkSGIX +Ignore GLXHyperpipeConfigSGIX +Ignore GLXPipeRect +Ignore GLXPipeRectLimits + diff --git a/make/config/jogl/make-glextension-depignore.sh b/make/config/jogl/make-glextension-depignore.sh new file mode 100644 index 000000000..98db66a84 --- /dev/null +++ b/make/config/jogl/make-glextension-depignore.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +thisdir=`pwd` +registry=/data/docs/ComputerIT/3D_AV_GFX/gl/registry/specs +classdirpos=9 +dirdep=$thisdir/tmp_glext_dep + +gl3ignores=$thisdir/gl-if-gl3-ignores.cfg +gl4ignores=$thisdir/gl-if-gl4-ignores.cfg + +rm -rf $dirdep +mkdir -p $dirdep + +cd $registry + +# We allow OpenGL 3.0 within GL2 +grep -RIl "^[ \t]*OpenGL 3\.[1234] is required" . > $dirdep/ext-req-3_x.txt +grep -RIl "^[ \t]*OpenGL 3\.[1234] and GLSL .* are required" . >> $dirdep/ext-req-3_x.txt +grep -RIl "^[ \t]*OpenGL 4\.. is required" . > $dirdep/ext-req-4_x.txt +grep -RIl "^[ \t]*OpenGL 4\.. and GLSL .* are required" . >> $dirdep/ext-req-4_x.txt + +cd $thisdir + +function dump_ignore_ext() { + infile=$1 + for i in `cat $infile` ; do + class=`echo $i | awk -F '/' ' { print \$2 } ' ` + extname="GL_"$class"_"`basename $i .txt` + echo IgnoreExtension $extname + done +} + +function dump_ignore_header() { + echo "#" + echo "# Generated Configuration File" + echo "# Use make-glextension-depignore.sh to update!" + echo "#" + echo +} + +function dump_ignore_ext_gl3() { + echo "#" + echo "# OpenGL 3.x dependencies" + echo "#" + echo "# We allow GL_VERSION_3_0 within GL2" + echo "IgnoreExtension GL_VERSION_3_1" + echo "IgnoreExtension GL_VERSION_3_2" + echo "IgnoreExtension GL_VERSION_3_3" + echo "IgnoreExtension GL_VERSION_3_4" + dump_ignore_ext $dirdep/ext-req-3_x.txt + echo +} + +function dump_ignore_ext_gl4() { + echo "#" + echo "# OpenGL 4.x dependencies" + echo "#" + echo "IgnoreExtension GL_VERSION_4_0" + echo "IgnoreExtension GL_VERSION_4_1" + echo "IgnoreExtension GL_VERSION_4_2" + dump_ignore_ext $dirdep/ext-req-4_x.txt + echo +} + +dump_ignore_header > $gl3ignores +dump_ignore_ext_gl3 >> $gl3ignores + +dump_ignore_header > $gl4ignores +dump_ignore_ext_gl4 >> $gl4ignores + diff --git a/make/config/jogl/nsig.cfg b/make/config/jogl/nsig.cfg new file mode 100644 index 000000000..404746cc3 --- /dev/null +++ b/make/config/jogl/nsig.cfg @@ -0,0 +1,22 @@ +# The NativeSignatureEmitter can not yet handle some constructs +Ignore glColorPointerListIBM +Ignore glColorPointervINTEL +Ignore glEdgeFlagPointerListIBM +Ignore glFogCoordPointerListIBM +Ignore glIndexPointerListIBM +Ignore glMultiDrawElements +Ignore glMultiDrawElementsEXT +Ignore glMultiModeDrawElementsIBM +Ignore glNormalPointerListIBM +Ignore glNormalPointervINTEL +Ignore glReplacementCodePointerSUN +Ignore glSecondaryColorPointerListIBM +Ignore glTexCoordPointerListIBM +Ignore glTexCoordPointervINTEL +Ignore glVertexPointerListIBM +Ignore glVertexPointervINTEL +Ignore glShaderSource +Ignore glShaderSourceARB +Ignore glGetSeparableFilter +Ignore glGetSeparableFilterEXT +Ignore glGetShaderSourceARB diff --git a/make/config/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg new file mode 100644 index 000000000..97938a853 --- /dev/null +++ b/make/config/jogl/wgl-win32.cfg @@ -0,0 +1,64 @@ +# This .cfg file is used to generate the interface to the wgl routines +# used internally by the WindowsGLContext implementation. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/Windows + +Package com.jogamp.opengl.impl.windows.wgl +JavaClass WGL +Style AllStatic +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +GLHeader wingdi.h +GLHeader GL/wglext.h + +ForceProcAddressGen __ALL__ +LocalProcAddressCallingConvention __ALL__ APIENTRY + +AllowNonGLExtensions true +EmitProcAddressTable true +ProcAddressTableClassName WGLProcAddressTable +GetProcAddressTableExpr wglProcAddressTable + +Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver + +CustomJavaCode WGL private static WGLProcAddressTable wglProcAddressTable = new WGLProcAddressTable(new GLProcAddressResolver()); +CustomJavaCode WGL public static WGLProcAddressTable getWGLProcAddressTable() { return wglProcAddressTable; } + +# Implement the first argument to wglGetProcAddress as String instead +# of byte[] +ArgumentIsString wglGetProcAddress 0 + +CustomCCode #define WIN32_LEAN_AND_MEAN +CustomCCode #include <windows.h> +CustomCCode #undef WIN32_LEAN_AND_MEAN + +CustomCCode #include <wingdi.h> +CustomCCode #include <stddef.h> + +Include ../intptr.cfg + +DropUniqVendorExtensions AMD +# We need GL_APPLE_float_pixels for our pbuffer implementation +# DropUniqVendorExtensions APPLE +DropUniqVendorExtensions ATI +DropUniqVendorExtensions HP +DropUniqVendorExtensions IBM +DropUniqVendorExtensions MESA +DropUniqVendorExtensions MESAX +DropUniqVendorExtensions NV +DropUniqVendorExtensions SGI +DropUniqVendorExtensions SGIS +DropUniqVendorExtensions SGIX +DropUniqVendorExtensions SUN +DropUniqVendorExtensions WIN + +CustomJavaCode WGL protected static long wglGetProcAddress(long wglGetProcAddressHandle, java.lang.String procname) +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 } + diff --git a/make/config/jogl/wglext.cfg b/make/config/jogl/wglext.cfg new file mode 100644 index 000000000..aca757b1c --- /dev/null +++ b/make/config/jogl/wglext.cfg @@ -0,0 +1,59 @@ +# This .cfg file is used to generate the interface and implementing +# class for the WGL extensions. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/Windows + +Package com.jogamp.opengl.impl.windows.wgl +Style InterfaceAndImpl +JavaClass WGLExt +ImplPackage com.jogamp.opengl.impl.windows.wgl +ImplJavaClass WGLExtImpl +Include gl-common.cfg +Include gl-desktop.cfg + +AllowNonGLExtensions true + +GLHeader wingdi.h +GLHeader GL/wglext.h + +EmitProcAddressTable true +ProcAddressTableClassName WGLExtProcAddressTable +GetProcAddressTableExpr _context.getWGLExtProcAddressTable() + +# Ignore everything that doesn't start with wgl or WGL +Ignore GL_.+ +Ignore gl.+ + +Include gl-headers.cfg +Include ../intptr.cfg + +# FIXME: for the time being, ignore all extensions requiring the +# presence of java.nio.LongBuffer because it doesn't exist on CDC/FP + +# JSR-239 NIO subset (remove once we have Java SE classes running on CVM) +# Inform the glue code generator of the association between #defines +# and functions and the extensions in which they are defined +GLHeader GL/wglext.h +IgnoreExtension WGL_OML_sync_control +IgnoreExtension WGL_NV_gpu_affinity + +IgnoreExtension WGL_EXT_make_current_read +RenameExtensionIntoCore WGL_ARB_make_current_read + +CustomJavaCode WGLExt public boolean isFunctionAvailable(String glFunctionName); +CustomJavaCode WGLExt public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode WGLExtImpl public WGLExtImpl(WindowsWGLContext context) { +CustomJavaCode WGLExtImpl this._context = context; +CustomJavaCode WGLExtImpl } + +CustomJavaCode WGLExtImpl public boolean isFunctionAvailable(String glFunctionName) +CustomJavaCode WGLExtImpl { +CustomJavaCode WGLExtImpl return _context.isFunctionAvailable(glFunctionName); +CustomJavaCode WGLExtImpl } + +CustomJavaCode WGLExtImpl public boolean isExtensionAvailable(String glExtensionName) +CustomJavaCode WGLExtImpl { +CustomJavaCode WGLExtImpl return _context.isExtensionAvailable(glExtensionName); +CustomJavaCode WGLExtImpl } + +CustomJavaCode WGLExtImpl private WindowsWGLContext _context; |