summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLCapabilities.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java19
2 files changed, 29 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java
index 02aa47119..411951851 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java
@@ -99,6 +99,16 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
}
/**
+ * Copies all {@link CapabilitiesImmutable} values
+ * from <code>source</code> into this instance.
+ * @return this instance
+ */
+ public GLCapabilities copyFrom(final CapabilitiesImmutable source) {
+ super.copyFrom(source);
+ return this;
+ }
+
+ /**
* Copies all {@link GLCapabilitiesImmutable} values
* from <code>source</code> into this instance.
* @return this instance
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index 1d9a9732d..02bbafc95 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -220,6 +220,25 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
/**
+ * Returns a {@link GLCapabilitiesImmutable} based on the given {@link CapabilitiesImmutable}.
+ * <p>
+ * If the given {@code caps} is an instance of {@link GLCapabilitiesImmutable}, same reference will be returned,
+ * otherwise a new {@link GLCapabilitiesImmutable} using the default EGL GLProfile will be created and all
+ * given {@link CapabilitiesImmutable} values copied into.
+ * </p>
+ * @param caps
+ * @return immutable {@link GLCapabilitiesImmutable} either identical to {@code caps} or a new instance, see above.
+ */
+ public static final GLCapabilitiesImmutable castOrCopyImmutable(final CapabilitiesImmutable caps) {
+ if ( caps instanceof GLCapabilitiesImmutable ) {
+ return (GLCapabilitiesImmutable)caps;
+ } else {
+ final GLCapabilities glCapsReq = new GLCapabilities( GLProfile.getDefault( GLDrawableFactory.getEGLFactory().getDefaultDevice() ) );
+ return glCapsReq.copyFrom(caps);
+ }
+ }
+
+ /**
* Called mainly by {@link #chooseGraphicsConfigurationImpl(CapabilitiesImmutable, CapabilitiesImmutable, CapabilitiesChooser, AbstractGraphicsScreen, int)}
* @param capsChosen the intermediate chosen capabilities to be refined by this implementation, may be equal to capsRequested
* @param capsReq the original requested capabilities