summaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/javax/media/opengl')
-rw-r--r--src/classes/javax/media/opengl/GLCanvas.java7
-rw-r--r--src/classes/javax/media/opengl/GLDrawable.java10
-rw-r--r--src/classes/javax/media/opengl/GLJPanel.java17
3 files changed, 34 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/GLCanvas.java b/src/classes/javax/media/opengl/GLCanvas.java
index 83072ffc5..3848cca2c 100644
--- a/src/classes/javax/media/opengl/GLCanvas.java
+++ b/src/classes/javax/media/opengl/GLCanvas.java
@@ -245,6 +245,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction);
}
+ public GLCapabilities getChosenGLCapabilities() {
+ if (drawable == null)
+ return null;
+
+ return drawable.getChosenGLCapabilities();
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//
diff --git a/src/classes/javax/media/opengl/GLDrawable.java b/src/classes/javax/media/opengl/GLDrawable.java
index 13b905167..6c0178474 100644
--- a/src/classes/javax/media/opengl/GLDrawable.java
+++ b/src/classes/javax/media/opengl/GLDrawable.java
@@ -119,4 +119,14 @@ public interface GLDrawable {
is enabled (as is the default), this method is called
automatically and should not be called by the end user. */
public void swapBuffers() throws GLException;
+
+ /** Fetches the {@link GLCapabilities} corresponding to the chosen
+ OpenGL capabilities (pixel format / visual) for this drawable.
+ Some drawables, in particular on-screen drawables, may be
+ created lazily; null is returned if the drawable is not
+ currently created or if its pixel format has not been set yet.
+ On some platforms, the pixel format is not directly associated
+ with the drawable; a best attempt is made to return a reasonable
+ value in this case. */
+ public GLCapabilities getChosenGLCapabilities();
}
diff --git a/src/classes/javax/media/opengl/GLJPanel.java b/src/classes/javax/media/opengl/GLJPanel.java
index e69c03c2f..3340c75d4 100644
--- a/src/classes/javax/media/opengl/GLJPanel.java
+++ b/src/classes/javax/media/opengl/GLJPanel.java
@@ -793,6 +793,23 @@ public class GLJPanel extends JPanel implements GLAutoDrawable {
return oglPipelineEnabled;
}
+ public GLCapabilities getChosenGLCapabilities() {
+ if (oglPipelineEnabled) {
+ // FIXME: should do better than this; is it possible to using only platform-independent code?
+ return new GLCapabilities();
+ }
+
+ if (hardwareAccelerationDisabled) {
+ if (offscreenDrawable != null)
+ return offscreenDrawable.getChosenGLCapabilities();
+ } else {
+ if (pbuffer != null)
+ return pbuffer.getChosenGLCapabilities();
+ }
+
+ return null;
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//