aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/macosx/cgl
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-12-20 08:58:00 +0000
committerKenneth Russel <[email protected]>2008-12-20 08:58:00 +0000
commit6eda9476e8168bacdeb1854540d89bd9db0d5029 (patch)
tree692317f9924638836b16bf83a9cefe0c1047bb66 /src/classes/com/sun/opengl/impl/macosx/cgl
parent14a94c810910f88d3b7214ae9be5027dc74df39f (diff)
Factored out the remaining toolkit, and specifically AWT, dependencies
from GLDrawableFactory implementations into NativeWindowFactory implementations. These dependencies were the up-front selection of the GraphicsConfiguration and the locking and unlocking of the toolkit, which are both currently needed only on X11 platforms due to how OpenGL and the window system interact there. Added X11GraphicsDevice and X11GraphicsConfiguration classes which are intended to be used by Newt or potentially other third-party window toolkits. Unified the separate NativeWindow and AWT GLDrawableFactory implementations in the GLDrawableFactory class. Exposed the toolkit locking mechanism through the NativeWindowFactory and introduced the concept of a default NativeWindowFactory which is used by the X11 drawable and context implementations. Removed unnecessary toolkit locking calls from Mac OS X and Windows drawable and context implementations. Added a registration mechanism for new NativeWindowFactories, allowing third parties to plug in new window toolkits orthogonally to the OpenGL drawable and context code. The public APIs for the NativeWindowFactory and the GLDrawableFactory, in particular how they are fetched, changed as a result of these refactorings. Updated all uses. Fixed bug in X11OffscreenGLXDrawable introduced during last set of changes. Tested demos on Solaris, Mac OS X and Windows. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1824 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/macosx/cgl')
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java86
1 files changed, 38 insertions, 48 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index dfd970070..81f4abb8f 100644
--- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -68,17 +68,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
public void destroy() {
- getFactoryImpl().lockToolkit();
- try {
- if (this.pBuffer != 0) {
- impl.destroy(pBuffer);
- this.pBuffer = 0;
- if (DEBUG) {
- System.err.println("Destroyed pbuffer: " + pBuffer);
- }
- }
- } finally {
- getFactoryImpl().unlockToolkit();
+ if (this.pBuffer != 0) {
+ impl.destroy(pBuffer);
+ this.pBuffer = 0;
+ if (DEBUG) {
+ System.err.println("Destroyed pbuffer: " + pBuffer);
+ }
}
super.destroy();
}
@@ -93,47 +88,42 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
private void createPbuffer() {
NullWindow nw = (NullWindow) getNativeWindow();
- getFactoryImpl().lockToolkit();
- try {
- int renderTarget;
- GLCapabilities capabilities = getRequestedGLCapabilities();
- if (GLProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) {
- renderTarget = GL2.GL_TEXTURE_RECTANGLE;
- } else {
- int w = getNextPowerOf2(getWidth());
- int h = getNextPowerOf2(getHeight());
- nw.setSize(w, h);
- renderTarget = GL.GL_TEXTURE_2D;
- }
+ int renderTarget;
+ GLCapabilities capabilities = getRequestedGLCapabilities();
+ if (GLProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) {
+ renderTarget = GL2.GL_TEXTURE_RECTANGLE;
+ } else {
+ int w = getNextPowerOf2(getWidth());
+ int h = getNextPowerOf2(getHeight());
+ nw.setSize(w, h);
+ renderTarget = GL.GL_TEXTURE_2D;
+ }
- int internalFormat = GL.GL_RGBA;
- if (capabilities.getPbufferFloatingPointBuffers()) {
- // 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")) {
+ int internalFormat = GL.GL_RGBA;
+ if (capabilities.getPbufferFloatingPointBuffers()) {
+ // 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 GLUnsupportedException("Floating-point support (GL_APPLE_float_pixels) not available");
- }
- */
- if(GLProfile.isGL2()) {
- switch (capabilities.getRedBits()) {
- case 16: internalFormat = GL2.GL_RGBA_FLOAT16_APPLE; break;
- case 32: internalFormat = GL2.GL_RGBA_FLOAT32_APPLE; break;
- default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)");
- }
- } else {
- internalFormat = GL.GL_RGBA;
- }
}
-
- pBuffer = impl.create(renderTarget, internalFormat, getWidth(), getHeight());
- if (pBuffer == 0) {
- throw new GLException("pbuffer creation error: CGL.createPBuffer() failed");
+ */
+ if(GLProfile.isGL2()) {
+ switch (capabilities.getRedBits()) {
+ case 16: internalFormat = GL2.GL_RGBA_FLOAT16_APPLE; break;
+ case 32: internalFormat = GL2.GL_RGBA_FLOAT32_APPLE; break;
+ default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)");
}
- } finally {
- getFactoryImpl().unlockToolkit();
+ } else {
+ internalFormat = GL.GL_RGBA;
+ }
+ }
+
+ pBuffer = impl.create(renderTarget, internalFormat, getWidth(), getHeight());
+ if (pBuffer == 0) {
+ throw new GLException("pbuffer creation error: CGL.createPBuffer() failed");
}
if (DEBUG) {