aboutsummaryrefslogtreecommitdiffstats
path: root/code/unix/sdl_glimp.c
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-04-30 13:50:13 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-04-30 13:50:13 +0000
commit4b4572ff69c7c54f38186d344d37b28f25d47d01 (patch)
treed4fe98f7df0efb5dc6cfda39ff6ec88606f0f6e7 /code/unix/sdl_glimp.c
parent088db292dc44258779b0f5e86cc0c3790f30893e (diff)
downloadioquake3-aero-4b4572ff69c7c54f38186d344d37b28f25d47d01.tar.gz
ioquake3-aero-4b4572ff69c7c54f38186d344d37b28f25d47d01.zip
- Fix r_overBrightBits variable getting ignored on Linux
- Replaced SDL_SetGamma by SDL_SetGammaRamp with gamma behaviour now matching win_gamma.c git-svn-id: svn://svn.icculus.org/quake3/trunk@733 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/unix/sdl_glimp.c')
-rw-r--r--code/unix/sdl_glimp.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c
index 0c6f8dc..bd0f330 100644
--- a/code/unix/sdl_glimp.c
+++ b/code/unix/sdl_glimp.c
@@ -438,15 +438,35 @@ void IN_DeactivateMouse( void )
*/
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;
+
+ // 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);
+// g = Cvar_Get("r_gamma", "1.0", 0)->value;
+// SDL_SetGamma(g, g, g);
}
/*
@@ -553,7 +573,12 @@ static int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
Uint32 flags = SDL_OPENGL;
if (fullscreen)
+ {
flags |= SDL_FULLSCREEN;
+ glConfig.isFullscreen = qtrue;
+ }
+ else
+ glConfig.isFullscreen = qfalse;
if (!r_colorbits->value)
colorbits = 24;