From 35435c313ba527c9bea35a14f72492d2f80a9c84 Mon Sep 17 00:00:00 2001
From: Kenneth Russel <kbrussel@alum.mit.edu>
Date: Mon, 18 Jul 2005 23:15:37 +0000
Subject: Moved pbuffer creation support from MacOSXOnscreenGLDrawable to
 MacOSXGLContextFactory. This completes the transition from creating pbuffers
 as a subordinate object of a GLCanvas to creating them as standalone
 GLDrawables. Deleted code from GLAutoDrawable and all implementations related
 to pbuffer instantiation.

git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@328 232f8b59-042b-4e1e-8c03-345bb8c30851
---
 .../jogl/impl/macosx/MacOSXPbufferGLDrawable.java  | 34 +++++++++++++---------
 1 file changed, 21 insertions(+), 13 deletions(-)

(limited to 'src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java')

diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java
index fc5f3c22e..282d8a08b 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java
@@ -61,6 +61,8 @@ public class MacOSXPbufferGLDrawable extends MacOSXGLDrawable {
     super(capabilities, null);
     this.initWidth  = initialWidth;
     this.initHeight = initialHeight;
+
+    createPbuffer();
   }
 
   public GLContext createContext(GLContext shareWith) {
@@ -91,7 +93,19 @@ public class MacOSXPbufferGLDrawable extends MacOSXGLDrawable {
     return height;
   }
 
-  public void createPbuffer(GL gl) {
+  public GLCapabilities getCapabilities() {
+    return capabilities;
+  }
+
+  public long getPbuffer() {
+    return pBuffer;
+  }
+  
+  public void swapBuffers() throws GLException {
+    // FIXME: do we need to do anything if the pbuffer is double-buffered?
+  }
+
+  protected void createPbuffer() {
     int renderTarget;
     if (capabilities.getOffscreenRenderToTextureRectangle()) {
       width = initWidth;
@@ -105,9 +119,15 @@ public class MacOSXPbufferGLDrawable extends MacOSXGLDrawable {
 
     int internalFormat = GL.GL_RGBA;
     if (capabilities.getOffscreenFloatingPointBuffers()) {
+      // FIXME: want to check availability of GL_APPLE_float_pixels
+      // extension, but need valid OpenGL context in order to do so --
+      // in worst case would need to create dummy window / GLCanvas
+      // (undesirable) -- could maybe also do this with pbuffers
+      /*
       if (!gl.isExtensionAvailable("GL_APPLE_float_pixels")) {
 	throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available");
       }
+      */
       switch (capabilities.getRedBits()) {
         case 16: internalFormat = GL.GL_RGBA_FLOAT16_APPLE; break;
         case 32: internalFormat = GL.GL_RGBA_FLOAT32_APPLE; break;
@@ -125,18 +145,6 @@ public class MacOSXPbufferGLDrawable extends MacOSXGLDrawable {
     }
   }
 
-  public GLCapabilities getCapabilities() {
-    return capabilities;
-  }
-
-  public long getPbuffer() {
-    return pBuffer;
-  }
-  
-  public void swapBuffers() throws GLException {
-    // FIXME: do we need to do anything if the pbuffer is double-buffered?
-  }
-
   private int getNextPowerOf2(int number) {
     if (((number-1) & number) == 0) {
       //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
-- 
cgit v1.2.3