aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx/cgl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-27 23:23:15 +0200
committerSven Gothel <[email protected]>2014-07-27 23:23:15 +0200
commit15b9e36e80d6f62f7dfb5c45d00cd04de2007ee5 (patch)
treeee7b7e78e47ed9d2ea504b7232825b1d13a71071 /src/jogl/classes/jogamp/opengl/macosx/cgl
parent007f120cd8d33e4231ef4d207b85ed156d1e0c82 (diff)
Bug 1035 - Allow Gamma [Brightness, Contrast] settings to be performed on display/screen of a NativeSurface
Currently GLDrawableFactoryImpl's gamma settings are performed only on the main screen. Allow passing a NativeSurface, so it's display/screen gamma values will be changed. Further, promote low-level gamma settings to GLDrawableFactory for direct usage. Change com.jogamp.opengl.util.Gamma to use a GLDrawable instead of a GL object to clarify that we use the drawable. Also add a GLAutoDrawable variant, allowing proper locking of its 'upstream-lock' to guarantee atomicity. +++ Tested manually w/ TestGearsES2NEWT on X11 and Windows using the 'g' and 'G' to modify gamma. Value is properly reset on exit.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 7c05b8eab..045abca4c 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -42,6 +42,7 @@ package jogamp.opengl.macosx.cgl;
import java.nio.Buffer;
import java.nio.FloatBuffer;
+import java.nio.ShortBuffer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -404,24 +405,29 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
/** Returns the length of the computed gamma ramp for this OS and
hardware. Returns 0 if gamma changes are not supported. */
@Override
- protected int getGammaRampLength() {
+ protected int getGammaRampLength(final NativeSurface surface) {
return GAMMA_RAMP_LENGTH;
}
@Override
- protected boolean setGammaRamp(final float[] ramp) {
+ protected boolean setGammaRamp(final NativeSurface surface, final float[] ramp) {
final FloatBuffer rampNIO = Buffers.newDirectFloatBuffer(ramp);
-
return CGL.setGammaRamp(ramp.length, rampNIO, rampNIO, rampNIO);
}
@Override
- protected Buffer getGammaRamp() {
- return null;
+ protected Buffer getGammaRamp(final NativeSurface surface) {
+ return ShortBuffer.allocate(0); // return a dummy gamma ramp default for reset
}
@Override
- protected void resetGammaRamp(final Buffer originalGammaRamp) {
+ protected void resetGammaRamp(final NativeSurface surface, final Buffer originalGammaRamp) {
CGL.resetGammaRamp();
}
+
+ @Override
+ protected final void resetGammaRamp(final DeviceScreenID deviceScreenID, final Buffer originalGammaRamp) {
+ CGL.resetGammaRamp();
+ }
+
}