aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx/cgl/awt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-25 06:11:14 +0200
committerSven Gothel <[email protected]>2011-10-25 06:11:14 +0200
commit4433f2a68fa3ca500e258a6862b0e95461fc5083 (patch)
tree9d0b33c44218834d403272a0a241f2e55c95a5ed /src/jogl/classes/jogamp/opengl/macosx/cgl/awt
parent3b6ef84e25a3fcaa2de381be3758c144ae239b6a (diff)
MacOSX: Pull down (and fix releaseContext) NSOPENGL/CGL mode/impl, fixes SWT usage and FBOMRT
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl/awt')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java51
1 files changed, 15 insertions, 36 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
index 5e661b321..ae58f6811 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
@@ -39,12 +39,16 @@
package jogamp.opengl.macosx.cgl.awt;
-import jogamp.opengl.macosx.cgl.*;
-
import java.awt.Graphics;
-import javax.media.opengl.*;
-import jogamp.opengl.*;
-import jogamp.opengl.awt.*;
+
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLException;
+
+import jogamp.opengl.awt.Java2D;
+import jogamp.opengl.awt.Java2DGLContext;
+import jogamp.opengl.macosx.cgl.MacOSXCGLContext;
+import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType;
+
/** MacOSXCGLContext implementation supporting the Java2D/JOGL bridge
* on Mac OS X. The external GLDrawable mechanism does not work on Mac
@@ -76,37 +80,14 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
}
protected boolean createImpl() {
- // Find and configure share context
- MacOSXCGLContext other = (MacOSXCGLContext) GLContextShareSet.getShareContext(this);
- long share = 0;
- if (other != null) {
- // Reconfigure pbuffer-based GLContexts
- if (other instanceof MacOSXPbufferCGLContext) {
- MacOSXPbufferCGLContext ctx = (MacOSXPbufferCGLContext) other;
- ctx.setOpenGLMode(MacOSXCGLDrawable.CGL_MODE);
- } else {
- if (other.getOpenGLMode() != MacOSXCGLDrawable.CGL_MODE) {
- throw new GLException("Can't share between NSOpenGLContexts and CGLContextObjs");
- }
- }
- share = other.getHandle();
- // Note we don't check for a 0 return value, since switching
- // the context's mode causes it to be destroyed and not
- // re-initialized until the next makeCurrent
- }
-
- if (DEBUG) {
- System.err.println("!!! Share context is " + toHexString(share) + " for " + getClass().getName());
- }
-
+ long share = createImplPreset();
+
long ctx = Java2D.createOGLContextOnSurface(graphics, share);
if (ctx == 0) {
return false;
}
setGLFunctionAvailability(true, true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
- // FIXME: think about GLContext sharing
contextHandle = ctx;
- isNSContext = true;
return true;
}
@@ -120,12 +101,10 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
Java2D.destroyOGLContext(contextHandle);
}
- public void setOpenGLMode(int mode) {
- if (mode != MacOSXCGLDrawable.CGL_MODE)
+ public void setOpenGLMode(GLBackendType mode) {
+ if (mode != GLBackendType.CGL) {
throw new GLException("OpenGL mode switching not supported for Java2D GLContexts");
- }
-
- public int getOpenGLMode() {
- return MacOSXCGLDrawable.CGL_MODE;
+ }
+ super.setOpenGLMode(mode);
}
}