diff options
author | Kenneth Russel <[email protected]> | 2005-07-27 00:30:06 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-07-27 00:30:06 +0000 |
commit | 7c1f2cde56438a979ddaab5fecc09f663427be91 (patch) | |
tree | 65098e75762b3e0f6a7b1a484792f9a48ca3b247 /make | |
parent | ebd2c94e33c643ad6102e76f22d1624e9b986737 (diff) |
Refactored platform extensions out of the GL interface and
implementation and into their own objects according to the JSR-231
expert group's resolutions. Moved the interfaces declaring these
extensions into the platform-specific implementation directories and
added a loosely-specified GL.getPlatformGLExtensions(). This will
shrink the size of the platform-independent jar file considerably as
the implementing class for the public GL interface is now no longer
replicated for each platform. The build process is also simplified a
fair bit; more simplifications are possible.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@337 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make')
-rw-r--r-- | make/build.xml | 40 | ||||
-rwxr-xr-x | make/cglext.cfg | 53 | ||||
-rw-r--r-- | make/gl-common-win32.cfg | 3 | ||||
-rw-r--r-- | make/gl-common-x11.cfg | 3 | ||||
-rw-r--r-- | make/gl-common.cfg | 11 | ||||
-rw-r--r-- | make/gl-glx-x11.cfg | 14 | ||||
-rw-r--r-- | make/gl-impl-CustomCCode.c | 70 | ||||
-rw-r--r-- | make/gl-impl-CustomJavaCode.java | 30 | ||||
-rw-r--r-- | make/gl-impl-macosx.cfg | 56 | ||||
-rw-r--r-- | make/gl-impl-win32.cfg | 42 | ||||
-rw-r--r-- | make/gl-impl-x11.cfg | 37 | ||||
-rw-r--r-- | make/gl-macosx.cfg | 3 | ||||
-rw-r--r-- | make/gl-wgl-win32.cfg | 10 | ||||
-rw-r--r-- | make/gl-win32.cfg | 3 | ||||
-rw-r--r-- | make/gl-x11.cfg | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | make/glxext.cfg (renamed from make/gl-glx-common.cfg) | 66 | ||||
-rwxr-xr-x | make/stub_includes/macosx/cglext.c | 1 | ||||
-rwxr-xr-x | make/stub_includes/win32/wglext.c | 13 | ||||
-rw-r--r-- | make/stub_includes/x11/glxext.c (renamed from make/stub_includes/common/gl-impl.c) | 9 | ||||
-rw-r--r-- | make/wglext.cfg | 58 |
20 files changed, 256 insertions, 272 deletions
diff --git a/make/build.xml b/make/build.xml index a375ca764..80ec49887 100644 --- a/make/build.xml +++ b/make/build.xml @@ -251,11 +251,15 @@ <!-- Set platform configuration files. --> <property name="gl.cfg" value="${config}/gl-win32.cfg" /> <property name="gl.impl.cfg" value="${config}/gl-impl-win32.cfg" /> + <property name="glext.platform.cfg" value="${config}/wglext.cfg" /> <property name="glu.cfg" value="${config}/glu.cfg" /> <property name="glu.impl.cfg" value="${config}/glu-impl-win32.cfg" /> <property name="jawt.cfg" value="${config}/jawt-win32.cfg" /> <property name="window.cfg" value="${config}/wingdi-win32.cfg" /> + <!-- Set platform headers. --> + <property name="glext.platform.header" value="${stub.includes.dir}/win32/wglext.c" /> + <!-- Set platform directories. --> <property name="stub.includes.platform" value="${stub.includes}/win32" /> <property name="java.includes.dir.platform" value="${java.includes.dir.win32}" /> @@ -292,11 +296,15 @@ <!-- Set platform configuration files. --> <property name="gl.cfg" value="${config}/gl-x11.cfg" /> <property name="gl.impl.cfg" value="${config}/gl-impl-x11.cfg" /> + <property name="glext.platform.cfg" value="${config}/glxext.cfg" /> <property name="glu.cfg" value="${config}/glu.cfg" /> <property name="glu.impl.cfg" value="${config}/glu-impl-x11.cfg" /> <property name="jawt.cfg" value="${config}/jawt-x11.cfg" /> <property name="window.cfg" value="${config}/glx-x11.cfg" /> + <!-- Set platform headers. --> + <property name="glext.platform.header" value="${stub.includes.dir}/x11/glxext.c" /> + <!-- Set platform directories. --> <property name="stub.includes.platform" value="${stub.includes.x11}" /> <property name="java.excludes.platform" value="${java.excludes.x11}" /> @@ -353,11 +361,15 @@ <!-- Set platform configuration files. --> <property name="gl.cfg" value="${config}/gl-macosx.cfg" /> <property name="gl.impl.cfg" value="${config}/gl-impl-macosx.cfg" /> + <property name="glext.platform.cfg" value="${config}/cglext.cfg" /> <property name="glu.cfg" value="${config}/glu.cfg" /> <property name="glu.impl.cfg" value="${config}/glu-impl-macosx.cfg" /> <property name="jawt.cfg" value="${config}/jawt-macosx.cfg" /> <property name="window.cfg" value="${config}/cgl-macosx.cfg" /> + <!-- Set platform headers. --> + <property name="glext.platform.header" value="${stub.includes.dir}/macosx/cglext.c" /> + <!-- Set platform directories. --> <property name="stub.includes.platform" value="${stub.includes}/macosx" /> <property name="java.includes.dir.platform" value="${java.includes.dir.macosx}" /> @@ -473,35 +485,17 @@ <!-- Generate GL implementation class --> <echo message="Generating GL implementation class" /> - <gluegen src="${stub.includes.common}/gl-impl.c" + <gluegen src="${stub.includes.common}/gl.c" config="${gl.impl.cfg}" includeRefid="stub.includes.fileset.all" emitter="net.java.games.gluegen.opengl.GLEmitter"> <classpath refid="gen.classpath" /> </gluegen> - <!-- Generate WGL interface class --> - <echo message="Generating WGL interface class" /> - <gluegen src="${stub.includes.common}/gl-impl.c" - config="${config}/gl-wgl-win32.cfg" - includeRefid="stub.includes.fileset.all" - emitter="net.java.games.gluegen.opengl.GLEmitter"> - <classpath refid="gen.classpath" /> - </gluegen> - - <!-- Generate GLX interface class --> - <echo message="Generating GLX interface class" /> - <gluegen src="${stub.includes.common}/gl-impl.c" - config="${config}/gl-glx-x11.cfg" - includeRefid="stub.includes.fileset.all" - emitter="net.java.games.gluegen.opengl.GLEmitter"> - <classpath refid="gen.classpath" /> - </gluegen> - - <!-- Generate CGL interface class --> - <echo message="Generating CGL interface class" /> - <gluegen src="${stub.includes.common}/gl-impl.c" - config="${config}/gl-cgl-macosx.cfg" + <!-- Generate platform-specific extension class (WGLExt, GLXExt, etc.) --> + <echo message="Generating platform-specific OpenGL extension class" /> + <gluegen src="${glext.platform.header}" + config="${glext.platform.cfg}" includeRefid="stub.includes.fileset.all" emitter="net.java.games.gluegen.opengl.GLEmitter"> <classpath refid="gen.classpath" /> diff --git a/make/cglext.cfg b/make/cglext.cfg new file mode 100755 index 000000000..52fad76c8 --- /dev/null +++ b/make/cglext.cfg @@ -0,0 +1,53 @@ +# 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. +Package net.java.games.jogl.impl.macosx +Style InterfaceAndImpl +JavaClass CGLExt +ImplPackage net.java.games.jogl.impl.macosx +ImplJavaClass CGLExtImpl +Include gl-common-macosx.cfg + +EmitProcAddressTable true +ProcAddressTableClassName CGLExtProcAddressTable +ContextVariableName _context + +# Ignore everything that doesn't start with cgl or CGL +IgnoreNot ^(cgl|CGL).+ + +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; + +CustomJavaCode CGLExt public boolean isFunctionAvailable(String glFunctionName); +CustomJavaCode CGLExt public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode CGLExtImpl public CGLExtImpl(MacOSXGLContext 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 MacOSXGLContext _context; diff --git a/make/gl-common-win32.cfg b/make/gl-common-win32.cfg index 2ab42d4eb..1d2451270 100644 --- a/make/gl-common-win32.cfg +++ b/make/gl-common-win32.cfg @@ -5,6 +5,3 @@ HierarchicalNativeOutput false Include gl-common.cfg JavaOutputDir ../build/gensrc/classes NativeOutputDir ../build/gensrc/native/jogl - -Unimplemented cgl.+ -Unimplemented glX.+ diff --git a/make/gl-common-x11.cfg b/make/gl-common-x11.cfg index dcaeac4f2..2ed680dc3 100644 --- a/make/gl-common-x11.cfg +++ b/make/gl-common-x11.cfg @@ -19,6 +19,3 @@ ReturnValueCapacity glXGetVisualFromFBConfigSGIX sizeof(XVisualInfo) # Elide the version of XGetVisualInfo taking a direct buffer for the third argument # (since we can't specify different glue code for different overloadings -- FIXME) NoNio XGetVisualInfo - -Unimplemented cgl.+ -Unimplemented wgl.+ diff --git a/make/gl-common.cfg b/make/gl-common.cfg index 48d3a4092..f71f32fc4 100644 --- a/make/gl-common.cfg +++ b/make/gl-common.cfg @@ -370,6 +370,17 @@ CustomJavaCode GL have an effect, and in particular only affects heavyweig 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(); + # # Directives needed when processing wglext.h on Windows and other platforms # diff --git a/make/gl-glx-x11.cfg b/make/gl-glx-x11.cfg deleted file mode 100644 index 359e35c62..000000000 --- a/make/gl-glx-x11.cfg +++ /dev/null @@ -1,14 +0,0 @@ -# This .cfg file is used to generate the interface which contains the -# window system-specific extensions which are exposed (via -# inheritance) to the GL interface. -Package net.java.games.jogl -Style InterfaceOnly -JavaClass GLX -Include gl-common-x11.cfg - -# Ignore everything that doesn't start with glX or GLX -IgnoreNot ^(glX|GLX).+ - -# Pick up ignores that must also be included in other platforms' impl -# files -Include gl-glx-common.cfg diff --git a/make/gl-impl-CustomCCode.c b/make/gl-impl-CustomCCode.c index f0c7cb45a..5c3b04aaa 100644 --- a/make/gl-impl-CustomCCode.c +++ b/make/gl-impl-CustomCCode.c @@ -1,10 +1,10 @@ /* Java->C glue code: - * Java package: net.java.games.jogl.impl.windows.WindowsGLImpl + * Java package: net.java.games.jogl.impl.GLImpl * Java method: long dispatch_glMapBuffer(int target, int access) * C function: LPVOID glMapBuffer(GLenum target, GLenum access); */ JNIEXPORT jlong JNICALL -Java_net_java_games_jogl_impl_windows_WindowsGLImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { +Java_net_java_games_jogl_impl_GLImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { PFNGLMAPBUFFERPROC ptr_glMapBuffer; LPVOID _res; ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; @@ -14,12 +14,12 @@ Java_net_java_games_jogl_impl_windows_WindowsGLImpl_dispatch_1glMapBuffer(JNIEnv } /* Java->C glue code: - * Java package: net.java.games.jogl.impl.windows.WindowsGLImpl + * Java package: net.java.games.jogl.impl.GLImpl * Java method: long dispatch_glMapBufferARB(int target, int access) * C function: LPVOID glMapBufferARB(GLenum target, GLenum access); */ JNIEXPORT jlong JNICALL -Java_net_java_games_jogl_impl_windows_WindowsGLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { +Java_net_java_games_jogl_impl_GLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { PFNGLMAPBUFFERARBPROC ptr_glMapBufferARB; LPVOID _res; ptr_glMapBufferARB = (PFNGLMAPBUFFERARBPROC) (intptr_t) glProcAddress; @@ -27,65 +27,3 @@ Java_net_java_games_jogl_impl_windows_WindowsGLImpl_dispatch_1glMapBufferARB(JNI _res = (* ptr_glMapBufferARB) ((GLenum) target, (GLenum) access); return (jlong) (intptr_t) _res; } - -/* Java->C glue code: - * Java package: net.java.games.jogl.impl.x11.X11GLImpl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: LPVOID glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_net_java_games_jogl_impl_x11_X11GLImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERPROC ptr_glMapBuffer; - LPVOID _res; - ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: net.java.games.jogl.impl.x11.X11GLImpl - * Java method: long dispatch_glMapBufferARB(int target, int access) - * C function: LPVOID glMapBufferARB(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_net_java_games_jogl_impl_x11_X11GLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) { - PFNGLMAPBUFFERARBPROC ptr_glMapBufferARB; - LPVOID _res; - ptr_glMapBufferARB = (PFNGLMAPBUFFERARBPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBufferARB != NULL); - _res = (* ptr_glMapBufferARB) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: net.java.games.jogl.impl.macosx.MacOSXGLImpl - * Java method: long dispatch_glMapBufferARB(int target, int access) - * C function: LPVOID glMapBufferARB(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_net_java_games_jogl_impl_macosx_MacOSXGLImpl_dispatch_1glMapBuffer( JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) -{ - PFNGLMAPBUFFERPROC ptr_glMapBuffer; - LPVOID _res; - ptr_glMapBuffer = (PFNGLMAPBUFFERPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBuffer != NULL); - _res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} - -/* Java->C glue code: - * Java package: net.java.games.jogl.impl.macosx.MacOSXGLImpl - * Java method: long dispatch_glMapBuffer(int target, int access) - * C function: LPVOID glMapBuffer(GLenum target, GLenum access); - */ -JNIEXPORT jlong JNICALL -Java_net_java_games_jogl_impl_macosx_MacOSXGLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) -{ - PFNGLMAPBUFFERARBPROC ptr_glMapBufferARB; - LPVOID _res; - ptr_glMapBufferARB = (PFNGLMAPBUFFERARBPROC) (intptr_t) glProcAddress; - assert(ptr_glMapBufferARB != NULL); - _res = (* ptr_glMapBufferARB) ((GLenum) target, (GLenum) access); - return (jlong) (intptr_t) _res; -} diff --git a/make/gl-impl-CustomJavaCode.java b/make/gl-impl-CustomJavaCode.java index 546fa8f2d..f009bd385 100644 --- a/make/gl-impl-CustomJavaCode.java +++ b/make/gl-impl-CustomJavaCode.java @@ -1,3 +1,33 @@ +public GLImpl(GLContextImpl context) { + this._context = context; +} + +public boolean isFunctionAvailable(String glFunctionName) { + return _context.isFunctionAvailable(glFunctionName); +} + +public boolean isExtensionAvailable(String glExtensionName) { + return _context.isExtensionAvailable(glExtensionName); +} + +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(); +} + // 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 { diff --git a/make/gl-impl-macosx.cfg b/make/gl-impl-macosx.cfg index 5a09750dd..6704e098e 100644 --- a/make/gl-impl-macosx.cfg +++ b/make/gl-impl-macosx.cfg @@ -3,10 +3,9 @@ Package net.java.games.jogl Style ImplOnly JavaClass GL -ImplPackage net.java.games.jogl.impl.macosx -ImplJavaClass MacOSXGLImpl +ImplPackage net.java.games.jogl.impl +ImplJavaClass GLImpl Include gl-common-macosx.cfg -Include gl-glx-common.cfg EmitProcAddressTable true ProcAddressTableClassName GLProcAddressTable @@ -28,54 +27,5 @@ CustomCCode /* Provide Windows typedefs */ CustomCCode typedef void* LPVOID; CustomCCode typedef unsigned int* PUINT; -CustomJavaCode MacOSXGLImpl public MacOSXGLImpl(MacOSXGLContext context) -CustomJavaCode MacOSXGLImpl { -CustomJavaCode MacOSXGLImpl this._context = context; -CustomJavaCode MacOSXGLImpl } - -CustomJavaCode MacOSXGLImpl /** This constructor should be used manually in order to -CustomJavaCode MacOSXGLImpl create a GL object that can be used with the Cocoa NSOpenGLView. */ -CustomJavaCode MacOSXGLImpl public MacOSXGLImpl() -CustomJavaCode MacOSXGLImpl { -CustomJavaCode MacOSXGLImpl this._context = new MacOSXDummyGLContext(this); -CustomJavaCode MacOSXGLImpl } - -CustomJavaCode MacOSXGLImpl public boolean isFunctionAvailable(String glFunctionName) -CustomJavaCode MacOSXGLImpl { -CustomJavaCode MacOSXGLImpl return _context.isFunctionAvailable(glFunctionName); -CustomJavaCode MacOSXGLImpl } - -CustomJavaCode MacOSXGLImpl public boolean isExtensionAvailable(String glExtensionName) -CustomJavaCode MacOSXGLImpl { -CustomJavaCode MacOSXGLImpl return _context.isExtensionAvailable(glExtensionName); -CustomJavaCode MacOSXGLImpl } - -CustomJavaCode MacOSXGLImpl /** Forces a recomputation of which extensions are available. -CustomJavaCode MacOSXGLImpl Should only be called if this MacOSXGLImpl is being used -CustomJavaCode MacOSXGLImpl in conjunction with an NSOpenGLView instead of a GLCanvas. */ -CustomJavaCode MacOSXGLImpl public void resetGLFunctionAvailability() -CustomJavaCode MacOSXGLImpl { -CustomJavaCode MacOSXGLImpl if (!(_context instanceof MacOSXDummyGLContext)) { -CustomJavaCode MacOSXGLImpl throw new GLException("Should only be called if being used with NSOpenGLView"); -CustomJavaCode MacOSXGLImpl } -CustomJavaCode MacOSXGLImpl ((MacOSXDummyGLContext) _context).resetGLFunctionAvailability(); -CustomJavaCode MacOSXGLImpl } - -CustomJavaCode MacOSXGLImpl private MacOSXGLContext _context; - -CustomJavaCode MacOSXGLImpl /** -CustomJavaCode MacOSXGLImpl * Provides platform-independent access to the wglAllocateMemoryNV / -CustomJavaCode MacOSXGLImpl * glXAllocateMemoryNV extension. -CustomJavaCode MacOSXGLImpl */ -CustomJavaCode MacOSXGLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) -CustomJavaCode MacOSXGLImpl { -CustomJavaCode MacOSXGLImpl // FIXME -CustomJavaCode MacOSXGLImpl throw new GLException("Not yet implemented"); -CustomJavaCode MacOSXGLImpl } - -CustomJavaCode MacOSXGLImpl public void setSwapInterval(int interval) { // FIXME: not implemented yet -CustomJavaCode MacOSXGLImpl _context.setSwapInterval(interval); -CustomJavaCode MacOSXGLImpl } - -IncludeAs CustomJavaCode MacOSXGLImpl gl-impl-CustomJavaCode.java +IncludeAs CustomJavaCode GLImpl gl-impl-CustomJavaCode.java IncludeAs CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-impl-win32.cfg b/make/gl-impl-win32.cfg index 252425659..e6f57738f 100644 --- a/make/gl-impl-win32.cfg +++ b/make/gl-impl-win32.cfg @@ -3,10 +3,9 @@ Package net.java.games.jogl Style ImplOnly JavaClass GL -ImplPackage net.java.games.jogl.impl.windows -ImplJavaClass WindowsGLImpl +ImplPackage net.java.games.jogl.impl +ImplJavaClass GLImpl Include gl-common-win32.cfg -Include gl-glx-common.cfg EmitProcAddressTable true ProcAddressTableClassName GLProcAddressTable @@ -23,48 +22,13 @@ CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototype 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 /* This typedef is only needed for VC6 */ CustomCCode #if _MSC_VER <= 1200 CustomCCode typedef int intptr_t; CustomCCode #endif -CustomJavaCode WindowsGLImpl public WindowsGLImpl(WindowsGLContext context) { -CustomJavaCode WindowsGLImpl this._context = context; -CustomJavaCode WindowsGLImpl } - -CustomJavaCode WindowsGLImpl public boolean isFunctionAvailable(String glFunctionName) -CustomJavaCode WindowsGLImpl { -CustomJavaCode WindowsGLImpl return _context.isFunctionAvailable(glFunctionName); -CustomJavaCode WindowsGLImpl } - -CustomJavaCode WindowsGLImpl public boolean isExtensionAvailable(String glExtensionName) -CustomJavaCode WindowsGLImpl { -CustomJavaCode WindowsGLImpl return _context.isExtensionAvailable(glExtensionName); -CustomJavaCode WindowsGLImpl } - -CustomJavaCode WindowsGLImpl private WindowsGLContext _context; - -CustomJavaCode WindowsGLImpl /** -CustomJavaCode WindowsGLImpl * Provides platform-independent access to the wglAllocateMemoryNV / -CustomJavaCode WindowsGLImpl * glXAllocateMemoryNV extension. -CustomJavaCode WindowsGLImpl */ -CustomJavaCode WindowsGLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { -CustomJavaCode WindowsGLImpl return wglAllocateMemoryNV(arg0, arg1, arg2, arg3); -CustomJavaCode WindowsGLImpl } - -CustomJavaCode WindowsGLImpl public void setSwapInterval(int interval) { -CustomJavaCode WindowsGLImpl if (isExtensionAvailable("WGL_EXT_swap_control")) { -CustomJavaCode WindowsGLImpl wglSwapIntervalEXT(interval); -CustomJavaCode WindowsGLImpl } -CustomJavaCode WindowsGLImpl } - -IncludeAs CustomJavaCode WindowsGLImpl gl-impl-CustomJavaCode.java +IncludeAs CustomJavaCode GLImpl gl-impl-CustomJavaCode.java IncludeAs CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-impl-x11.cfg b/make/gl-impl-x11.cfg index b60a28787..2fa65d050 100644 --- a/make/gl-impl-x11.cfg +++ b/make/gl-impl-x11.cfg @@ -3,10 +3,9 @@ Package net.java.games.jogl Style ImplOnly JavaClass GL -ImplPackage net.java.games.jogl.impl.x11 -ImplJavaClass X11GLImpl +ImplPackage net.java.games.jogl.impl +ImplJavaClass GLImpl Include gl-common-x11.cfg -Include gl-glx-common.cfg EmitProcAddressTable true ProcAddressTableClassName GLProcAddressTable @@ -33,35 +32,5 @@ CustomCCode /* Provide Windows typedefs */ CustomCCode typedef void* LPVOID; CustomCCode typedef unsigned int* PUINT; -CustomJavaCode X11GLImpl public X11GLImpl(X11GLContext context) { -CustomJavaCode X11GLImpl this._context = context; -CustomJavaCode X11GLImpl } - -CustomJavaCode X11GLImpl public boolean isFunctionAvailable(String glFunctionName) -CustomJavaCode X11GLImpl { -CustomJavaCode X11GLImpl return _context.isFunctionAvailable(glFunctionName); -CustomJavaCode X11GLImpl } - -CustomJavaCode X11GLImpl public boolean isExtensionAvailable(String glExtensionName) -CustomJavaCode X11GLImpl { -CustomJavaCode X11GLImpl return _context.isExtensionAvailable(glExtensionName); -CustomJavaCode X11GLImpl } - -CustomJavaCode X11GLImpl private X11GLContext _context; - -CustomJavaCode X11GLImpl /** -CustomJavaCode X11GLImpl * Provides platform-independent access to the wglAllocateMemoryNV / -CustomJavaCode X11GLImpl * glXAllocateMemoryNV extension. -CustomJavaCode X11GLImpl */ -CustomJavaCode X11GLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { -CustomJavaCode X11GLImpl return glXAllocateMemoryNV(arg0, arg1, arg2, arg3); -CustomJavaCode X11GLImpl } - -CustomJavaCode X11GLImpl public void setSwapInterval(int interval) { -CustomJavaCode X11GLImpl if (isExtensionAvailable("GLX_SGI_swap_control")) { -CustomJavaCode X11GLImpl glXSwapIntervalSGI(interval); -CustomJavaCode X11GLImpl } -CustomJavaCode X11GLImpl } - -IncludeAs CustomJavaCode X11GLImpl gl-impl-CustomJavaCode.java +IncludeAs CustomJavaCode GLImpl gl-impl-CustomJavaCode.java IncludeAs CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-macosx.cfg b/make/gl-macosx.cfg index a22b13477..37acea0ee 100644 --- a/make/gl-macosx.cfg +++ b/make/gl-macosx.cfg @@ -2,9 +2,6 @@ Package net.java.games.jogl Style InterfaceOnly JavaClass GL -Extends GL WGL -Extends GL GLX -Extends GL CGL Include gl-common-macosx.cfg EmitProcAddressTable false diff --git a/make/gl-wgl-win32.cfg b/make/gl-wgl-win32.cfg deleted file mode 100644 index fb5f9556e..000000000 --- a/make/gl-wgl-win32.cfg +++ /dev/null @@ -1,10 +0,0 @@ -# This .cfg file is used to generate the interface which contains the -# window system-specific extensions which are exposed (via -# inheritance) to the GL interface. -Package net.java.games.jogl -Style InterfaceOnly -JavaClass WGL -Include gl-common-win32.cfg - -# Ignore everything that doesn't start with wgl or WGL -Ignore ^[^wW].+ diff --git a/make/gl-win32.cfg b/make/gl-win32.cfg index 83cb3e3bd..fddf6d579 100644 --- a/make/gl-win32.cfg +++ b/make/gl-win32.cfg @@ -2,9 +2,6 @@ Package net.java.games.jogl Style InterfaceOnly JavaClass GL -Extends GL WGL -Extends GL GLX -Extends GL CGL Include gl-common-win32.cfg EmitProcAddressTable false diff --git a/make/gl-x11.cfg b/make/gl-x11.cfg index e20deed55..747469c0e 100644 --- a/make/gl-x11.cfg +++ b/make/gl-x11.cfg @@ -1,11 +1,7 @@ -# This .cfg file is used to generate the class which implements the GL -# interface on a particular platform. +# This .cfg file is used to generate the GL interface. Package net.java.games.jogl Style InterfaceOnly JavaClass GL -Extends GL WGL -Extends GL GLX -Extends GL CGL Include gl-common-x11.cfg EmitProcAddressTable false
\ No newline at end of file diff --git a/make/gl-glx-common.cfg b/make/glxext.cfg index a613149bc..06363c56c 100644..100755 --- a/make/gl-glx-common.cfg +++ b/make/glxext.cfg @@ -1,9 +1,62 @@ -# This .cfg file causes the core GLX routines to be ignored from both -# the public API as well as from the GL implementation files on -# non-X11 platforms. +# This .cfg file is used to generate the interface and implementing +# class for the GLX extensions. +Package net.java.games.jogl.impl.x11 +Style InterfaceAndImpl +JavaClass GLXExt +ImplPackage net.java.games.jogl.impl.x11 +ImplJavaClass GLXExtImpl +Include gl-common-x11.cfg -# Ignore all of the core GLX routines, which are exposed only in the -# implementation GLX class +EmitProcAddressTable true +ProcAddressTableClassName GLXExtProcAddressTable +ContextVariableName _context + +# Ignore everything that doesn't start with glX or GLX +IgnoreNot ^(glX|GLX).+ + +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 /* 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(X11GLContext 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 X11GLContext _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 @@ -60,8 +113,7 @@ Ignore glXSelectEventSGIX Ignore glXGetSelectedEventSGIX Ignore glXCreateGLXPixmapMESA -# Now we can ignore the GLXFBConfig and XVisualInfo data types in the -# public API on all platforms +# Now we can ignore the GLXFBConfig and XVisualInfo data types Ignore GLXFBConfig Ignore XVisualInfo diff --git a/make/stub_includes/macosx/cglext.c b/make/stub_includes/macosx/cglext.c new file mode 100755 index 000000000..14010fcc4 --- /dev/null +++ b/make/stub_includes/macosx/cglext.c @@ -0,0 +1 @@ +#include <cglext.h> diff --git a/make/stub_includes/win32/wglext.c b/make/stub_includes/win32/wglext.c new file mode 100755 index 000000000..9c6120411 --- /dev/null +++ b/make/stub_includes/win32/wglext.c @@ -0,0 +1,13 @@ +#define GLAPI + +// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +// "glext.h" are parsed. +#define GL_GLEXT_PROTOTYPES + +#include <GL/gl.h> + +// Bring in the wgl extensions +#define WGL_WGLEXT_PROTOTYPES +#define SKIP_WGL_HANDLE_DEFINITIONS +#include <windows.h> +#include <GL/wglext.h> diff --git a/make/stub_includes/common/gl-impl.c b/make/stub_includes/x11/glxext.c index 53221a21a..67906a088 100644 --- a/make/stub_includes/common/gl-impl.c +++ b/make/stub_includes/x11/glxext.c @@ -12,12 +12,3 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <GL/glxext.h> - -// Bring in the wgl extensions -#define WGL_WGLEXT_PROTOTYPES -#define SKIP_WGL_HANDLE_DEFINITIONS -#include <windows.h> -#include <GL/wglext.h> - -// Bring in the Mac OS X cgl extensions -#include <GL/cglext.h> diff --git a/make/wglext.cfg b/make/wglext.cfg new file mode 100644 index 000000000..58bd2d0fb --- /dev/null +++ b/make/wglext.cfg @@ -0,0 +1,58 @@ +# This .cfg file is used to generate the interface and implementing +# class for the WGL extensions. +Package net.java.games.jogl.impl.windows +Style InterfaceAndImpl +JavaClass WGLExt +ImplPackage net.java.games.jogl.impl.windows +ImplJavaClass WGLExtImpl +Include gl-common-win32.cfg + +EmitProcAddressTable true +ProcAddressTableClassName WGLExtProcAddressTable +ContextVariableName _context + +# Ignore everything that doesn't start with wgl or WGL +Ignore ^[^wW].+ + +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 /* This typedef is only needed for VC6 */ +CustomCCode #if _MSC_VER <= 1200 +CustomCCode typedef int intptr_t; +CustomCCode #endif + +CustomJavaCode WGLExt public boolean isFunctionAvailable(String glFunctionName); +CustomJavaCode WGLExt public boolean isExtensionAvailable(String glExtensionName); + +CustomJavaCode WGLExtImpl public WGLExtImpl(WindowsGLContext 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 WindowsGLContext _context; |