summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/cgl-macosx.cfg2
-rw-r--r--make/stub_includes/macosx/window-system.c2
-rw-r--r--src/native/jogl/MacOSXWindowSystemInterface.m6
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java14
4 files changed, 18 insertions, 6 deletions
diff --git a/make/cgl-macosx.cfg b/make/cgl-macosx.cfg
index e4fad5a5f..ac91c252c 100644
--- a/make/cgl-macosx.cfg
+++ b/make/cgl-macosx.cfg
@@ -39,7 +39,7 @@ CustomCCode extern void updateContext(void* nsContext, void* nsView);
CustomCCode extern void* updateContextRegister(void* nsContext, void* nsView);
CustomCCode extern void updateContextUnregister(void* nsContext, void* nsView, void* updater);
-CustomCCode extern void* createPBuffer(int renderTarget, int width, int height);
+CustomCCode extern void* createPBuffer(int renderTarget, int internalFormat, int width, int height);
CustomCCode extern Bool destroyPBuffer(void* nsContext, void* pBuffer);
CustomCCode extern void setContextPBuffer(void* nsContext, void* pBuffer);
CustomCCode extern void setContextTextureImageToPBuffer(void* nsContext, void* pBuffer, int colorBuffer);
diff --git a/make/stub_includes/macosx/window-system.c b/make/stub_includes/macosx/window-system.c
index 8ce6120a3..d15406263 100644
--- a/make/stub_includes/macosx/window-system.c
+++ b/make/stub_includes/macosx/window-system.c
@@ -27,7 +27,7 @@ void updateContext(void* nsContext, void* nsView);
void* updateContextRegister(void* nsContext, void* nsView);
void updateContextUnregister(void* nsContext, void* nsView, void* updater);
-void* createPBuffer(int renderTarget, int width, int height);
+void* createPBuffer(int renderTarget, int internalFormat, int width, int height);
Bool destroyPBuffer(void* nsContext, void* pBuffer);
void setContextPBuffer(void* nsContext, void* pBuffer);
void setContextTextureImageToPBuffer(void* nsContext, void* pBuffer, int colorBuffer);
diff --git a/src/native/jogl/MacOSXWindowSystemInterface.m b/src/native/jogl/MacOSXWindowSystemInterface.m
index 46c50ceb7..f77c6f2c1 100644
--- a/src/native/jogl/MacOSXWindowSystemInterface.m
+++ b/src/native/jogl/MacOSXWindowSystemInterface.m
@@ -161,11 +161,11 @@ void updateContextUnregister(void* context, void* view, void* updater)
[contextUpdater release];
}
-void* createPBuffer(int renderTarget, int width, int height)
+void* createPBuffer(int renderTarget, int internalFormat, int width, int height)
{
- // fprintf(stderr, "createPBuffer renderTarget=%d width=%d height=%d\n", renderTarget, width, height);
+ // fprintf(stderr, "createPBuffer renderTarget=%d internalFormat=%d width=%d height=%d\n", renderTarget, internalFormat, width, height);
- NSOpenGLPixelBuffer* pBuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:renderTarget textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height];
+ NSOpenGLPixelBuffer* pBuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:renderTarget textureInternalFormat:internalFormat textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height];
return pBuffer;
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java
index bc046bcc1..d374230d9 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java
@@ -64,8 +64,20 @@ public class MacOSXPbufferGLContext extends MacOSXGLContext {
height = getNextPowerOf2(initHeight);
renderTarget = GL.GL_TEXTURE_2D;
}
+
+ int internalFormat = GL.GL_RGBA;
+ if (capabilities.getOffscreenFloatingPointBuffers()) {
+ 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;
+ default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)");
+ }
+ }
- pBuffer = CGL.createPBuffer(renderTarget, width, height);
+ pBuffer = CGL.createPBuffer(renderTarget, internalFormat, width, height);
if (pBuffer == 0) {
throw new GLException("pbuffer creation error: CGL.createPBuffer() failed");
}