diff options
author | Sven Gothel <[email protected]> | 2009-03-16 14:38:27 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-16 14:38:27 +0000 |
commit | 24fcece997ba911b0270033a357bbd83258d4f1a (patch) | |
tree | 4d01034154734897724d6a3b7738bf22693a8d36 /make/config | |
parent | 9517d52c18bfa93d78e03f4c212757eda421afb6 (diff) |
JOGL refactoring:
Refactored JOGL into 3 independent components.
1 NWI - Native windowing interface
Abstracts the the general NativeWindow interface and it's factory,
incl the basic JAWT and Xlib toolkit.
The latter was motivated to clean up the JOGL workspace,
and to allow other to reuse this part.
The generic core is nwi.core.jar, the AWT add-on is nwi.awt.jar.
2 JOGL - The OpenGL mapping
Further cleanup of the SPEC.
All non OpenGL toolkits are relocated to NWI and NEWT.
There is still openmax and the windows audio layer ..
Another cleanup of the fixed function pipeline emulation.
Moved utilities and implementations where they belong ..
Removed GLUnsupportedException.
Misc .. changes
3 NEWT - The new windowing toolkit
The generic NEWT, newt.core.jar.
The JOGL and AWT modules are seperate, newt.ogl.jar newt.awt.jar.
Their build can be switched off.
The modules source and builds resides in their own directory.
Because of their nature, they share the stub_includes, etc.
Each module has it's own ant build script
- build-nwi.xml
- build-jogl.xml
- build-newt.xml
They can be build at once using build.xml as ususal,
which just invokes the seperate build tasks.
if rootrel.build=build, then the build location is
jogl/build-nwi
jogl/build-jogl
jogl/build-newt
and the sources are under
jogl/src/nwi
jogl/src/jogl
jogl/src/newt
Tested: jogl-demos, d4; Linux, MacOsX; Nvidia
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1868 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make/config')
57 files changed, 7461 insertions, 0 deletions
diff --git a/make/config/intptr.cfg b/make/config/intptr.cfg new file mode 100755 index 000000000..c946e4851 --- /dev/null +++ b/make/config/intptr.cfg @@ -0,0 +1,17 @@ +CustomCCode #ifdef _WIN32 +CustomCCode #ifdef _MSC_VER +CustomCCode /* This typedef is apparently needed for Microsoft compilers before VC8, +CustomCCode and on Windows CE */ +CustomCCode #if (_MSC_VER < 1400) || defined(UNDER_CE) +CustomCCode #ifdef _WIN64 +CustomCCode typedef long long intptr_t; +CustomCCode #else +CustomCCode typedef int intptr_t; +CustomCCode #endif +CustomCCode #endif +CustomCCode #else +CustomCCode #include <inttypes.h> +CustomCCode #endif +CustomCCode #else +CustomCCode #include <inttypes.h> +CustomCCode #endif diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java new file mode 100755 index 000000000..1f109d9f6 --- /dev/null +++ b/make/config/jogl/cg-common-CustomJavaCode.java @@ -0,0 +1,29 @@ +static { + com.sun.opengl.impl.NativeLibLoader.loadCgImpl(); +} + +/** 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..9b8dba079 --- /dev/null +++ b/make/config/jogl/cg-common.cfg @@ -0,0 +1,118 @@ +# This .cfg file provides common options used among all Cg glue code +# generated for Jogl on all platforms. +Package com.sun.opengl.cg +JavaClass CgGL +Style AllStatic +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl_cg +HierarchicalNativeOutput false + +# +# 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 + +# +# Need to import New IO for Buffer classes +# +Import java.nio.* +# And NativeLibLoader for help loading the native libraries +Import com.sun.opengl.impl.* + +# +# 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> + +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..780afcf5b --- /dev/null +++ b/make/config/jogl/cgl-macosx.cfg @@ -0,0 +1,41 @@ +# 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.sun.opengl.impl.macosx.cgl +JavaClass CGL +Style allstatic +Include gl-common-gl2.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +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 100755 index 000000000..4000ecb2b --- /dev/null +++ b/make/config/jogl/cglext.cfg @@ -0,0 +1,44 @@ +# 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.sun.opengl.impl.macosx.cgl +Style InterfaceAndImpl +JavaClass CGLExt +ImplPackage com.sun.opengl.impl.macosx.cgl +ImplJavaClass CGLExtImpl +Include gl-common-gl2.cfg +Include gl-desktop.cfg + +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.cfg b/make/config/jogl/egl.cfg new file mode 100755 index 000000000..6457ab21a --- /dev/null +++ b/make/config/jogl/egl.cfg @@ -0,0 +1,70 @@ +# 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.sun.opengl.impl.egl +JavaClass EGL +Style allstatic +# Shouldn't matter which one of these we pick up + +HierarchicalNativeOutput false +Include gl-common.cfg + +# Use a ProcAddressTable so we dynamically look up the routines +EmitProcAddressTable true +ProcAddressTableClassName EGLProcAddressTable +GetProcAddressTableExpr _table + +# Translate EGLBoolean as Java boolean +Opaque boolean EGLBoolean + +# Implement the first argument to eglGetProcAddress as String instead +# of byte[] +ArgumentIsString eglGetProcAddress 0 +ReturnsString eglQueryString + +# Make eglGetProcAddress return an opaque long +Opaque long __EGLFuncPtr + +# 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__ + +# Treat all of the EGL types as opaque longs +Opaque long EGLContext +Opaque long EGLDisplay +Opaque long EGLSurface +Opaque long EGLNativeDisplayType +Opaque long EGLNativeWindowType +Opaque long EGLNativePixmapType +Opaque long EGLClientBuffer + +CustomCCode #include <EGL/egl.h> + +Include ../intptr.cfg + +CustomJavaCode EGL private static EGLProcAddressTable _table = new EGLProcAddressTable(); +CustomJavaCode EGL public static void resetProcAddressTable(DynamicLookupHelper lookup) { +CustomJavaCode EGL GLProcAddressHelper.resetProcAddressTable(_table, 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_eglGetProcAddress0(procname, eglGetProcAddressHandle); +CustomJavaCode EGL } + + +Import com.sun.gluegen.runtime.opengl.GLProcAddressHelper diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg new file mode 100755 index 000000000..bdd9a3655 --- /dev/null +++ b/make/config/jogl/eglext.cfg @@ -0,0 +1,126 @@ +# 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.sun.opengl.impl.egl +Style InterfaceAndImpl +JavaClass EGLExt +ImplPackage com.sun.opengl.impl.egl +ImplJavaClass EGLExtImpl +# Shouldn't matter which one of these we pick up + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/com/sun/opengl/impl/egl/EGL.java +HierarchicalNativeOutput false +Include gl-common.cfg + +# Use a ProcAddressTable so we dynamically look up the routines +EmitProcAddressTable true +ProcAddressTableClassName EGLExtProcAddressTable +GetProcAddressTableExpr _context.getEGLExtProcAddressTable() + +# Translate EGLBoolean as Java boolean +Opaque boolean EGLBoolean + +# Implement the first argument to eglGetProcAddress as String instead +# of byte[] +ArgumentIsString eglGetProcAddress 0 +ReturnsString eglQueryString + +# Make eglGetProcAddress return an opaque long +Opaque long __EGLFuncPtr + +# 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 + +# 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 long EGLClientBuffer + +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/eglext.h> + +Include ../intptr.cfg + +# There are some #defines in eglext.h that GlueGen and PCPP don't currently handle +CustomJavaCode EGLExt public static final long EGL_NO_IMAGE = 0; +CustomJavaCode EGLExt public static final long EGL_NO_PERFMONITOR = 0; +CustomJavaCode EGLExt public static final long EGL_DEFAULT_PERFMARKER = 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; + +# These Ignores cause the core EGL routines to be ignored from the +# EGLExt interface and EGLExtImpl implementing class. +Ignore eglBindAPI +Ignore eglBindTexImage +Ignore eglChooseConfig +Ignore eglCopyBuffers +Ignore eglCreateContext +Ignore eglCreatePbufferFromClientBuffer +Ignore eglCreatePbufferSurface +Ignore eglCreatePixmapSurface +Ignore eglCreateWindowSurface +Ignore eglDestroyContext +Ignore eglDestroySurface +Ignore eglGetConfigAttrib +Ignore eglGetConfigs +Ignore eglGetCurrentContext +Ignore eglGetCurrentDisplay +Ignore eglGetCurrentSurface +Ignore eglGetDisplay +Ignore eglGetError +Ignore eglGetProcAddress +Ignore eglInitialize +Ignore eglMakeCurrent +Ignore eglQueryAPI +Ignore eglQueryContext +Ignore eglQueryString +Ignore eglQuerySurface +Ignore eglReleaseTexImage +Ignore eglReleaseThread +Ignore eglSurfaceAttrib +Ignore eglSwapBuffers +Ignore eglSwapInterval +Ignore eglTerminate +Ignore eglWaitClient +Ignore eglWaitGL +Ignore eglWaitNative diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg new file mode 100644 index 000000000..5b1d57fb0 --- /dev/null +++ b/make/config/jogl/gl-common-extensions.cfg @@ -0,0 +1,64 @@ + +DropUniqVendorExtensions 3DFX +DropUniqVendorExtensions AMD +DropUniqVendorExtensions APPLE +DropUniqVendorExtensions ATI +DropUniqVendorExtensions HP +DropUniqVendorExtensions IBM +DropUniqVendorExtensions MESA +DropUniqVendorExtensions MESAX +DropUniqVendorExtensions NV +DropUniqVendorExtensions SGI +DropUniqVendorExtensions SGIS +DropUniqVendorExtensions SGIX +DropUniqVendorExtensions SUN +DropUniqVendorExtensions WIN + + +# Enums handled by base GL class +Ignore GL_FRAMEBUFFER_EXT +Ignore GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT +Ignore GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT +Ignore GL_FRAMEBUFFER_COMPLETE_EXT +Ignore GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT +Ignore GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT +Ignore GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT +Ignore GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT +Ignore GL_FRAMEBUFFER_UNSUPPORTED_EXT +Ignore GL_FRAMEBUFFER_BINDING_EXT +Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT +Ignore GL_INVALID_FRAMEBUFFER_OPERATION_EXT +Ignore GL_COLOR_ATTACHMENT0_EXT +Ignore GL_DEPTH_ATTACHMENT_EXT +Ignore GL_STENCIL_ATTACHMENT_EXT +Ignore GL_RENDERBUFFER_EXT +Ignore GL_RENDERBUFFER_ALPHA_SIZE_EXT +Ignore GL_RENDERBUFFER_BINDING_EXT +Ignore GL_RENDERBUFFER_BLUE_SIZE_EXT +Ignore GL_RENDERBUFFER_DEPTH_SIZE_EXT +Ignore GL_RENDERBUFFER_GREEN_SIZE_EXT +Ignore GL_RENDERBUFFER_HEIGHT_EXT +Ignore GL_RENDERBUFFER_INTERNAL_FORMAT_EXT +Ignore GL_RENDERBUFFER_RED_SIZE_EXT +Ignore GL_RENDERBUFFER_STENCIL_SIZE_EXT +Ignore GL_RENDERBUFFER_WIDTH_EXT +Ignore GL_MAX_RENDERBUFFER_SIZE_EXT + +# normalise extensions +RenameJavaMethod glBindFramebufferEXT glBindFramebuffer +RenameJavaMethod glBindRenderbufferEXT glBindRenderbuffer +RenameJavaMethod glCheckFramebufferStatusEXT glCheckFramebufferStatus +RenameJavaMethod glDeleteFramebuffersEXT glDeleteFramebuffers +RenameJavaMethod glDeleteRenderbuffersEXT glDeleteRenderbuffers +RenameJavaMethod glFramebufferRenderbufferEXT glFramebufferRenderbuffer +RenameJavaMethod glFramebufferTexture2DEXT glFramebufferTexture2D +RenameJavaMethod glGenerateMipmapEXT glGenerateMipmap +RenameJavaMethod glGenFramebuffersEXT glGenFramebuffers +RenameJavaMethod glGenRenderbuffersEXT glGenRenderbuffers +RenameJavaMethod glGetFramebufferAttachmentParameterivEXT glGetFramebufferAttachmentParameteriv +RenameJavaMethod glGetRenderbufferParameterivEXT glGetRenderbufferParameteriv +RenameJavaMethod glIsFramebufferEXT glIsFramebuffer +RenameJavaMethod glIsRenderbufferEXT glIsRenderbuffer +RenameJavaMethod glRenderbufferStorageEXT glRenderbufferStorage diff --git a/make/config/jogl/gl-common-gl2.cfg b/make/config/jogl/gl-common-gl2.cfg new file mode 100644 index 000000000..4d86d74cd --- /dev/null +++ b/make/config/jogl/gl-common-gl2.cfg @@ -0,0 +1,8 @@ +# This .cfg file provides common options used among all GL glue code +# generated for Jogl on Windows. + +HierarchicalNativeOutput false +Include gl-common.cfg + +# XID needs to be treated as a long for 32/64 bit compatibility +Opaque long XID diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg new file mode 100644 index 000000000..608aafad3 --- /dev/null +++ b/make/config/jogl/gl-common.cfg @@ -0,0 +1,580 @@ +# This .cfg file provides common options used among all glue code +# generated for Jogl on all platforms. + +# Raise GLException instead of RuntimeException in glue code +RuntimeExceptionType GLException +UnsupportedExceptionType GLException + +# Imports needed by all glue code +Import java.nio.* +Import java.util.* +Import javax.media.opengl.* +Import javax.media.opengl.sub.* +Import javax.media.opengl.sub.fixed.* +Import com.sun.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_.+ + +# There are a few routines we don't handle yet +Ignore glGetBufferPointerivNV +Ignore glGetBufferPointerv + +# Ignore GL functions that deal with explicit pointer values in such a +# way that we cannot implement the functionality in Java +Ignore glGetBufferPointerv +Ignore glGetPointerv +Ignore glGetPointervEXT +Ignore glGetTexParameterPointervAPPLE +Ignore glGetVertexAttribPointerv +Ignore glGetVertexAttribPointervNV +Ignore glTracePointerRangeMESA + +# Manually implement glMapBuffer as the size of the returned buffer +# can only be computed by calling another routine +ManuallyImplement glMapBuffer +ManuallyImplement glMapBufferOES + +# 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 + +# Don't output #defines of GL name strings as constants, because we +# don't need them java-side. +# Format of name strings is found at: +# http://oss.sgi.com/projects/ogl-sample/registry/doc/template.txt + +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_EXT_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_ARB_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_PGI_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SGI_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SGIS_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SGIX_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_MESA_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_HP_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_ATI_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_NV_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_IBM_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_WIN_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_REND_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_APPLE_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_INTEL_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_INGR_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SUN_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_SUNX_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_3DFX_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_OML_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_I3D_.+ +Ignore (GL|GLU|GLX|WGL|AGL|CGL)_S3_.+ +Ignore GL_KTX_buffer_region + +# 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 + +# 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 + +# 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 +# FIXME: is GL_EXT_paletted_texture also obsolete? +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 + +# 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 + +# +# Opaques and other directives for platform-independent routines +# + +Opaque boolean GLboolean +ReturnsString glGetString + +# 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} + +# 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 glLoadProgramNV 3 +ArgumentIsString glProgramString 3 +ArgumentIsString glProgramStringARB 3 +ArgumentIsString glProgramNamedParameter4fNV 2 +ArgumentIsString glProgramNamedParameter4dNV 2 +ArgumentIsString glProgramNamedParameter4fvNV 2 +ArgumentIsString glProgramNamedParameter4dvNV 2 +ArgumentIsString glGetProgramNamedParameterfvNV 2 +ArgumentIsString glGetProgramNamedParameterdvNV 2 +ArgumentIsString glShaderSource 2 +ArgumentIsString glShaderSourceARB 2 +ArgumentIsString glGetUniformLocation 1 +ArgumentIsString glGetUniformLocationARB 1 +ArgumentIsString glBindAttribLocation 2 +ArgumentIsString glBindAttribLocationARB 2 +ArgumentIsString glGetAttribLocation 1 +ArgumentIsString glGetAttribLocationARB 1 + +# +# 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 glPopClientAttrib bufferStateTracker.clearBufferObjectState(); +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 + +# Range check directives for various image-related routines +RangeCheckBytes glColorTable 5 imageSizeInBytes({3}, {4}, {2} , 1 , 1) +RangeCheckBytes glColorTableEXT 5 imageSizeInBytes({3}, {4}, {2} , 1 , 1) +RangeCheckBytes glConvolutionFilter1D 5 imageSizeInBytes({3}, {4}, {2} , 1 , 1) +RangeCheckBytes glConvolutionFilter2D 6 imageSizeInBytes({4}, {5}, {2} , {3} , 1) +RangeCheckBytes glDrawPixels 4 imageSizeInBytes({2}, {3}, {0} , {1} , 1) +RangeCheckBytes glReadPixels 6 imageSizeInBytes({4}, {5}, {2} , {3} , 1) +RangeCheckBytes glTexImage1D 7 imageSizeInBytes({5}, {6}, {3} , 1 , 1) +RangeCheckBytes glTexImage2D 8 imageSizeInBytes({6}, {7}, {3} , {4} , 1) +RangeCheckBytes glTexImage3D 9 imageSizeInBytes({7}, {8}, {3} , {4} , {5}) +RangeCheckBytes glTexSubImage1D 6 imageSizeInBytes({4}, {5}, {3} , 1 , 1) +RangeCheckBytes glTexSubImage2D 8 imageSizeInBytes({6}, {7}, {4} , {5} , 1) +RangeCheckBytes glTexSubImage3D 10 imageSizeInBytes({8}, {9}, {5} , {6} , {7}) +# Note we don't support glTexImage4DSGIS / glTexSubImage4DSGIS + +# Not simple to produce good range checks for these as we would need +# to query the pipeline to see the size of the returned data before +# fetching it +# RangeCheckBytes glGetTexImage + +# 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> The basic interface to OpenGL, providing access to core +ClassJavadoc GL * functionality up through the OpenGL 2.0 specification as well as +ClassJavadoc GL * all vendor extensions. </P> +ClassJavadoc GL * +ClassJavadoc GL * <P> While the APIs for vendor extensions are unconditionally +ClassJavadoc GL * exposed, the underlying functions may not be present. The method +ClassJavadoc GL * {@link #isFunctionAvailable} should be used to query the +ClassJavadoc GL * availability of any non-core function before it is used for the +ClassJavadoc GL * first time; for example, +ClassJavadoc GL * <code>gl.isFunctionAvailable("glProgramStringARB")</code>. On +ClassJavadoc GL * certain platforms (Windows in particular), the most "core" +ClassJavadoc GL * functionality is only OpenGL 1.1, so in theory any routines first +ClassJavadoc GL * exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor +ClassJavadoc GL * extensions should all be queried. Calling an unavailable function +ClassJavadoc GL * will cause a {@link GLException} to be raised. </P> +ClassJavadoc GL * +ClassJavadoc GL * {@link #isExtensionAvailable} may also be used to determine whether +ClassJavadoc GL * a specific extension is available before calling the routines or +ClassJavadoc GL * using the functionality it exposes: for example, +ClassJavadoc GL * <code>gl.isExtensionAvailable("GL_ARB_vertex_program");</code>. +ClassJavadoc GL * However, in this case it is up to the end user to know which +ClassJavadoc GL * routines or functionality are associated with which OpenGL +ClassJavadoc GL * extensions. It may also be used to test for the availability of a +ClassJavadoc GL * particular version of OpenGL: for example, +ClassJavadoc GL * <code>gl.isExtensionAvailable("GL_VERSION_1_5");</code>. +ClassJavadoc GL * +ClassJavadoc GL * <P> Exceptions to the window system extension naming rules: +ClassJavadoc GL * +ClassJavadoc GL * <UL> +ClassJavadoc GL * +ClassJavadoc GL * <LI> The memory allocators for the NVidia vertex_array_range (VAR) +ClassJavadoc GL * extension, in particular <code>wglAllocateMemoryNV</code> / +ClassJavadoc GL * <code>glXAllocateMemoryNV</code> and associated routines. {@link +ClassJavadoc GL * #glAllocateMemoryNV} has been provided for window system-independent +ClassJavadoc GL * access to VAR. {@link #isFunctionAvailable} will translate an argument +ClassJavadoc GL * of "glAllocateMemoryNV" or "glFreeMemoryNV" into the appropriate +ClassJavadoc GL * window system-specific name. </P> +ClassJavadoc GL * +ClassJavadoc GL * <LI> WGL_ARB_pbuffer, WGL_ARB_pixel_format, and other +ClassJavadoc GL * platform-specific pbuffer functionality; the availability of +ClassJavadoc GL * pbuffers can be queried on Windows, X11 and Mac OS X platforms by +ClassJavadoc GL * querying {@link #isExtensionAvailable} with an argument of +ClassJavadoc GL * "GL_ARB_pbuffer" or "GL_ARB_pixel_format". +ClassJavadoc GL * +ClassJavadoc GL * </UL> <P> +ClassJavadoc GL * +ClassJavadoc GL */ + +# Javadoc for the WGL class +ClassJavadoc WGL /** +ClassJavadoc WGL * Provides access to the Windows-specific OpenGL vendor extensions. +ClassJavadoc WGL * See {@link GL} 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 GL} 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 GL} 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 GL /** +CustomJavaCode GL * Returns true if the specified OpenGL core- or extension-function can be +CustomJavaCode GL * used successfully through this GL instance given the current host (OpenGL +CustomJavaCode GL * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P> +CustomJavaCode GL * By "successfully" we mean that the function is both <i>callable</i> +CustomJavaCode GL * on the machine running the program and <i>available</i> on the current +CustomJavaCode GL * display.<P> +CustomJavaCode GL * +CustomJavaCode GL * In order to call a function successfully, the function must be both +CustomJavaCode GL * <i>callable</i> on the machine running the program and <i>available</i> on +CustomJavaCode GL * the display device that is rendering the output (note: on non-networked, +CustomJavaCode GL * single-display machines these two conditions are identical; on networked and/or +CustomJavaCode GL * multi-display machines this becomes more complicated). These conditions are +CustomJavaCode GL * met if the function is either part of the core OpenGL version supported by +CustomJavaCode GL * both the host and display, or it is an OpenGL extension function that both +CustomJavaCode GL * the host and display support. <P> +CustomJavaCode GL * +CustomJavaCode GL * A GL function is <i>callable</i> if it is successfully linked at runtime, +CustomJavaCode GL * hence the GLContext must be made current at least once. +CustomJavaCode GL * +CustomJavaCode GL * @param glFunctionName the name of the OpenGL function (e.g., use +CustomJavaCode GL * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link +CustomJavaCode GL * #glBindRenderbuffer(int,int)} is available). +CustomJavaCode GL */ +CustomJavaCode GL public boolean isFunctionAvailable(String glFunctionName); + +CustomJavaCode GL /** +CustomJavaCode GL * Returns true if the specified OpenGL extension can be +CustomJavaCode GL * used successfully through this GL instance given the current host (OpenGL +CustomJavaCode GL * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P> +CustomJavaCode GL * +CustomJavaCode GL * @param glExtensionName the name of the OpenGL extension (e.g., +CustomJavaCode GL * "GL_ARB_vertex_program"). +CustomJavaCode GL */ +CustomJavaCode GL public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode GL /** +CustomJavaCode GL * Provides platform-independent access to the <code>wglAllocateMemoryNV</code> / +CustomJavaCode GL * <code>glXAllocateMemoryNV</code> extension. +CustomJavaCode GL */ +CustomJavaCode GL public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3); + +CustomJavaCode GL /** Provides a platform-independent way to specify the minimum swap +CustomJavaCode GL interval for buffer swaps. An argument of 0 disables +CustomJavaCode GL sync-to-vertical-refresh completely, while an argument of 1 +CustomJavaCode GL causes the application to wait until the next vertical refresh +CustomJavaCode GL until swapping buffers. The default, which is platform-specific, +CustomJavaCode GL is usually either 0 or 1. This function is not guaranteed to +CustomJavaCode GL have an effect, and in particular only affects heavyweight +CustomJavaCode GL onscreen components. */ +CustomJavaCode GL public void setSwapInterval(int interval); + +CustomJavaCode GL /** +CustomJavaCode GL * Returns an object through which platform-specific OpenGL extensions +CustomJavaCode GL * (WGL, GLX, etc.) may be accessed. The data type of the returned +CustomJavaCode GL * object and its associated capabilities are undefined. Most +CustomJavaCode GL * applications will never need to call this method. It is highly +CustomJavaCode GL * recommended that any applications which do call this method perform +CustomJavaCode GL * all accesses on the returned object reflectively to guard +CustomJavaCode GL * themselves against changes to the implementation. +CustomJavaCode GL */ +CustomJavaCode GL public Object getPlatformGLExtensions(); + +CustomJavaCode GL /** +CustomJavaCode GL * Returns an object providing access to the specified OpenGL +CustomJavaCode GL * extension. This is intended to provide a mechanism for vendors who +CustomJavaCode GL * which to provide access to new OpenGL extensions without changing +CustomJavaCode GL * the public API of the core package. For example, a user may request +CustomJavaCode GL * access to extension "GL_VENDOR_foo" and receive back an object +CustomJavaCode GL * which implements a vendor-specified interface which can call the +CustomJavaCode GL * OpenGL extension functions corresponding to that extension. It is +CustomJavaCode GL * up to the vendor to specify both the extension name and Java API +CustomJavaCode GL * for accessing it, including which class or interface contains the +CustomJavaCode GL * functions. +CustomJavaCode GL * +CustomJavaCode GL * <P> +CustomJavaCode GL * +CustomJavaCode GL * Note: it is the intent to add new extensions as quickly as possible +CustomJavaCode GL * to the core GL API. Therefore it is unlikely that most vendors will +CustomJavaCode GL * use this extension mechanism, but it is being provided for +CustomJavaCode GL * completeness. +CustomJavaCode GL */ +CustomJavaCode GL public Object getExtension(String extensionName); 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 100755 index 000000000..d6a610c59 --- /dev/null +++ b/make/config/jogl/gl-desktop.cfg @@ -0,0 +1,67 @@ +# 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 ** + +# +# 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 +# Implement the first argument to glXGetProcAddress as String instead +# of byte[] +ArgumentIsString glXGetProcAddress 0 +ArgumentIsString glXGetProcAddressARB 0 +ReturnsString glXQueryExtensionsString +ReturnsString glXQueryServerString +ReturnsString glXGetClientString +TemporaryCVariableDeclaration glXChooseFBConfig int count; +TemporaryCVariableAssignment glXChooseFBConfig count = _ptr3[0]; +ReturnValueCapacity glXChooseFBConfig count * sizeof(GLXFBConfig) +TemporaryCVariableDeclaration glXChooseFBConfigSGIX int count; +TemporaryCVariableAssignment glXChooseFBConfigSGIX count = _ptr3[0]; +ReturnValueCapacity glXChooseFBConfigSGIX count * sizeof(GLXFBConfig) +TemporaryCVariableDeclaration glXGetFBConfigs int count; +TemporaryCVariableAssignment glXGetFBConfigs count = _ptr2[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 100755 index 000000000..2b630ee70 --- /dev/null +++ b/make/config/jogl/gl-es1.cfg @@ -0,0 +1,87 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/es1 + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/GLObject.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLPointerIf.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLLightingIf.java + +# There are a few routines we don't handle yet +Ignore glGetBufferPointervOES +Package javax.media.opengl +Style InterfaceAndImpl +JavaClass GLES1 +Extends GLES1 GLObject +Extends GLES1 GL +Extends GLES1 GL2ES1 +Extends GLES1 GLMatrixIf +Extends GLES1 GLPointerIf +Extends GLES1 GLLightingIf +ImplPackage com.sun.opengl.impl.es1 +ImplJavaClass GLES1Impl +Implements GLES1Impl GLObject +Implements GLES1Impl GL +Implements GLES1Impl GL2ES1 +Implements GLES1Impl GLMatrixIf +Implements GLES1Impl GLPointerIf +Implements GLES1Impl GLLightingIf +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 + +# 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 + +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 CustomCCode gl-impl-CustomCCode-gles1.c + +Import javax.media.opengl.GLES1 +Import javax.media.opengl.GLES2 +Import javax.media.opengl.GL2 +Import javax.media.opengl.util.BufferUtil + diff --git a/make/config/jogl/gl-es2.cfg b/make/config/jogl/gl-es2.cfg new file mode 100755 index 000000000..669eabcf3 --- /dev/null +++ b/make/config/jogl/gl-es2.cfg @@ -0,0 +1,69 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/es2 + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/GLObject.java + +Package javax.media.opengl +Style InterfaceAndImpl +JavaClass GLES2 +Extends GLES2 GLObject +Extends GLES2 GL +Extends GLES2 GL2ES2 +ImplPackage com.sun.opengl.impl.es2 +ImplJavaClass GLES2Impl +Implements GLES2Impl GLObject +Implements GLES2Impl GL +Implements GLES2Impl GL2ES2 +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg + +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 + +# 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 + +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/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-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 javax.media.opengl.util.BufferUtil +Import java.io.PrintStream + diff --git a/make/config/jogl/gl-gl2.cfg b/make/config/jogl/gl-gl2.cfg new file mode 100644 index 000000000..76cb0573a --- /dev/null +++ b/make/config/jogl/gl-gl2.cfg @@ -0,0 +1,80 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/gl2 + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/GLObject.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLPointerIf.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLLightingIf.java + +Package javax.media.opengl +Style InterfaceAndImpl +JavaClass GL2 +Extends GL2 GLObject +Extends GL2 GL +Extends GL2 GL2ES1 +Extends GL2 GL2ES2 +Extends GL2 GLMatrixIf +Extends GL2 GLPointerIf +Extends GL2 GLLightingIf +ImplPackage com.sun.opengl.impl.gl2 +ImplJavaClass GL2Impl +Implements GL2Impl GLObject +Implements GL2Impl GL +Implements GL2Impl GL2ES1 +Implements GL2Impl GL2ES2 +Implements GL2Impl GLMatrixIf +Implements GL2Impl GLPointerIf +Implements GL2Impl GLLightingIf +Include gl-common-gl2.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +EmitProcAddressTable true +ProcAddressTableClassName GL2ProcAddressTable +GetProcAddressTableExpr ((GL2ProcAddressTable)_context.getGLProcAddressTable()) + +Ignore GL_STENCIL_INDEX1_EXT +Ignore GL_STENCIL_INDEX4_EXT +Ignore GL_STENCIL_INDEX8_EXT +Ignore GL_STENCIL_INDEX16_EXT + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +CustomJavaCode GL2 public static final int GL_STENCIL_INDEX16 = 0x8D49; +CustomJavaCode GL2 public static final int GL_RGBA_FLOAT32_APPLE = 0x8814; +CustomJavaCode GL2 public static final int GL_RGBA_FLOAT16_APPLE = 0x881A; +CustomJavaCode GL2 public boolean glIsPBOPackEnabled(); +CustomJavaCode GL2 public boolean glIsPBOUnpackEnabled(); + +CustomJavaCode GL2Impl public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { +CustomJavaCode GL2Impl glFrustum((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); } + +CustomJavaCode GL2Impl public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) { +CustomJavaCode GL2Impl glOrtho((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); } + +CustomJavaCode GL2Impl public void glClearDepthf(float depth) { +CustomJavaCode GL2Impl glClearDepth((double)depth); } + +CustomJavaCode GL2Impl public void glDepthRangef(float zNear, float zFar) { +CustomJavaCode GL2Impl glDepthRange((double)zNear, (double)zFar); } + +Include gl-headers.cfg +Include ../intptr.cfg + +IncludeAs CustomJavaCode GL2Impl gl-impl-CustomJavaCode-common.java +IncludeAs CustomJavaCode GL2Impl gl-impl-CustomJavaCode-gl2.java +IncludeAs CustomJavaCode GL2Impl gl-impl-CustomJavaCode-gl2_es2.java +IncludeAs CustomCCode gl-impl-CustomCCode-gl2.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 javax.media.opengl.util.BufferUtil +Import java.io.PrintStream diff --git a/make/config/jogl/gl-gl2es12.cfg b/make/config/jogl/gl-gl2es12.cfg new file mode 100644 index 000000000..2d0704577 --- /dev/null +++ b/make/config/jogl/gl-gl2es12.cfg @@ -0,0 +1,72 @@ +# This .cfg file is used to generate the GL interface and implementing class. +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl/gl2es12 + +ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java +ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java +ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/sub/GLObject.java +ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java +ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/sub/fixed/GLPointerIf.java +ExtendedInterfaceSymbolsOnly ../src/jogl/classes/javax/media/opengl/sub/fixed/GLLightingIf.java + +Package javax.media.opengl +Style InterfaceAndImpl +JavaClass GL2ES12 +Extends GL2ES12 GL +Extends GL2ES12 GL2ES1 +Extends GL2ES12 GL2ES2 +Extends GL2ES12 GLObject +Extends GL2ES12 GLMatrixIf +Extends GL2ES12 GLPointerIf +Extends GL2ES12 GLLightingIf +ImplPackage com.sun.opengl.impl.gl2es12 +ImplJavaClass GL2ES12Impl +Implements GL2ES12Impl GL +Implements GL2ES12Impl GL2ES1 +Implements GL2ES12Impl GL2ES2 +Implements GL2ES12Impl GLObject +Implements GL2ES12Impl GLMatrixIf +Implements GL2ES12Impl GLPointerIf +Implements GL2ES12Impl GLLightingIf + +Include gl-common-gl2.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +EmitProcAddressTable true +ProcAddressTableClassName GL2ES12ProcAddressTable +GetProcAddressTableExpr ((GL2ES12ProcAddressTable)_context.getGLProcAddressTable()) + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +CustomJavaCode GL2ES12 public static final int GL_STENCIL_INDEX16 = 0x8D49; +CustomJavaCode GL2ES12 public static final int GL_RGBA_FLOAT32_APPLE = 0x8814; +CustomJavaCode GL2ES12 public static final int GL_RGBA_FLOAT16_APPLE = 0x881A; + +CustomJavaCode GL2ES12Impl public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { +CustomJavaCode GL2ES12Impl glFrustum((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); } + +CustomJavaCode GL2ES12Impl public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) { +CustomJavaCode GL2ES12Impl glOrtho((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); } + +CustomJavaCode GL2ES12Impl public void glClearDepthf(float depth) { +CustomJavaCode GL2ES12Impl glClearDepth((double)depth); } + +CustomJavaCode GL2ES12Impl public void glDepthRangef(float zNear, float zFar) { +CustomJavaCode GL2ES12Impl glDepthRange((double)zNear, (double)zFar); } + +Include gl-headers.cfg +Include ../intptr.cfg + +IncludeAs CustomJavaCode GL2ES12Impl gl-impl-CustomJavaCode-common.java +IncludeAs CustomJavaCode GL2ES12Impl gl-impl-CustomJavaCode-gl2es12.java +IncludeAs CustomJavaCode GL2ES12Impl gl-impl-CustomJavaCode-gl2_es2.java +IncludeAs CustomCCode gl-impl-CustomCCode-gl2es12.c + +Import javax.media.opengl.GLES1 +Import javax.media.opengl.GLES2 +Import javax.media.opengl.GL2ES12 +Import javax.media.opengl.util.BufferUtil +Import java.io.PrintStream diff --git a/make/config/jogl/gl-headers.cfg b/make/config/jogl/gl-headers.cfg new file mode 100755 index 000000000..fc7dd440d --- /dev/null +++ b/make/config/jogl/gl-headers.cfg @@ -0,0 +1,47 @@ +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 GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "glext.h" are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES +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 /* 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 #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 GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +CustomCCode "glext.h" are parsed. */ +CustomCCode #define GL_GLEXT_PROTOTYPES +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 +CustomCCode /* Provide GLES #define for locally generated function pointer typedefs */ +CustomCCode #ifndef GL_APIENTRY +CustomCCode #define GL_APIENTRY GLAPIENTRY +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..840c8f61f --- /dev/null +++ b/make/config/jogl/gl-if-CustomJavaCode-gl.java @@ -0,0 +1,14 @@ + + public boolean matchesProfile(); + + public boolean matchesProfile(String test_profile); + + 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-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.cfg b/make/config/jogl/gl-if-gl.cfg new file mode 100755 index 000000000..110a6ee43 --- /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 GLObject + +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/GLObject.java + +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg +Include gl-ignore-gl2_es12-special.cfg + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +Import javax.media.opengl.GLES1 +Import javax.media.opengl.GLES2 +Import javax.media.opengl.GL2 + +# 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 + +# 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_es1.cfg b/make/config/jogl/gl-if-gl2_es1.cfg new file mode 100755 index 000000000..72e0dbcd3 --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es1.cfg @@ -0,0 +1,82 @@ +# This .cfg file is used to generate the GL interface and implementing class. +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2ES1 +Extends GL2ES1 GLObject +Extends GL2ES1 GL +Extends GL2ES1 GLMatrixIf +Extends GL2ES1 GLPointerIf +Extends GL2ES1 GLLightingIf + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/GLObject.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLPointerIf.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/fixed/GLLightingIf.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 to GL2 +Ignore glPointSizePointer +Ignore glGetFixedv +Ignore ^glDrawTex.* + +#heavy float/double array diff to GL2 +Ignore glClipPlanef +Ignore ^glGetClipPlanef(OES)? + +#impl diff +Ignore ^glEGL.* +Ignore ^gl.*(xv)(OES)? +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 +Ignore glLoadPaletteFromModelViewMatrix +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 + +# 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 100755 index 000000000..7e219a3fb --- /dev/null +++ b/make/config/jogl/gl-if-gl2_es2.cfg @@ -0,0 +1,64 @@ +# This .cfg file is used to generate the GL interface and implementing class. +Package javax.media.opengl +Style InterfaceOnly +JavaClass GL2ES2 +Extends GL2ES2 GLObject +Extends GL2ES2 GL + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java +ExtendedInterfaceSymbols ../src/jogl/classes/javax/media/opengl/sub/GLObject.java +HierarchicalNativeOutput false +Include gl-common.cfg +Include gl-common-extensions.cfg + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/jogl + +# Ignore all ES 2.X only stuff .. +# Ignore ^gl.*x(v)?(OES)? +Ignore glGetShaderPrecisionFormat +Ignore glEGL.* +#Ignore glFramebufferVertexAttribArrayNV +#Ignore glCoverageOperationNV +#Ignore glCoverageMaskNV + +CustomJavaCode GL2ES2 public void glClearDepth( double depth ); +CustomJavaCode GL2ES2 public void glDepthRange(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 GLES2/gl2.h +GLHeader GLES2/gl2ext.h + +# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums +TagNativeBinding true + +CustomJavaCode GL2ES2 public String glGetShaderInfoLog(int shaderObj); +CustomJavaCode GL2ES2 public String glGetProgramInfoLog(int programObj); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(int shaderObj, int name); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(int shaderObj, int name, PrintStream verboseOut); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(IntBuffer shaders, int name); +CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(IntBuffer shaders, int name, PrintStream verboseOut); +CustomJavaCode GL2ES2 public boolean glIsProgramStatusValid(int programObj, int name); +CustomJavaCode GL2ES2 public boolean glIsProgramValid(int programObj); +CustomJavaCode GL2ES2 public boolean glIsProgramValid(int programObj, PrintStream verboseOut); +CustomJavaCode GL2ES2 public boolean glShaderCompilerAvailable(); +CustomJavaCode GL2ES2 public void glShaderSource(int shader, java.lang.String[] source); +CustomJavaCode GL2ES2 public void glShaderSource(IntBuffer shaders, java.lang.String[][] sources); +CustomJavaCode GL2ES2 public Set glGetShaderBinaryFormats(); +CustomJavaCode GL2ES2 public void glShaderBinary(IntBuffer shaders, int binFormat, java.nio.Buffer bin); +CustomJavaCode GL2ES2 public void glCreateShader(int type, IntBuffer shaders); +CustomJavaCode GL2ES2 public void glCompileShader(IntBuffer shaders); +CustomJavaCode GL2ES2 public void glAttachShader(int program, IntBuffer shaders); +CustomJavaCode GL2ES2 public void glDetachShader(int program, IntBuffer shaders); +CustomJavaCode GL2ES2 public void glDeleteShader(IntBuffer shaders); +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-ignore-gl2_es12-special.cfg b/make/config/jogl/gl-ignore-gl2_es12-special.cfg new file mode 100644 index 000000000..1fa439702 --- /dev/null +++ b/make/config/jogl/gl-ignore-gl2_es12-special.cfg @@ -0,0 +1,523 @@ +# FIXME: some of these definitions like the ARB_imaging subset should end up in the GL interface +Ignore GL.+_NV +Ignore GL.+_ATI +Ignore GL.+_AMD +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 +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-impl-CustomCCode-gl2.c b/make/config/jogl/gl-impl-CustomCCode-gl2.c new file mode 100644 index 000000000..d6a051b36 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gl2.c @@ -0,0 +1,15 @@ +/* Java->C glue code: + * Java package: com.sun.opengl.impl.gl2.GL2Impl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_gl2_GL2Impl_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; +} + diff --git a/make/config/jogl/gl-impl-CustomCCode-gl2es12.c b/make/config/jogl/gl-impl-CustomCCode-gl2es12.c new file mode 100644 index 000000000..e056672d3 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gl2es12.c @@ -0,0 +1,15 @@ +/* Java->C glue code: + * Java package: com.sun.opengl.impl.gl2es12.GL2ES12Impl + * Java method: long dispatch_glMapBuffer(int target, int access) + * C function: void * glMapBuffer(GLenum target, GLenum access); + */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_gl2es12_GL2ES12Impl_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; +} + 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..ca5e0374c --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gles1.c @@ -0,0 +1,16 @@ +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +/* Java->C glue code: + * Java package: com.sun.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_sun_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; +} + 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..a138d88cc --- /dev/null +++ b/make/config/jogl/gl-impl-CustomCCode-gles2.c @@ -0,0 +1,16 @@ +typedef GLvoid* (GL_APIENTRY* PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +/* Java->C glue code: + * Java package: com.sun.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_sun_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; +} + 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..70413a630 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -0,0 +1,32 @@ + public final boolean matchesProfile() { + return matchesProfile(GLProfile.getProfile()); + } + + public final boolean matchesProfile(String test_profile) { + if(null==test_profile) { + return false; + } + if(test_profile.equals(GLProfile.GL2)) { + return isGL2(); + } + if(test_profile.equals(GLProfile.GLES1)) { + return isGLES1(); + } + if(test_profile.equals(GLProfile.GLES2)) { + return isGLES2(); + } + return false; + } + + public int glGetBoundBuffer(int target) { + return bufferStateTracker.getBoundBufferObject(target, this); + } + + public boolean glIsVBOArrayEnabled() { + return checkArrayVBOEnabled(false); + } + + public boolean glIsVBOElementEnabled() { + return checkElementVBOEnabled(false); + } + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2.java new file mode 100644 index 000000000..79df64d9f --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2.java @@ -0,0 +1,460 @@ +// 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 GL2Impl(GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); +} + +public final boolean isGL() { + return true; +} + +public final boolean isGL2() { + return true; +} + +public final boolean isGLES1() { + return false; +} + +public final boolean isGLES2() { + return false; +} + +public final boolean isGLES() { + return false; +} + +public final boolean isGL2ES1() { + return true; +} + +public final boolean isGL2ES2() { + return true; +} + +public final GL getGL() throws GLException { + return this; +} + +public final GL2 getGL2() throws GLException { + return this; +} + +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"); +} + +public final GL2ES1 getGL2ES1() throws GLException { + return this; +} + +public final GL2ES2 getGL2ES2() 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; + +/** + * 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); +} + +public void setSwapInterval(int interval) { + _context.setSwapInterval(interval); +} + +public Object getPlatformGLExtensions() { + return _context.getPlatformGLExtensions(); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is regrettably a lower bound as in certain + circumstances OpenGL state such as unpack alignment can cause more + data to be required. However this should be close enough that it + should catch most crashes. 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) { + 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 (elements * esize * w * h * d); +} + +private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker(); +private GLBufferSizeTracker bufferSizeTracker; + +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); +} + +// Attempt to return the same ByteBuffer object from glMapBuffer if +// the vertex buffer object's base address and size haven't changed +private static class ARBVBOKey { + private long addr; + private int capacity; + + ARBVBOKey(long addr, int capacity) { + this.addr = addr; + this.capacity = capacity; + } + + public int hashCode() { + return (int) addr; + } + + public boolean equals(Object o) { + if ((o == null) || (!(o instanceof ARBVBOKey))) { + return false; + } + + ARBVBOKey other = (ARBVBOKey) o; + return ((addr == other.addr) && (capacity == other.capacity)); + } +} + +private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = 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_ = ((GL2ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + if (__addr_ == 0) { + throw new GLException("Method \"glMapBuffer\" not available"); + } + int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, + target, + this); + long addr; + addr = dispatch_glMapBuffer(target, access, __addr_); + if (addr == 0 || sz == 0) { + return null; + } + ARBVBOKey key = new ARBVBOKey(addr, sz); + ByteBuffer _res = (ByteBuffer) arbVBOCache.get(key); + if (_res == null) { + _res = InternalBufferUtils.newDirectByteBuffer(addr, sz); + _res.order(ByteOrder.nativeOrder()); + arbVBOCache.put(key, _res); + } + _res.position(0); + return _res; +} + +/** 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); + + /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ + public void glShaderBinary(int n, java.nio.IntBuffer shaders, int binaryformat, java.nio.Buffer binary, int length) { + throw new GLException("Method \"glShaderBinary\" not available"); + } + + /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ + public void glShaderBinary(int n, int[] shaders, int shaders_offset, int binaryformat, java.nio.Buffer binary, int length) { + throw new GLException("Method \"glShaderBinary\" not available"); + } + + public void glReleaseShaderCompiler() { + // nothing to do + } + + 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-gl2_es2.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java new file mode 100644 index 000000000..9ddbf06fb --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2_es2.java @@ -0,0 +1,312 @@ + public String glGetShaderInfoLog(int shaderObj) { + int[] infoLogLength=new int[1]; + glGetShaderiv(shaderObj, GL_INFO_LOG_LENGTH, infoLogLength, 0); + + if(infoLogLength[0]==0) { + return "(InfoLog null)"; + } + int[] charsWritten=new int[1]; + byte[] infoLogBytes = new byte[infoLogLength[0]]; + glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); + + return new String(infoLogBytes, 0, charsWritten[0]); + } + + public String glGetProgramInfoLog(int programObj) { + int[] infoLogLength=new int[1]; + glGetProgramiv(programObj, GL_INFO_LOG_LENGTH, infoLogLength, 0); + + if(infoLogLength[0]==0) { + return "(InfoLog null)"; + } + int[] charsWritten=new int[1]; + byte[] infoLogBytes = new byte[infoLogLength[0]]; + glGetProgramInfoLog(programObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); + + return new String(infoLogBytes, 0, charsWritten[0]); + } + + public boolean glIsShaderStatusValid(int shaderObj, int name) { + return glIsShaderStatusValid(shaderObj, name, null); + } + public boolean glIsShaderStatusValid(int shaderObj, int name, PrintStream verboseOut) { + int[] ires = new int[1]; + glGetShaderiv(shaderObj, name, ires, 0); + + boolean res = ires[0]==1; + if(!res && null!=verboseOut) { + verboseOut.println("Shader status invalid: "+glGetShaderInfoLog(shaderObj)); + } + return res; + } + public boolean glIsShaderStatusValid(IntBuffer shaders, int name) { + return glIsShaderStatusValid(shaders, name, null); + } + public boolean glIsShaderStatusValid(IntBuffer shaders, int name, PrintStream verboseOut) { + boolean res = true; + shaders.rewind(); + while(shaders.hasRemaining()) { + res = glIsShaderStatusValid(shaders.get(), name, verboseOut) && res; + } + shaders.rewind(); + return res; + } + + public boolean glIsProgramStatusValid(int programObj, int name) { + int[] ires = new int[1]; + glGetProgramiv(programObj, name, ires, 0); + + return ires[0]==1; + } + + public boolean glIsProgramValid(int programObj) { + return glIsProgramValid(programObj, null); + } + public boolean glIsProgramValid(int programObj, PrintStream verboseOut) { + int[] ires = new int[1]; + if(!glIsProgram(programObj)) { + if(null!=verboseOut) { + verboseOut.println("Program name invalid: "+programObj); + } + return false; + } + if(!glIsProgramStatusValid(programObj, GL_LINK_STATUS)) { + if(null!=verboseOut) { + verboseOut.println("Program link failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + } + return false; + } + if ( !isGLES2() || glShaderCompilerAvailable() ) { + // failed on APX2500 (ES2.0, no compiler) for valid programs + glValidateProgram(programObj); + if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) { + if(null!=verboseOut) { + verboseOut.println("Program validation failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + } + return false; + } + } + return true; + } + + public void glCreateShader(int type, IntBuffer shaders) { + shaders.clear(); + while(shaders.hasRemaining()) { + shaders.put(glCreateShader(type)); + } + shaders.rewind(); + } + + private Boolean shaderCompilerAvailable = null; + private Set shaderBinaryFormats = null; + + public Set glGetShaderBinaryFormats() + { + if(null==shaderBinaryFormats) { + HashSet formatSet = new HashSet(); + + int[] param = new int[1]; + + glGetIntegerv(GL2ES2.GL_NUM_SHADER_BINARY_FORMATS, param, 0); + int numFormats = param[0]; + if(numFormats>0) { + int[] formats = new int[numFormats]; + glGetIntegerv(GL2ES2.GL_SHADER_BINARY_FORMATS, formats, 0); + shaderBinaryFormats = new HashSet(numFormats); + for(int i=0; i<numFormats; i++) { + shaderBinaryFormats.add(new Integer(formats[i])); + } + } else { + shaderBinaryFormats = new HashSet(0); + } + } + return shaderBinaryFormats; + } + + + public boolean glShaderCompilerAvailable() { + if(null==shaderCompilerAvailable) { + Set bfs = glGetShaderBinaryFormats(); + if(isGLES2()) { + byte[] param = new byte[1]; + glGetBooleanv(GL2ES2.GL_SHADER_COMPILER, param, 0); + boolean v = param[0]!=(byte)0x00; + if(!v && bfs.size()==0) { + // no supported binary formats, hence a compiler must be available! + v = true; + } + shaderCompilerAvailable = new Boolean(v); + } else if( isGL2() || isGL2ES2() ) { + shaderCompilerAvailable = new Boolean(true); + } else { + throw new GLException("invalid profile"); + } + } + return shaderCompilerAvailable.booleanValue(); + } + + public void glShaderSource(int shader, java.lang.String[] source) + { + if(!glShaderCompilerAvailable()) { + throw new GLException("no compiler is available"); + } + + int count = (null!=source)?source.length:0; + if(count<=0) { + throw new GLException("Method \"glShaderSource\" called with invalid length of source: "+count); + } + IntBuffer length = BufferUtil.newIntBuffer(count); + for(int i=0; i<count; i++) { + length.put(source[i].length()); + } + length.flip(); + glShaderSource(shader, count, source, length); + } + + public void glShaderSource(IntBuffer shaders, java.lang.String[][] sources) + { + int sourceNum = (null!=sources)?sources.length:0; + int shaderNum = (null!=shaders)?shaders.remaining():0; + if(shaderNum<=0 || sourceNum<=0 || shaderNum!=sourceNum) { + throw new GLException("Method \"glShaderSource\" called with invalid number of shaders and/or sources: shaders="+ + shaderNum+", sources="+sourceNum); + } + for(int i=0; i<sourceNum; i++) { + glShaderSource(shaders.get(i), sources[i]); + } + } + + public void glShaderBinary(IntBuffer shaders, int binFormat, java.nio.Buffer bin) + { + if(glGetShaderBinaryFormats().size()<=0) { + throw new GLException("no binary formats are supported"); + } + + int shaderNum = shaders.remaining(); + if(shaderNum<=0) { + throw new GLException("Method \"glShaderBinary\" called with shaders number <= 0"); + } + if(null==bin) { + throw new GLException("Method \"glShaderBinary\" without binary (null)"); + } + int binLength = bin.remaining(); + if(0>=binLength) { + throw new GLException("Method \"glShaderBinary\" without binary (remaining == 0)"); + } + glShaderBinary(shaderNum, shaders, binFormat, bin, binLength); + } + + public void glCompileShader(IntBuffer shaders) + { + shaders.rewind(); + while(shaders.hasRemaining()) { + glCompileShader(shaders.get()); + } + shaders.rewind(); + } + + public void glAttachShader(int program, IntBuffer shaders) + { + shaders.rewind(); + while(shaders.hasRemaining()) { + glAttachShader(program, shaders.get()); + } + shaders.rewind(); + } + + public void glDetachShader(int program, IntBuffer shaders) + { + shaders.rewind(); + while(shaders.hasRemaining()) { + glDetachShader(program, shaders.get()); + } + shaders.rewind(); + } + + public void glDeleteShader(IntBuffer shaders) { + shaders.rewind(); + while(shaders.hasRemaining()) { + glDeleteShader(shaders.get()); + } + shaders.clear(); + } + + 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"); + } + } + } + + public final String toString() { + StringBuffer buf = new StringBuffer(); + buf.append(getClass().getName()); + buf.append(" [GLSL compiler: "); + buf.append(glShaderCompilerAvailable()); + Set bfs = glGetShaderBinaryFormats(); + buf.append(", binary formats "); + buf.append(bfs.size()); + buf.append(":"); + for(Iterator iter=bfs.iterator(); iter.hasNext(); ) { + buf.append(" "); + buf.append(((Integer)(iter.next())).intValue()); + } + buf.append("]"); + return buf.toString(); + } + + diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java new file mode 100644 index 000000000..7edd95aea --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java @@ -0,0 +1,401 @@ +// 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 GL2ES12Impl(GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); +} + +public final boolean isGL() { + return false; +} + +public final boolean isGL2() { + return false; +} + +public final boolean isGLES1() { + return false; +} + +public final boolean isGLES2() { + return false; +} + +public final boolean isGLES() { + return false; +} + +public final boolean isGL2ES1() { + return true; +} + +public final boolean isGL2ES2() { + return true; +} + +public final GL getGL() throws GLException { + return this; +} + +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 { + throw new GLException("Not a GLES2 implementation"); +} + +public final GL2ES1 getGL2ES1() throws GLException { + return this; +} + +public final GL2ES2 getGL2ES2() 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; + +/** + * 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); +} + +public void setSwapInterval(int interval) { + _context.setSwapInterval(interval); +} + +public Object getPlatformGLExtensions() { + return _context.getPlatformGLExtensions(); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is regrettably a lower bound as in certain + circumstances OpenGL state such as unpack alignment can cause more + data to be required. However this should be close enough that it + should catch most crashes. 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) { + 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; + /* FIXME ?? + case GL_HILO_NV: + elements = 2; + 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 (elements * esize * w * h * d); +} + +private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker(); +private GLBufferSizeTracker bufferSizeTracker; + +private boolean bufferObjectExtensionsInitialized = false; +private boolean haveGL15; +private boolean haveGL21; +private boolean haveARBVertexBufferObject; + +private void initBufferObjectExtensionChecks() { + if (bufferObjectExtensionsInitialized) + return; + bufferObjectExtensionsInitialized = true; + 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) { + // 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; +} + +// Attempt to return the same ByteBuffer object from glMapBuffer if +// the vertex buffer object's base address and size haven't changed +private static class ARBVBOKey { + private long addr; + private int capacity; + + ARBVBOKey(long addr, int capacity) { + this.addr = addr; + this.capacity = capacity; + } + + public int hashCode() { + return (int) addr; + } + + public boolean equals(Object o) { + if ((o == null) || (!(o instanceof ARBVBOKey))) { + return false; + } + + ARBVBOKey other = (ARBVBOKey) o; + return ((addr == other.addr) && (capacity == other.capacity)); + } +} + +private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = 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_ = ((GL2ES12ProcAddressTable)_context.getGLProcAddressTable())._addressof_glMapBuffer; + if (__addr_ == 0) { + throw new GLException("Method \"glMapBuffer\" not available"); + } + int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, + target, + this); + long addr; + addr = dispatch_glMapBuffer(target, access, __addr_); + if (addr == 0 || sz == 0) { + return null; + } + ARBVBOKey key = new ARBVBOKey(addr, sz); + ByteBuffer _res = (ByteBuffer) arbVBOCache.get(key); + if (_res == null) { + _res = InternalBufferUtils.newDirectByteBuffer(addr, sz); + _res.order(ByteOrder.nativeOrder()); + arbVBOCache.put(key, _res); + } + _res.position(0); + return _res; +} + +/** 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); + + /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ + public void glShaderBinary(int n, java.nio.IntBuffer shaders, int binaryformat, java.nio.Buffer binary, int length) { + throw new GLException("Method \"glShaderBinary\" not available"); + } + + /** Dummy implementation for the ES 2.0 function: <br> <code> void {@native glShaderBinary}(GLint n, const GLuint * shaders, GLenum binaryformat, const void * binary, GLint length); </code> <br> Always throws a GLException! */ + public void glShaderBinary(int n, int[] shaders, int shaders_offset, int binaryformat, java.nio.Buffer binary, int length) { + throw new GLException("Method \"glShaderBinary\" not available"); + } + + public void glReleaseShaderCompiler() { + // nothing to do + } + + 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 100755 index 000000000..a10f8c5e0 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -0,0 +1,345 @@ +public GLES1Impl(GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); +} + +public final boolean isGL() { + return true; +} + +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 GL getGL() throws GLException { + return this; +} + +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 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; + +/** + * 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); +} + +public void setSwapInterval(int interval) { + _context.setSwapInterval(interval); +} + +public Object getPlatformGLExtensions() { + return _context.getPlatformGLExtensions(); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is regrettably a lower bound as in certain + circumstances OpenGL state such as unpack alignment can cause more + data to be required. However this should be close enough that it + should catch most crashes. 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) { + 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 (elements * esize * w * h * d); +} + +private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker(); +private GLBufferSizeTracker bufferSizeTracker; + +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; +} + +// Attempt to return the same ByteBuffer object from glMapBufferARB if +// the vertex buffer object's base address and size haven't changed +private static class ARBVBOKey { + private long addr; + private int capacity; + + ARBVBOKey(long addr, int capacity) { + this.addr = addr; + this.capacity = capacity; + } + + public int hashCode() { + return (int) addr; + } + + public boolean equals(Object o) { + if ((o == null) || (!(o instanceof ARBVBOKey))) { + return false; + } + + ARBVBOKey other = (ARBVBOKey) o; + return ((addr == other.addr) && (capacity == other.capacity)); + } +} + +private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = 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"); + } + int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, + target, + this); + long addr; + addr = dispatch_glMapBuffer(target, access, __addr_); + if (addr == 0 || sz == 0) { + return null; + } + ARBVBOKey key = new ARBVBOKey(addr, sz); + java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key); + if (_res == null) { + _res = InternalBufferUtils.newDirectByteBuffer(addr, sz); + BufferUtil.nativeOrder(_res); + arbVBOCache.put(key, _res); + } + _res.position(0); + return _res; +} + +/** 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); + + public final String toString() { + return getClass().getName(); + } + +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 100755 index 000000000..face06292 --- /dev/null +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -0,0 +1,322 @@ +// Tracks glBegin/glEnd calls to determine whether it is legal to +// query Vertex Buffer Object state +private boolean inBeginEndPair; + +public GLES2Impl(GLContextImpl context) { + this._context = context; + this.bufferSizeTracker = context.getBufferSizeTracker(); +} + +public final boolean isGL() { + return true; +} + +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 GL getGL() throws GLException { + return this; +} + +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 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; + +/** + * 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); +} + +public void setSwapInterval(int interval) { + _context.setSwapInterval(interval); +} + +public Object getPlatformGLExtensions() { + return _context.getPlatformGLExtensions(); +} + +// +// Helpers for ensuring the correct amount of texture data +// + +/** Returns the number of bytes required to fill in the appropriate + texture. This is regrettably a lower bound as in certain + circumstances OpenGL state such as unpack alignment can cause more + data to be required. However this should be close enough that it + should catch most crashes. 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) { + 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 (elements * esize * w * h * d); +} + +private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker(); +private GLBufferSizeTracker bufferSizeTracker; + +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; +} + +// Attempt to return the same ByteBuffer object from glMapBufferARB if +// the vertex buffer object's base address and size haven't changed +private static class ARBVBOKey { + private long addr; + private int capacity; + + ARBVBOKey(long addr, int capacity) { + this.addr = addr; + this.capacity = capacity; + } + + public int hashCode() { + return (int) addr; + } + + public boolean equals(Object o) { + if ((o == null) || (!(o instanceof ARBVBOKey))) { + return false; + } + + ARBVBOKey other = (ARBVBOKey) o; + return ((addr == other.addr) && (capacity == other.capacity)); + } +} + +private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = 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"); + } + int sz = bufferSizeTracker.getBufferSize(bufferStateTracker, + target, + this); + long addr; + addr = dispatch_glMapBuffer(target, access, __addr_); + if (addr == 0 || sz == 0) { + return null; + } + ARBVBOKey key = new ARBVBOKey(addr, sz); + java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key); + if (_res == null) { + _res = InternalBufferUtils.newDirectByteBuffer(addr, sz); + BufferUtil.nativeOrder(_res); + arbVBOCache.put(key, _res); + } + _res.position(0); + return _res; +} + +/** 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); + +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 100755 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 100755 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 100755 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/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java new file mode 100755 index 000000000..b8c9685f6 --- /dev/null +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -0,0 +1,1449 @@ +/** + * 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 +// + +/** + * Instantiates a GLU implementation object in respect to the current GL profile. + */ +public static final GLU createGLU() throws GLException { + return createGLU(GLProfile.getProfile()); +} + +/** + * Instantiates a GLU implementation object in respect to the given GL profile. + */ +public static final GLU createGLU(String profile) throws GLException { + try { + if(GLProfile.GL2.equals(profile)) { + return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2.GLUgl2"); + } + } catch (GLException e) { e.printStackTrace(); } + try { + if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES1.equals(profile)) { + return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2es1.GLUgl2es1"); + } + } catch (GLException e) { e.printStackTrace(); } + // There is no specialized ES 2 GLU at this time + /* + try { + if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES2.equals(profile)) { + return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2es2.GLUgl2es2"); + } + } catch (GLException e) { e.printStackTrace(); } + */ + return new GLU(); +} + +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 = NWReflection.isClassAvailable("com.sun.opengl.impl.glu.tessellator.GLUtessellatorImpl"); + 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; + +/** + * Optional, throws GLException if not available in profile + */ +protected static final void validateGLUquadricImpl() { + if(!checkedGLUquadricImpl) { + availableGLUquadricImpl = NWReflection.isClassAvailable("com.sun.opengl.impl.glu.GLUquadricImpl"); + 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) { + if(useGLSL && !GLProfile.isGL2ES2()) { + throw new GLException("GLUquadric GLSL implementation not supported for profile: "+GLProfile.getProfile()); + } + validateGLUquadricImpl(); + return new GLUquadricImpl(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, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, BufferUtil.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, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, BufferUtil.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, BufferUtil.getFloatArray(model), model_offset, BufferUtil.getFloatArray(proj), proj_offset, view, view_offset, (float)nearVal, (float)farVal, BufferUtil.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..aedacf3dd --- /dev/null +++ b/make/config/jogl/glu-CustomJavaCode-gl2.java @@ -0,0 +1,558 @@ +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 BufferUtil.copyByteBuffer((ByteBuffer) buf); + } else if (buf instanceof ShortBuffer) { + return BufferUtil.copyShortBufferAsByteBuffer((ShortBuffer) buf); + } else if (buf instanceof IntBuffer) { + return BufferUtil.copyIntBufferAsByteBuffer((IntBuffer) buf); + } else if (buf instanceof FloatBuffer) { + return BufferUtil.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 = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_SHORT); + } else if ( dataout instanceof IntBuffer ) { + out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_INT); + } else if ( dataout instanceof FloatBuffer ) { + out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.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 volatile boolean gluLibraryLoaded; + +private static final GLUgl2ProcAddressTable getGLUProcAddressTable() { + if (!gluLibraryLoaded) { + loadGLULibrary(); + } + if (gluProcAddressTable == null) { + GLUgl2ProcAddressTable tmp = new GLUgl2ProcAddressTable(); + GLProcAddressHelper.resetProcAddressTable(tmp, GLDrawableFactoryImpl.getFactoryImpl()); + gluProcAddressTable = tmp; + } + return gluProcAddressTable; +} + +private static final synchronized void loadGLULibrary() { + if (!gluLibraryLoaded) { + GLDrawableFactoryImpl.getFactoryImpl().loadGLULibrary(); + gluLibraryLoaded = true; + } +} diff --git a/make/config/jogl/glu-CustomJavaCode-gl2es1.java b/make/config/jogl/glu-CustomJavaCode-gl2es1.java new file mode 100755 index 000000000..074ff99b4 --- /dev/null +++ b/make/config/jogl/glu-CustomJavaCode-gl2es1.java @@ -0,0 +1,254 @@ +/* +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 = NWReflection.isClassAvailable("com.sun.opengl.impl.glu.mipmap.Mipmap"); + 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 BufferUtil.copyByteBuffer((java.nio.ByteBuffer) buf); + } else if (buf instanceof java.nio.ShortBuffer) { + return BufferUtil.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf); + } else if (buf instanceof java.nio.IntBuffer) { + return BufferUtil.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf); + } else if (buf instanceof java.nio.FloatBuffer) { + return BufferUtil.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 = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_SHORT); + } else if ( dataout instanceof java.nio.IntBuffer ) { + out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_INT); + } else if ( dataout instanceof java.nio.FloatBuffer ) { + out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.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 ) ); +} + +//---------------------------------------------------------------------- +// GLUProcAddressTable handling +// + +/* +private static GLUProcAddressTable gluProcAddressTable; +private static volatile boolean gluLibraryLoaded; + +private static GLUProcAddressTable getGLUProcAddressTable() { + if (!gluLibraryLoaded) { + loadGLULibrary(); + } + if (gluProcAddressTable == null) { + GLUProcAddressTable tmp = new GLUProcAddressTable(); + GLProcAddressHelper.resetProcAddressTable(tmp, GLDrawableFactoryImpl.getFactoryImpl()); + gluProcAddressTable = tmp; + } + return gluProcAddressTable; +} + +private static synchronized void loadGLULibrary() { + if (!gluLibraryLoaded) { + GLDrawableFactoryImpl.getFactoryImpl().loadGLULibrary(); + gluLibraryLoaded = true; + } +} +*/ diff --git a/make/config/jogl/glu-base.cfg b/make/config/jogl/glu-base.cfg new file mode 100755 index 000000000..f67673a78 --- /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.sun.opengl.impl.glu.error.Error +Import com.sun.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..06f80342e --- /dev/null +++ b/make/config/jogl/glu-common.cfg @@ -0,0 +1,180 @@ +# 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 java.nio.* +Import javax.media.opengl.* +Import javax.media.opengl.sub.* +Import javax.media.opengl.sub.fixed.* +Import javax.media.opengl.glu.* +Import javax.media.opengl.util.* +Import com.sun.opengl.impl.* +Import com.sun.opengl.impl.glu.* +Import com.sun.opengl.impl.glu.tessellator.GLUtessellatorImpl +Import com.sun.nwi.impl.NWReflection + +# 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 100755 index 000000000..712f9a305 --- /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.sun.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.sun.opengl.impl.glu.nurbs.* +Import java.security.* +Import com.sun.gluegen.runtime.opengl.GLProcAddressHelper +Import com.sun.opengl.impl.glu.gl2.nurbs.* +Import com.sun.opengl.impl.glu.mipmap.Mipmap +Import com.sun.opengl.impl.glu.gl2.* +Import javax.media.opengl.GL2 +Import com.sun.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 100755 index 000000000..8927f96b9 --- /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.sun.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 100755 index 000000000..218a0ebe9 --- /dev/null +++ b/make/config/jogl/glx-CustomCCode.c @@ -0,0 +1,17 @@ +#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 __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); + diff --git a/make/config/jogl/glx-x11.cfg b/make/config/jogl/glx-x11.cfg new file mode 100644 index 000000000..e1d684ef7 --- /dev/null +++ b/make/config/jogl/glx-x11.cfg @@ -0,0 +1,76 @@ +# 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.sun.opengl.impl.x11.glx +JavaClass GLX +Style allstatic +Include gl-common-gl2.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +EmitProcAddressTable true +ProcAddressTableClassName GLXProcAddressTable +GetProcAddressTableExpr glxProcAddressTable +# This must be present for bootstrapping +SkipProcAddressGen glXGetProcAddressARB + +Import com.sun.nwi.impl.x11.* + +CustomJavaCode GLX private static GLXProcAddressTable glxProcAddressTable = new GLXProcAddressTable(); +CustomJavaCode GLX public static GLXProcAddressTable getGLXProcAddressTable() { return glxProcAddressTable; } + +IncludeAs CustomCCode glx-CustomCCode.c + +ArgumentIsString XOpenDisplay 0 + +ReturnValueCapacity glXChooseVisual sizeof(XVisualInfo) +ReturnValueCapacity glXGetVisualFromFBConfig sizeof(XVisualInfo) +ReturnValueCapacity glXGetVisualFromFBConfigSGIX sizeof(XVisualInfo) + +Opaque long GLXFBConfig + +# Ignore everything not in the GLX core (up through GLX 1.4) aside from glXGetProcAddress +# 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 diff --git a/make/config/jogl/glxext.cfg b/make/config/jogl/glxext.cfg new file mode 100755 index 000000000..4f964865a --- /dev/null +++ b/make/config/jogl/glxext.cfg @@ -0,0 +1,127 @@ +# 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.sun.opengl.impl.x11.glx +Style InterfaceAndImpl +JavaClass GLXExt +ImplPackage com.sun.opengl.impl.x11.glx +ImplJavaClass GLXExtImpl + +ExtendedInterfaceSymbols ../build-temp/gensrc/classes/com/sun/opengl/impl/x11/glx/GLX.java +Include gl-common-gl2.cfg +Include gl-desktop.cfg + +EmitProcAddressTable true +ProcAddressTableClassName GLXExtProcAddressTable +GetProcAddressTableExpr _context.getGLXExtProcAddressTable() + +Import com.sun.nwi.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 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 glXGetProcAddress + +# 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 + +# 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/nsig.cfg b/make/config/jogl/nsig.cfg new file mode 100755 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-CustomCCode.c b/make/config/jogl/wgl-CustomCCode.c new file mode 100755 index 000000000..0fe9ee628 --- /dev/null +++ b/make/config/jogl/wgl-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/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg new file mode 100644 index 000000000..f86f1adcc --- /dev/null +++ b/make/config/jogl/wgl-win32.cfg @@ -0,0 +1,44 @@ +# 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.sun.opengl.impl.windows.wgl +JavaClass WGL +Style allstatic +Include gl-common-gl2.cfg +Include gl-common-extensions.cfg +Include gl-desktop.cfg + +# Implement the first argument to wglGetProcAddress as String instead +# of byte[] +ArgumentIsString wglGetProcAddress 0 +ArgumentIsString LoadLibraryA 0 +ArgumentIsString GetProcAddress 1 + +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 wgl-CustomCCode.c + +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/wglext.cfg b/make/config/jogl/wglext.cfg new file mode 100644 index 000000000..af4430bbe --- /dev/null +++ b/make/config/jogl/wglext.cfg @@ -0,0 +1,51 @@ +# 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.sun.opengl.impl.windows.wgl +Style InterfaceAndImpl +JavaClass WGLExt +ImplPackage com.sun.opengl.impl.windows.wgl +ImplJavaClass WGLExtImpl +Include gl-common-gl2.cfg +Include gl-desktop.cfg + +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 + +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; diff --git a/make/config/nwi/jawt-CustomJavaCode.java b/make/config/nwi/jawt-CustomJavaCode.java new file mode 100755 index 000000000..f1ef91075 --- /dev/null +++ b/make/config/nwi/jawt-CustomJavaCode.java @@ -0,0 +1,27 @@ +private static volatile JAWT jawt; + +/** Helper routine for all users to call to access the JAWT. */ +public static JAWT getJAWT() { + if (jawt == null) { + synchronized (JAWT.class) { + if (jawt == null) { + JAWTNativeLibLoader.loadAWTImpl(); + // Workaround for 4845371. + // Make sure the first reference to the JNI GetDirectBufferAddress is done + // from a privileged context so the VM's internal class lookups will succeed. + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + JAWT j = JAWT.create(); + j.version(JAWTFactory.JAWT_VERSION_1_4); + if (!JAWTFactory.JAWT_GetAWT(j)) { + throw new RuntimeException("Unable to initialize JAWT"); + } + jawt = j; + return null; + } + }); + } + } + } + return jawt; +} diff --git a/make/config/nwi/jawt-DrawingSurfaceInfo-CustomJavaCode.java b/make/config/nwi/jawt-DrawingSurfaceInfo-CustomJavaCode.java new file mode 100755 index 000000000..1cc13e7d8 --- /dev/null +++ b/make/config/nwi/jawt-DrawingSurfaceInfo-CustomJavaCode.java @@ -0,0 +1,38 @@ +public JAWT_PlatformInfo platformInfo() { + return newPlatformInfo(platformInfo0(getBuffer())); +} + +private native ByteBuffer platformInfo0(Buffer jthis0); + +private static java.lang.reflect.Method platformInfoFactoryMethod; + +private static JAWT_PlatformInfo newPlatformInfo(ByteBuffer buf) { + if (platformInfoFactoryMethod == null) { + String osName = (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("os.name").toLowerCase(); + } + }); + try { + Class factoryClass; + if (osName.startsWith("wind")) { + factoryClass = Class.forName("com.sun.nwi.impl.jawt.windows.JAWT_Win32DrawingSurfaceInfo"); + } else if (osName.startsWith("mac os x")) { + factoryClass = Class.forName("com.sun.nwi.impl.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo"); + } else { + // Assume Linux, Solaris, etc. Should probably test for these explicitly. + factoryClass = Class.forName("com.sun.nwi.impl.jawt.x11.JAWT_X11DrawingSurfaceInfo"); + } + platformInfoFactoryMethod = factoryClass.getMethod("create", + new Class[] { ByteBuffer.class }); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + try { + return (JAWT_PlatformInfo) + platformInfoFactoryMethod.invoke(null, new Object[] { buf }); + } catch (Exception e) { + throw new RuntimeException(e); + } +} diff --git a/make/config/nwi/jawt-macosx.cfg b/make/config/nwi/jawt-macosx.cfg new file mode 100644 index 000000000..57cceb6a1 --- /dev/null +++ b/make/config/nwi/jawt-macosx.cfg @@ -0,0 +1,30 @@ +# This .cfg file is used to generate the interface to the JAWT, which +# is used by the MacOSXOnscreenGLContext. +Style AllStatic +Package com.sun.nwi.impl.jawt +JavaClass JAWTFactory +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/MacOSX + +HierarchicalNativeOutput false + +Opaque boolean jboolean +Opaque long void * +Opaque long NSView * + +IgnoreField JAWT GetComponent +IgnoreField JAWT_DrawingSurfaceInfo platformInfo + +IncludeAs CustomJavaCode JAWT jawt-CustomJavaCode.java + +CustomCCode #include <inttypes.h> +CustomCCode #include <jawt.h> +CustomCCode #include </usr/include/machine/types.h> + +import java.security.* +import com.sun.nwi.impl.jawt.* +StructPackage JAWT_MacOSXDrawingSurfaceInfo com.sun.nwi.impl.jawt.macosx +EmitStruct JAWT_MacOSXDrawingSurfaceInfo +Implements JAWT_MacOSXDrawingSurfaceInfo JAWT_PlatformInfo + +IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java diff --git a/make/config/nwi/jawt-win32.cfg b/make/config/nwi/jawt-win32.cfg new file mode 100644 index 000000000..74aef8f75 --- /dev/null +++ b/make/config/nwi/jawt-win32.cfg @@ -0,0 +1,30 @@ +# This .cfg file is used to generate the interface to the JAWT, which +# is used by the WindowsOnscreenGLContext. +Style AllStatic +Package com.sun.nwi.impl.jawt +JavaClass JAWTFactory +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/Windows + +HierarchicalNativeOutput false + +Opaque boolean jboolean +Opaque long HDC + +IgnoreField JAWT GetComponent +IgnoreField JAWT_DrawingSurfaceInfo platformInfo +IgnoreField JAWT_Win32DrawingSurfaceInfo null +IgnoreField JAWT_Win32DrawingSurfaceInfo hpalette + +IncludeAs CustomJavaCode JAWT jawt-CustomJavaCode.java + +CustomCCode #include <jawt.h> +Include ../intptr.cfg + +import java.security.* +import com.sun.nwi.impl.jawt.* +StructPackage JAWT_Win32DrawingSurfaceInfo com.sun.nwi.impl.jawt.windows +EmitStruct JAWT_Win32DrawingSurfaceInfo +Implements JAWT_Win32DrawingSurfaceInfo JAWT_PlatformInfo + +IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java diff --git a/make/config/nwi/jawt-x11.cfg b/make/config/nwi/jawt-x11.cfg new file mode 100644 index 000000000..fdcf16bdb --- /dev/null +++ b/make/config/nwi/jawt-x11.cfg @@ -0,0 +1,30 @@ +# This .cfg file is used to generate the interface to the JAWT, which +# is used by the X11OnscreenGLContext. +Style AllStatic +Package com.sun.nwi.impl.jawt +JavaClass JAWTFactory +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/X11 + +HierarchicalNativeOutput false + +Opaque boolean jboolean +Opaque long Drawable +Opaque long Display * + +IgnoreField JAWT GetComponent +IgnoreField JAWT_DrawingSurfaceInfo platformInfo +IgnoreField JAWT_X11DrawingSurfaceInfo GetAWTColor + +IncludeAs CustomJavaCode JAWT jawt-CustomJavaCode.java + +CustomCCode #include <inttypes.h> +CustomCCode #include <jawt.h> + +import java.security.* +import com.sun.nwi.impl.jawt.* +StructPackage JAWT_X11DrawingSurfaceInfo com.sun.nwi.impl.jawt.x11 +EmitStruct JAWT_X11DrawingSurfaceInfo +Implements JAWT_X11DrawingSurfaceInfo JAWT_PlatformInfo + +IncludeAs CustomJavaCode JAWT_DrawingSurfaceInfo jawt-DrawingSurfaceInfo-CustomJavaCode.java diff --git a/make/config/nwi/x11-CustomCCode.c b/make/config/nwi/x11-CustomCCode.c new file mode 100755 index 000000000..793327c72 --- /dev/null +++ b/make/config/nwi/x11-CustomCCode.c @@ -0,0 +1,82 @@ +#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 + +/* Current versions of Solaris don't expose the XF86 extensions, + although with the recent transition to Xorg this will probably + happen in an upcoming release */ +#if !defined(__sun) && !defined(_HPUX) +#include <X11/extensions/xf86vmode.h> +#else +/* Need to provide stubs for these */ +Bool XF86VidModeGetGammaRampSize( + Display *display, + int screen, + int* size) +{ + return False; +} + +Bool XF86VidModeGetGammaRamp( + Display *display, + int screen, + int size, + unsigned short *red_array, + unsigned short *green_array, + unsigned short *blue_array) { + return False; +} +Bool XF86VidModeSetGammaRamp( + Display *display, + int screen, + int size, + unsigned short *red_array, + unsigned short *green_array, + unsigned short *blue_array) { + return False; +} +#endif + +/* HP-UX doesn't define RTLD_DEFAULT. */ +#if defined(_HPUX) && !defined(RTLD_DEFAULT) +#define RTLD_DEFAULT NULL +#endif + +/* Need to expose DefaultScreen and RootWindow macros to Java */ +JNIEXPORT jlong JNICALL +Java_com_sun_nwi_impl_x11_X11Lib_DefaultScreen(JNIEnv *env, jclass _unused, jlong display) { + return DefaultScreen((Display*) (intptr_t) display); +} +JNIEXPORT jlong JNICALL +Java_com_sun_nwi_impl_x11_X11Lib_RootWindow(JNIEnv *env, jclass _unused, jlong display, jint screen) { + return RootWindow((Display*) (intptr_t) display, screen); +} + +JNIEXPORT jlong JNICALL +Java_com_sun_nwi_impl_x11_X11Lib_dlopen(JNIEnv *env, jclass _unused, jstring name) { + const jbyte* chars; + void* res; + chars = (*env)->GetStringUTFChars(env, name, NULL); + res = dlopen(chars, RTLD_LAZY | RTLD_GLOBAL); + (*env)->ReleaseStringUTFChars(env, name, chars); + return (jlong) ((intptr_t) res); +} + +JNIEXPORT jlong JNICALL +Java_com_sun_nwi_impl_x11_X11Lib_dlsym(JNIEnv *env, jclass _unused, jstring name) { + const jbyte* chars; + void* res; + chars = (*env)->GetStringUTFChars(env, name, NULL); + res = dlsym(RTLD_DEFAULT, chars); + (*env)->ReleaseStringUTFChars(env, name, chars); + return (jlong) ((intptr_t) res); +} + +/* Need to pull this in as we don't have a stub header for it */ +extern Bool XineramaEnabled(Display* display); + diff --git a/make/config/nwi/x11-lib.cfg b/make/config/nwi/x11-lib.cfg new file mode 100644 index 000000000..1448e7783 --- /dev/null +++ b/make/config/nwi/x11-lib.cfg @@ -0,0 +1,43 @@ +# This .cfg file is used to generate the interface to the GLX routines +# used internally by the X11GLContext implementation. +Package com.sun.nwi.impl.x11 +JavaClass X11Lib +Style allstatic + +HierarchicalNativeOutput false + +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/X11 + +# Imports needed by all glue code +Import java.nio.* +Import java.util.* + +# XID needs to be treated as a long for 32/64 bit compatibility +Opaque long XID + +Opaque long Display * +Opaque boolean Bool +Opaque long GLXFBConfig + +CustomJavaCode X11Lib public static native long dlopen(String name); +CustomJavaCode X11Lib public static native long dlsym(String name); + +IncludeAs CustomCCode x11-CustomCCode.c + +ArgumentIsString XOpenDisplay 0 + +# Need to expose DefaultScreen and RootWindow macros to Java +CustomJavaCode X11Lib public static native int DefaultScreen(long display); +CustomJavaCode X11Lib public static native long RootWindow(long display, int screen); + +# Get returned array's capacity from XGetVisualInfo to be correct +TemporaryCVariableDeclaration XGetVisualInfo int count; +TemporaryCVariableAssignment XGetVisualInfo count = _ptr3[0]; +ReturnValueCapacity XGetVisualInfo count * sizeof(XVisualInfo) + +# Helper routine to make the ReturnedArrayLength expression below work correctly +CustomJavaCode X11Lib private static int getFirstElement(IntBuffer buf) { return buf.get(buf.position()); } +CustomJavaCode X11Lib private static int getFirstElement(int[] arr, int offset) { return arr[offset]; } +ReturnedArrayLength XGetVisualInfo getFirstElement({3}) + |