Gamma and Display.setDisplayConfiguration Gotchas

Started by n.o.p, March 17, 2007, 14:29:16

Previous topic - Next topic

n.o.p

In my experience, 3D applications are generally darker on AMD/ATI cards when compared to NVidia. A gamma value of about 1.3 must be set for ATI to make the game look equal on both cards. Unfortunately, I noticed a few problems when trying to set gamma with setDisplayConfiguration. I was able to work around them, but I'd like to mention them here so maybe they'll be fixed in a future LWJGL version.


  • setDisplayConfiguration throws an exception in case of invalid values: The valid ranges are:
    1. Parameter: Gamma (> 0; 1 = default)
    2. Parameter: Brightness (-1 to +1; 0 = default)
    3. Parameter: Contrast (0 to 1; 1 = default)
    This should be in the documentation.

  • Not all graphic drivers support changing gamma that way, Exception must be caught.

  • Changing gamma in window mode, changes gamma for the whole screen. There is no way to work around that.

  • Changing to full screen or back to window mode resets gamma. So you have to restore gamma in that case. However, you have to call Display.update() after Display.setFullscreen() before you can restore the gamma.

  • ALT + TAB in fullscreen mode resets the gamma. You have to detect that case to restore gamma. This can be done by comparing Display.isActive() in the current frame to the Display.isActive() value of the last frame.

  • The call of setDisplayConfiguration will be ignored, if you call it with the same values as before. So to restore gamma, the method must be called twice, first with default values then with the desired values.

  • setDisplayConfiguration expects an inverted gamma value. To set a gamma value of 1.3 you have to pass 0.7.
    Conversion: 1 - (gamma - 1) = 2 - gamma

This relates to LWJGL 1.0.