aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/windows
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-02-03 23:25:53 +0000
committerKenneth Russel <[email protected]>2005-02-03 23:25:53 +0000
commit8da5bfa2d72282bfdcd2889a70a93a4072221a1c (patch)
tree13b9ecce060f1ba23ba83e7f502fa928a4c76848 /src/net/java/games/jogl/impl/windows
parentdfbee835b5a50b1c6219bd53e15823ea83d73dd6 (diff)
Fixed Issue 44: Add pbuffer-based GLJPanel implementation
Fixed Issue 61: Make debug variables load from system properties Added a hardware acceleration path for GLJPanel implemented using the GLPbuffer interfaces. If instantiation of the pbuffer fails, the GLJPanel implementation attempts to catch the resulting exception and fall back on the existing software rendering path. The new code has been successfully tested on Windows. This checkin attempts to make the needed changes to the pbuffer implementation on other platforms, but the GLJPanel continues to use software rendering until all platforms can be tested. Additionally, references to static final DEBUG flags have been made settable via system properties. "jogl.verbose" enables certain printing statements. "jogl.debug" enables all debugging printing. "jogl.debug.GLContext" enables the debug printing inside the GLContext class. The system property names are chosen by convention and are not enforced. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@209 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/windows')
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java3
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java24
2 files changed, 25 insertions, 2 deletions
diff --git a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java
index 9e871caba..5743253a0 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java
@@ -172,7 +172,8 @@ public class WindowsOffscreenGLContext extends WindowsGLContext {
}
hbitmap = WGL.CreateDIBSection(hdc, info, WGL.DIB_RGB_COLORS, 0, 0, 0);
if (hbitmap == 0) {
- throw new GLException("Error creating offscreen bitmap");
+ throw new GLException("Error creating offscreen bitmap of width " + width +
+ ", height " + height);
}
if ((origbitmap = WGL.SelectObject(hdc, hbitmap)) == 0) {
throw new GLException("Error selecting bitmap into new device context");
diff --git a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java
index d3795905f..9d803d58a 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java
@@ -43,7 +43,7 @@ import net.java.games.jogl.*;
import net.java.games.jogl.impl.*;
public class WindowsPbufferGLContext extends WindowsGLContext {
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = Debug.debug("WindowsPbufferGLContext");
private int initWidth;
private int initHeight;
@@ -308,10 +308,16 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
if (buffer == 0) {
// pbuffer not instantiated yet
+ if (DEBUG) {
+ System.err.println("pbuffer not instantiated yet");
+ }
return false;
}
boolean res = super.makeCurrent(initAction);
+ if (DEBUG) {
+ System.err.println("super.makeCurrent() = " + res + ", created = " + created);
+ }
if (created) {
// Initialize render-to-texture support if requested
rtt = capabilities.getOffscreenRenderToTexture();
@@ -396,6 +402,22 @@ public class WindowsPbufferGLContext extends WindowsGLContext {
}
}
+ protected void destroyImpl() throws GLException {
+ if (hglrc != 0) {
+ super.destroyImpl();
+ // Must release DC and pbuffer
+ GL gl = getGL();
+ if (gl.wglReleasePbufferDCARB(buffer, hdc) == 0) {
+ throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError());
+ }
+ hdc = 0;
+ if (!gl.wglDestroyPbufferARB(buffer)) {
+ throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError());
+ }
+ buffer = 0;
+ }
+ }
+
public void swapBuffers() throws GLException {
// FIXME: do we need to do anything if the pbuffer is double-buffered?
// For now, just grab the pixels for the render-to-texture support.