From 7c1f2cde56438a979ddaab5fecc09f663427be91 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 27 Jul 2005 00:30:06 +0000 Subject: 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 --- make/build.xml | 40 +++++------ make/cglext.cfg | 53 ++++++++++++++ make/gl-common-win32.cfg | 3 - make/gl-common-x11.cfg | 3 - make/gl-common.cfg | 11 +++ make/gl-glx-common.cfg | 85 ---------------------- make/gl-glx-x11.cfg | 14 ---- make/gl-impl-CustomCCode.c | 70 ++---------------- make/gl-impl-CustomJavaCode.java | 30 ++++++++ make/gl-impl-macosx.cfg | 56 +-------------- make/gl-impl-win32.cfg | 42 +---------- make/gl-impl-x11.cfg | 37 +--------- make/gl-macosx.cfg | 3 - make/gl-wgl-win32.cfg | 10 --- make/gl-win32.cfg | 3 - make/gl-x11.cfg | 6 +- make/glxext.cfg | 137 ++++++++++++++++++++++++++++++++++++ make/stub_includes/common/gl-impl.c | 23 ------ make/stub_includes/macosx/cglext.c | 1 + make/stub_includes/win32/wglext.c | 13 ++++ make/stub_includes/x11/glxext.c | 14 ++++ make/wglext.cfg | 58 +++++++++++++++ 22 files changed, 348 insertions(+), 364 deletions(-) create mode 100755 make/cglext.cfg delete mode 100644 make/gl-glx-common.cfg delete mode 100644 make/gl-glx-x11.cfg delete mode 100644 make/gl-wgl-win32.cfg create mode 100755 make/glxext.cfg delete mode 100644 make/stub_includes/common/gl-impl.c create mode 100755 make/stub_includes/macosx/cglext.c create mode 100755 make/stub_includes/win32/wglext.c create mode 100644 make/stub_includes/x11/glxext.c create mode 100644 make/wglext.cfg (limited to 'make') 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 @@ + + + + @@ -292,11 +296,15 @@ + + + + @@ -353,11 +361,15 @@ + + + + @@ -473,35 +485,17 @@ - - - - - - - - - - - - - - - - + + 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 +CustomCCode #include + +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 + +CustomCCode #include + +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-common.cfg b/make/gl-glx-common.cfg deleted file mode 100644 index a613149bc..000000000 --- a/make/gl-glx-common.cfg +++ /dev/null @@ -1,85 +0,0 @@ -# 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. - -# Ignore all of the core GLX routines, which are exposed only in the -# implementation GLX 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 in the -# public API on all platforms -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 - -# XID shows up in the public API (and shouldn't -- will be removed in -# the JSR 231/239 APIs) and needs to be treated as a long for now -Opaque long XID 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 -CustomCCode #include 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/glxext.cfg b/make/glxext.cfg new file mode 100755 index 000000000..06363c56c --- /dev/null +++ b/make/glxext.cfg @@ -0,0 +1,137 @@ +# 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 + +EmitProcAddressTable true +ProcAddressTableClassName GLXExtProcAddressTable +ContextVariableName _context + +# Ignore everything that doesn't start with glX or GLX +IgnoreNot ^(glX|GLX).+ + +CustomCCode #include +CustomCCode #include +CustomCCode #include + +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 +CustomCCode #include +CustomCCode #include + +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 +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 + +# XID shows up in the public API (and shouldn't -- will be removed in +# the JSR 231/239 APIs) and needs to be treated as a long for now +Opaque long XID diff --git a/make/stub_includes/common/gl-impl.c b/make/stub_includes/common/gl-impl.c deleted file mode 100644 index 53221a21a..000000000 --- a/make/stub_includes/common/gl-impl.c +++ /dev/null @@ -1,23 +0,0 @@ -#define GLAPI - -// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in -// "glext.h" are parsed. -#define GL_GLEXT_PROTOTYPES - -#include - -// Define GLX_GLXEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in -// "glxext.h" are parsed. -#define GLX_GLXEXT_PROTOTYPES -#include -#include -#include - -// Bring in the wgl extensions -#define WGL_WGLEXT_PROTOTYPES -#define SKIP_WGL_HANDLE_DEFINITIONS -#include -#include - -// Bring in the Mac OS X cgl extensions -#include 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 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 + +// Bring in the wgl extensions +#define WGL_WGLEXT_PROTOTYPES +#define SKIP_WGL_HANDLE_DEFINITIONS +#include +#include diff --git a/make/stub_includes/x11/glxext.c b/make/stub_includes/x11/glxext.c new file mode 100644 index 000000000..67906a088 --- /dev/null +++ b/make/stub_includes/x11/glxext.c @@ -0,0 +1,14 @@ +#define GLAPI + +// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in +// "glext.h" are parsed. +#define GL_GLEXT_PROTOTYPES + +#include + +// Define GLX_GLXEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in +// "glxext.h" are parsed. +#define GLX_GLXEXT_PROTOTYPES +#include +#include +#include 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 +CustomCCode #undef WIN32_LEAN_AND_MEAN +CustomCCode #include +CustomCCode #include +CustomCCode #include + +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 +CustomCCode #include + +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; -- cgit v1.2.3