From 5e36587af91f43faff49f4ff61c40cf084bae298 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 18 Jul 2005 21:28:47 +0000 Subject: Implemented pbuffer instantiation support in GLDrawableFactory rather than GLCanvas on Windows. Restructured GLJPanel and jogl-demos to use new APIs. Still needs to be ported to other platforms. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@326 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../impl/windows/WindowsPbufferGLDrawable.java | 68 ++++++++++++---------- 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'src/net/java/games/jogl/impl/windows/WindowsPbufferGLDrawable.java') diff --git a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLDrawable.java b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLDrawable.java index 6917b281d..d91feb27c 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLDrawable.java +++ b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLDrawable.java @@ -54,7 +54,11 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { private int floatMode; - public WindowsPbufferGLDrawable(GLCapabilities capabilities, int initialWidth, int initialHeight) { + public WindowsPbufferGLDrawable(GLCapabilities capabilities, + int initialWidth, + int initialHeight, + WindowsGLDrawable dummyDrawable, + GL gl) { super(null, capabilities, null); this.initWidth = initialWidth; this.initHeight = initialHeight; @@ -69,6 +73,8 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { (capabilities.getOffscreenRenderToTextureRectangle() ? " [rect]" : "") + (capabilities.getOffscreenFloatingPointBuffers() ? " [float]" : "")); } + + createPbuffer(dummyDrawable.getHDC(), gl); } public GLContext createContext(GLContext shareWith) { @@ -106,7 +112,36 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { return height; } - public void createPbuffer(GL gl, long parentHdc) { + public GLCapabilities getCapabilities() { + return capabilities; + } + + public long getPbuffer() { + return buffer; + } + + public int getFloatingPointMode() { + return floatMode; + } + + public void swapBuffers() throws GLException { + // FIXME: this doesn't make sense any more because we don't have + // access to our OpenGL context here + /* + // 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. + if (rtt && !hasRTT) { + if (DEBUG) { + System.err.println("Copying pbuffer data to GL_TEXTURE_2D state"); + } + + GL gl = getGL(); + gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, width, height); + } + */ + } + + private void createPbuffer(long parentHdc, GL gl) { int[] iattributes = new int [2*MAX_ATTRIBS]; float[] fattributes = new float[2*MAX_ATTRIBS]; int nfattribs = 0; @@ -358,35 +393,6 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { } } - public GLCapabilities getCapabilities() { - return capabilities; - } - - public long getPbuffer() { - return buffer; - } - - public int getFloatingPointMode() { - return floatMode; - } - - public void swapBuffers() throws GLException { - // FIXME: this doesn't make sense any more because we don't have - // access to our OpenGL context here - /* - // 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. - if (rtt && !hasRTT) { - if (DEBUG) { - System.err.println("Copying pbuffer data to GL_TEXTURE_2D state"); - } - - GL gl = getGL(); - gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, width, height); - } - */ - } - private static String wglGetLastError() { return WindowsGLContextFactory.wglGetLastError(); } -- cgit v1.2.3