diff options
Diffstat (limited to 'src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java')
-rw-r--r-- | src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLDrawable.java | 34 |
1 files changed, 21 insertions, 13 deletions
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 |