r733 - trunk/code/unix
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Apr 30 09:50:13 EDT 2006
Author: thilo
Date: 2006-04-30 09:50:13 -0400 (Sun, 30 Apr 2006)
New Revision: 733
Modified:
trunk/code/unix/sdl_glimp.c
Log:
- Fix r_overBrightBits variable getting ignored on Linux
- Replaced SDL_SetGamma by SDL_SetGammaRamp with gamma behaviour now matching win_gamma.c
Modified: trunk/code/unix/sdl_glimp.c
===================================================================
--- trunk/code/unix/sdl_glimp.c 2006-04-29 19:54:54 UTC (rev 732)
+++ trunk/code/unix/sdl_glimp.c 2006-04-30 13:50:13 UTC (rev 733)
@@ -438,15 +438,35 @@
*/
void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] )
{
- // NOTE TTimo we get the gamma value from cvar, because we can't work with the s_gammatable
- // the API wasn't changed to avoid breaking other OSes
- float g;
+ Uint16 table[3][256];
+ int i, j;
+// float g;
- if ( r_ignorehwgamma->integer )
- return;
+ if(r_ignorehwgamma->integer)
+ return;
- g = Cvar_Get("r_gamma", "1.0", 0)->value;
- SDL_SetGamma(g, g, g);
+ // taken from win_gamma.c:
+ for (i = 0; i < 256; i++)
+ {
+ table[0][i] = ( ( ( Uint16 ) red[i] ) << 8 ) | red[i];
+ table[1][i] = ( ( ( Uint16 ) green[i] ) << 8 ) | green[i];
+ table[2][i] = ( ( ( Uint16 ) blue[i] ) << 8 ) | blue[i];
+ }
+
+ // enforce constantly increasing
+ for (j = 0; j < 3; j++)
+ {
+ for (i = 1; i < 256; i++)
+ {
+ if (table[j][i] < table[j][i-1])
+ table[j][i] = table[j][i-1];
+ }
+ }
+
+ SDL_SetGammaRamp(table[0], table[1], table[2]);
+
+// g = Cvar_Get("r_gamma", "1.0", 0)->value;
+// SDL_SetGamma(g, g, g);
}
/*
@@ -553,7 +573,12 @@
Uint32 flags = SDL_OPENGL;
if (fullscreen)
+ {
flags |= SDL_FULLSCREEN;
+ glConfig.isFullscreen = qtrue;
+ }
+ else
+ glConfig.isFullscreen = qfalse;
if (!r_colorbits->value)
colorbits = 24;
More information about the quake3-commits
mailing list