Brightness problem
Posted: Wed Jun 07, 2006 9:04 pm
I suddenly ran to a problem with gamma things:
I couldn't set brightness to over some 5 or 6 in the slider.
I think it was caused by either an update of xorg or an update of fglrx... well, anyways.. I tracked the problem to SDL_SetGamma (made a test program, which showed that it wasn't working)
In the end I found a testgamma.c in SDL-1.2.9 sources where I stealt this block of code:
I added that to SDLDisplay.cxx and modified the setGamma function as follows:
It seems to be working now, but I'm not sure if this is the right way (No, I didn't try to actually play yet, just checked that I could set the gamma brighter now)
Just informing, so that, if it occurs to someone else they can update their code too, or maybe you (devs) could add this to CVS ? (No, I'm not a guru with graphics things, and I'd need some explanation myself here of this)
I couldn't set brightness to over some 5 or 6 in the slider.
I think it was caused by either an update of xorg or an update of fglrx... well, anyways.. I tracked the problem to SDL_SetGamma (made a test program, which showed that it wasn't working)
In the end I found a testgamma.c in SDL-1.2.9 sources where I stealt this block of code:
Code: Select all
void CalculateGamma(double gamma, Uint16 *ramp)
{
int i, value;
gamma = 1.0 / gamma;
for ( i=0; i<256; ++i ) {
value = (int)(pow((double)i/256.0, gamma)*65535.0 + 0.5);
if ( value > 65535 ) {
value = 65535;
}
ramp[i] = (Uint16)value;
}
}
Code: Select all
void SDLWindow::setGamma(float gamma) {
/*HECK THIS NEEDED THIS*/
Uint16 ramp[256];
CalculateGamma(gamma, ramp);
int result = SDL_SetGammaRamp(ramp, ramp, ramp);
...
Just informing, so that, if it occurs to someone else they can update their code too, or maybe you (devs) could add this to CVS ? (No, I'm not a guru with graphics things, and I'd need some explanation myself here of this)