public class Gamma extends Object
Thanks to the LWJGL project for illustrating how to access gamma control on the various platforms.
Modifier and Type | Method and Description |
---|---|
static void |
resetDisplayGamma(GL gl)
Resets the gamma, brightness and contrast values for the primary
display to their original values before
setDisplayGamma was called the first time. |
static boolean |
setDisplayGamma(GL gl,
float gamma,
float brightness,
float contrast)
Sets the gamma, brightness, and contrast of the current main
display.
|
public static boolean setDisplayGamma(GL gl, float gamma, float brightness, float contrast) throws IllegalArgumentException
If this method returns true, the display settings will
automatically be reset to their original values upon JVM exit
(assuming the JVM does not crash); if the user wishes to change
the display settings back to normal ahead of time, use resetDisplayGamma
(). It is recommended to
call resetDisplayGamma
before calling
e.g. System.exit()
from the application rather than
rely on the shutdown hook functionality due to inevitable race
conditions and unspecified behavior during JVM teardown.
This method may be called multiple times during the application's
execution, but calling resetDisplayGamma
will only reset the settings to the values
before the first call to this method.
gamma
- The gamma value, typically > 1.0 (default values
vary, but typically roughly 1.0)brightness
- The brightness value between -1.0 and 1.0,
inclusive (default values vary, but typically 0)contrast
- The contrast, greater than 0.0 (default values
vary, but typically 1)IllegalArgumentException
- if any of the parameters were
out-of-boundspublic static void resetDisplayGamma(GL gl)
setDisplayGamma
was called the first time. setDisplayGamma
must be called before calling
this method or an unspecified exception will be thrown. While it
is not explicitly required that this method be called before
exiting, calling it is recommended because of the inevitable
unspecified behavior during JVM teardown.Copyright 2010 JogAmp Community.