diff options
author | Kenneth Russel <[email protected]> | 2005-08-15 00:17:23 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-08-15 00:17:23 +0000 |
commit | 44120bea6928fded325a8100c9f4117b385964b6 (patch) | |
tree | 26afa887b7fc86271ba2b6391d8eb054abef96f6 | |
parent | b4afef9f93e722ab5f40a160eab5e55de86303d9 (diff) |
Added dual-context test. Changed
WindowsOnscreenGLDrawable.swapBuffers() to lock the surface if
necessary. Need to test this on other platforms and make similar
change if necessary.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@346 232f8b59-042b-4e1e-8c03-345bb8c30851
-rw-r--r-- | src/net/java/games/jogl/impl/windows/WindowsOnscreenGLDrawable.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLDrawable.java b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLDrawable.java index 479e8586d..7c385d4b2 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLDrawable.java +++ b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLDrawable.java @@ -94,11 +94,22 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { } public void swapBuffers() throws GLException { - // FIXME: currently must do this while the surface is locked - // (i.e., a context is current); fix and/or specify this? + boolean didLock = false; + + if (hdc == 0) { + if (lockSurface() == LOCK_SURFACE_NOT_READY) { + return; + } + didLock = true; + } + if (!WGL.SwapBuffers(hdc) && (WGL.GetLastError() != 0)) { throw new GLException("Error swapping buffers"); } + + if (didLock) { + unlockSurface(); + } } public int lockSurface() throws GLException { |