diff options
author | Sven Gothel <[email protected]> | 2011-09-09 15:43:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-09 15:43:51 +0200 |
commit | 8def3e243401a0fe8ce606de6a54381a65626f15 (patch) | |
tree | f41e107ade84b5eedcd64063b997f791073d4117 /src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java | |
parent | 2083ba25be5ce9b55cc2f5a420f17c3bb5ff1750 (diff) |
*GLContext: resetStates(); getPlatformExtensionsString(); GLX/WGL NV_swap_group support; setSwapInterval();
resetStates()
- fixes a bug where X11GLXContext impl. resetState() !!
- marked all with @Override tag
- ensured super.resetStates() is called at end (oops)
getPlatformExtensionsStringImpl()*
- fixes a bug where X11GLXContext overrides GLContext cached GLX extension string query
- marked 'final' in GLContext to avoid bugs
- using abstract 'getPlatformExtensionsStringImpl()' called by ExtensionAvailabilityCache
Add premiliry GLX/WGL NV_swap_group support
- thought it might be a solution to sync swap of 2 windows
- none of my drivers/platforms support it, event though extension is avail on Linux
Promote setSwapInterval() (1 up)
- bumped above API up to public GLContext
- those extension should not spam the GL interfaces .. hmm
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java index 971b32d47..a35137f15 100644 --- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java @@ -41,6 +41,7 @@ package jogamp.opengl; import javax.media.opengl.*; + import java.util.*; /** @@ -132,9 +133,9 @@ final class ExtensionAvailabilityCache { if(useGetStringi) { GL2GL3 gl2gl3 = gl.getGL2GL3(); int[] numExtensions = { 0 } ; - gl2gl3.glGetIntegerv(gl2gl3.GL_NUM_EXTENSIONS, numExtensions, 0); + gl2gl3.glGetIntegerv(GL2GL3.GL_NUM_EXTENSIONS, numExtensions, 0); for (int i = 0; i < numExtensions[0]; i++) { - sb.append(gl2gl3.glGetStringi(gl2gl3.GL_EXTENSIONS, i)); + sb.append(gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i)); if(i < numExtensions[0]) { sb.append(" "); } @@ -151,8 +152,21 @@ final class ExtensionAvailabilityCache { sb.append(gl.glGetString(GL.GL_EXTENSIONS)); } glExtensions = sb.toString(); - glXExtensions = context.getPlatformExtensionsString(); - + + // Platform Extensions + { + // unify platform extension .. might have duplicates + HashSet<String> platformSet = new HashSet<String>(50); + StringTokenizer tok = new StringTokenizer(context.getPlatformExtensionsStringImpl().toString()); + while (tok.hasMoreTokens()) { + platformSet.add(tok.nextToken().trim()); + } + final StringBuffer sb2 = new StringBuffer(); + for(Iterator<String> iter = platformSet.iterator(); iter.hasNext(); ) { + sb2.append(iter.next()).append(" "); + } + glXExtensions = sb2.toString(); + } sb.append(" "); sb.append(glXExtensions); @@ -210,7 +224,7 @@ final class ExtensionAvailabilityCache { private boolean initialized = false; private String glExtensions = null; private String glXExtensions = null; - private HashSet availableExtensionCache = new HashSet(50); + private HashSet<String> availableExtensionCache = new HashSet<String>(50); private GLContextImpl context; static String getThreadName() { |