com.sun.opengl.util

## Class Gamma

- java.lang.Object
- - com.sun.opengl.util.Gamma

    public class Gamma
    extends Object

Provides control over the primary display's gamma, brightness and contrast controls via the hardware gamma ramp tables. Not supported on all platforms or graphics hardware.

Thanks to the LWJGL project for illustrating how to access gamma control on the various platforms.

### Method Summary

Methods
`static void` `resetDisplayGamma()` 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(float gamma, float brightness, float contrast)` Sets the gamma, brightness, and contrast of the current main display.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### setDisplayGamma

    public static boolean setDisplayGamma(float gamma,
                          float brightness,
                          float contrast)
                                   throws IllegalArgumentException

Sets the gamma, brightness, and contrast of the current main display. This functionality is not available on all platforms and graphics hardware. Returns true if the settings were successfully changed, false if not. This method may return false for some values of the incoming arguments even on hardware which does support the underlying functionality.

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.

Parameters:
  `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)
Returns:
  true if gamma settings were successfully changed, false if not
Throws:
  `IllegalArgumentException` - if any of the parameters were out-of-bounds

#### resetDisplayGamma

    public static void resetDisplayGamma()

Resets the gamma, brightness and contrast values for the primary display to their original values before `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.