aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/impl/macosx/cgl
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-03-19 00:32:21 +0000
committerKenneth Russel <[email protected]>2009-03-19 00:32:21 +0000
commitc4cd0db6b9865c97245921d2824bcc4c1541e615 (patch)
tree6f9df4a383767992fa9ec36d820630bfabedf75a /src/jogl/classes/com/sun/opengl/impl/macosx/cgl
parent23d13ee00ebdf7052299fc65af6f50e43d673e67 (diff)
Movement of Capabilities class and chooseCapabilities functionality
into NativeWindowFactory introduced an undesirable dependence between the windowing toolkit, which can be replaced via NativeWindowFactory, and the library which implements the selection algorithm, for example OpenGL. This would prevent, for example, an easy SWT port of JOGL. To fix this, refactored chooseCapabilities into new GraphicsConfigurationFactory, the default implementation of which is currently a no-op on X11 platforms, and which is provided by JOGL in a toolkit-agnostic manner via GLX. Refactored OpenGL portions of Capabilities class back into GLCapabilities. Reintroduced GLCapabilitiesChooser interface for compatibility and to avoid having to import javax.media.nativewindow classes in most user code. Fixed problem in GLProfile where failures to load native libraries were being squelched. Reorganized build to have all outputs under build/ directory. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1884 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/macosx/cgl')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java12
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java12
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java22
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java2
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java4
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java8
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java4
7 files changed, 29 insertions, 35 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index 4e4c2e329..62bacdda1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -111,7 +111,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
int[] viewNotReady = new int[1];
- NWCapabilities capabilities = drawable.getRequestedNWCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
int[] iattribs = new int[128];
int[] ivalues = new int[128];
int idx = 0;
@@ -140,7 +140,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
long pixelFormat = CGL.createPixelFormat(iattribs, 0, idx, ivalues, 0);
if (pixelFormat == 0) {
- throw new GLException("Unable to allocate pixel format with requested NWCapabilities");
+ throw new GLException("Unable to allocate pixel format with requested GLCapabilities");
}
try {
// Try to allocate a context with this
@@ -168,10 +168,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
// context and not the drawable. However it's a reasonable
// approximation to just store the chosen pixel format up in the
// drawable since the public API doesn't provide for a different
- // NWCapabilities per context.
- if (drawable.getChosenNWCapabilities() == null) {
+ // GLCapabilities per context.
+ if (drawable.getChosenGLCapabilities() == null) {
// Figure out what attributes we really got
- NWCapabilities caps = new NWCapabilities();
+ GLCapabilities caps = new GLCapabilities();
CGL.queryPixelFormat(pixelFormat, iattribs, 0, idx, ivalues, 0);
for (int i = 0; i < idx; i++) {
int attr = iattribs[i];
@@ -235,7 +235,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
- drawable.setChosenNWCapabilities(caps);
+ drawable.setChosenGLCapabilities(caps);
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
index 67358878e..7dc94b74d 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
@@ -46,7 +46,7 @@ import com.sun.opengl.impl.*;
public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
protected static final boolean DEBUG = Debug.debug("MacOSXCGLDrawable");
- protected NWCapabilitiesChooser chooser;
+ protected GLCapabilitiesChooser chooser;
// The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs
// to represent the contexts for e.g. the Java2D back buffer. When
@@ -82,18 +82,18 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
public static final int CGL_MODE = 2;
public MacOSXCGLDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized,
- NWCapabilities requestedCapabilities, NWCapabilitiesChooser chooser) {
+ GLCapabilities requestedCapabilities, GLCapabilitiesChooser chooser) {
super(factory, comp, requestedCapabilities, realized);
this.chooser = chooser;
}
// These are public to allow access from a couple of context implementations
- public void setChosenNWCapabilities(NWCapabilities caps) {
- super.setChosenNWCapabilities(caps);
+ public void setChosenGLCapabilities(GLCapabilities caps) {
+ super.setChosenGLCapabilities(caps);
}
- public NWCapabilities getRequestedNWCapabilities() {
- return super.getRequestedNWCapabilities();
+ public GLCapabilities getRequestedGLCapabilities() {
+ return super.getRequestedGLCapabilities();
}
protected static String getThreadName() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 318b6b123..2868a0899 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -51,30 +51,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
super();
}
- public AbstractGraphicsConfiguration chooseGraphicsConfiguration(NWCapabilities capabilities,
- NWCapabilitiesChooser chooser,
- AbstractGraphicsDevice device) {
- return null;
- }
-
public GLDrawable createGLDrawable(NativeWindow target,
- NWCapabilities capabilities,
- NWCapabilitiesChooser chooser) {
+ GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
target = NativeWindowFactory.getNativeWindow(target);
if (capabilities == null) {
- capabilities = new NWCapabilities();
+ capabilities = new GLCapabilities();
}
if (chooser == null) {
- chooser = new DefaultNWCapabilitiesChooser();
+ chooser = new DefaultGLCapabilitiesChooser();
}
return new MacOSXOnscreenCGLDrawable(this, target, capabilities, chooser);
}
- public GLDrawableImpl createOffscreenDrawable(NWCapabilities capabilities,
- NWCapabilitiesChooser chooser,
+ public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
int width,
int height) {
return new MacOSXOffscreenCGLDrawable(this, capabilities, width, height);
@@ -84,8 +78,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return true;
}
- public GLPbuffer createGLPbuffer(final NWCapabilities capabilities,
- final NWCapabilitiesChooser chooser,
+ public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
+ final GLCapabilitiesChooser chooser,
final int initialWidth,
final int initialHeight,
final GLContext shareWith) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
index 42eab51a1..ee469b71f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
@@ -46,7 +46,7 @@ import com.sun.opengl.impl.*;
public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable {
public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory,
- NWCapabilities capabilities,
+ GLCapabilities capabilities,
int width,
int height) {
super(factory, capabilities, width, height);
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index 42e3957c2..12fc7c3ad 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -52,8 +52,8 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
new ArrayList();
protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeWindow component,
- NWCapabilities capabilities,
- NWCapabilitiesChooser chooser) {
+ GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser) {
super(factory, component, false, capabilities, chooser);
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 7141778ae..f8241af0d 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -81,7 +81,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
// Initialize render-to-texture support if requested
GL gl = getGL();
- boolean rect = gl.isGL2() && drawable.getRequestedNWCapabilities().getPbufferRenderToTextureRectangle();
+ boolean rect = gl.isGL2() && drawable.getRequestedGLCapabilities().getPbufferRenderToTextureRectangle();
if (rect) {
if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) {
System.err.println("MacOSXPbufferCGLContext: WARNING: GL_EXT_texture_rectangle extension not " +
@@ -136,7 +136,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
}
protected boolean create() {
- NWCapabilities capabilities = drawable.getRequestedNWCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
@@ -211,7 +211,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
// NSOpenGLContext-based implementation
class NSOpenGLImpl implements Impl {
public long create() {
- NWCapabilities capabilities = drawable.getRequestedNWCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
!isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
@@ -266,7 +266,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
int[] attrs = new int[256];
int i = 0;
attrs[i++] = CGL.kCGLPFAPBuffer;
- NWCapabilities capabilities = drawable.getRequestedNWCapabilities();
+ GLCapabilities capabilities = drawable.getRequestedGLCapabilities();
if (capabilities.getPbufferFloatingPointBuffers())
attrs[i++] = CGL.kCGLPFAColorFloat;
if (capabilities.getDoubleBuffered())
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 6be7392b0..d8dea7595 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -57,7 +57,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// semantic is that contains an NSView
protected long pBuffer;
- public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NWCapabilities capabilities, int width, int height) {
+ public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, GLCapabilities capabilities, int width, int height) {
super(factory, new NullWindow(), true, capabilities, null);
NullWindow nw = (NullWindow) getNativeWindow();
nw.setSize(width, height);
@@ -90,7 +90,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
private void createPbuffer() {
NullWindow nw = (NullWindow) getNativeWindow();
int renderTarget;
- NWCapabilities capabilities = getRequestedNWCapabilities();
+ GLCapabilities capabilities = getRequestedGLCapabilities();
if (GLProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) {
renderTarget = GL2.GL_TEXTURE_RECTANGLE;
} else {