diff options
author | Kenneth Russel <[email protected]> | 2005-04-24 00:10:41 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-04-24 00:10:41 +0000 |
commit | bafff33544dae0f28a0a7141d2a4ee05295ea2ec (patch) | |
tree | 52ab68a2f188a8f207474ab3c80d2abeaa125bb0 /make | |
parent | 95a1681443162db968c5430097780bfd0ade0a68 (diff) |
Fixed Issue 92: Platform Independent VSync functionality
Added GL.setSwapInterval() which delegates to appropriate
platform-dependent routines. Must be called only from within
GLEventListener callbacks.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@260 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make')
-rw-r--r-- | make/cgl-macosx.cfg | 2 | ||||
-rw-r--r-- | make/gl-common.cfg | 10 | ||||
-rw-r--r-- | make/gl-impl-macosx.cfg | 4 | ||||
-rw-r--r-- | make/gl-impl-win32.cfg | 6 | ||||
-rw-r--r-- | make/gl-impl-x11.cfg | 6 | ||||
-rw-r--r-- | make/stub_includes/macosx/window-system.c | 2 |
6 files changed, 30 insertions, 0 deletions
diff --git a/make/cgl-macosx.cfg b/make/cgl-macosx.cfg index c7a7f3841..dab1ec206 100644 --- a/make/cgl-macosx.cfg +++ b/make/cgl-macosx.cfg @@ -45,6 +45,8 @@ CustomCCode extern void setContextTextureImageToPBuffer(void* nsContext, void* p CustomCCode extern void* getProcAddress(const char *procName); +CustomCCode extern void setSwapInterval(void* nsContext, int interval); + # Implement the first argument to getProcAddress as String instead # of byte[] ArgumentIsString getProcAddress 0 diff --git a/make/gl-common.cfg b/make/gl-common.cfg index 703715979..20bcaebe0 100644 --- a/make/gl-common.cfg +++ b/make/gl-common.cfg @@ -332,6 +332,16 @@ CustomJavaCode GL * {@link GLX#glXAllocateMemoryNV} 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); + # # Directives needed when processing wglext.h on Windows and other platforms # diff --git a/make/gl-impl-macosx.cfg b/make/gl-impl-macosx.cfg index 8ce128851..5a09750dd 100644 --- a/make/gl-impl-macosx.cfg +++ b/make/gl-impl-macosx.cfg @@ -73,5 +73,9 @@ 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 CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-impl-win32.cfg b/make/gl-impl-win32.cfg index bf4f93998..252425659 100644 --- a/make/gl-impl-win32.cfg +++ b/make/gl-impl-win32.cfg @@ -60,5 +60,11 @@ CustomJavaCode WindowsGLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int 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 CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-impl-x11.cfg b/make/gl-impl-x11.cfg index 33527d351..b60a28787 100644 --- a/make/gl-impl-x11.cfg +++ b/make/gl-impl-x11.cfg @@ -57,5 +57,11 @@ CustomJavaCode X11GLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int arg 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 CustomCCode gl-impl-CustomCCode.c diff --git a/make/stub_includes/macosx/window-system.c b/make/stub_includes/macosx/window-system.c index e5ba4307f..b30c252f3 100644 --- a/make/stub_includes/macosx/window-system.c +++ b/make/stub_includes/macosx/window-system.c @@ -32,3 +32,5 @@ void setContextPBuffer(void* nsContext, void* pBuffer); void setContextTextureImageToPBuffer(void* nsContext, void* pBuffer, int colorBuffer); void* getProcAddress(const char *procName); + +void setSwapInterval(void* nsContext, int interval); |