aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-08-13 19:39:38 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-08-13 19:39:38 +0000
commitf3f532b9244a100fdd40073a40ca4210428ba8e6 (patch)
treed71d8224793428e9c6f30a0cfdf9b76df9882c9c
parent3e8b6511c08ad62b03d50d3a3147ba17bfcedce5 (diff)
downloadioquake3-aero-f3f532b9244a100fdd40073a40ca4210428ba8e6.tar.gz
ioquake3-aero-f3f532b9244a100fdd40073a40ca4210428ba8e6.zip
* Pass the "best" SDL_PixelFormat (as returned by the initial call to
SDL_GetVideoInfo) to SDL_ListModes; this fixes said function returning an empty list when using the "windib" driver git-svn-id: svn://svn.icculus.org/quake3/trunk@1446 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/sdl/sdl_glimp.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c
index 40c1e6d..91298f6 100644
--- a/code/sdl/sdl_glimp.c
+++ b/code/sdl/sdl_glimp.c
@@ -76,6 +76,7 @@ typedef enum
} rserr_t;
static SDL_Surface *screen = NULL;
+static const SDL_VideoInfo *videoInfo = NULL;
cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained
cvar_t *r_sdlDriver;
@@ -150,8 +151,16 @@ static void GLimp_DetectAvailableModes(void)
SDL_Rect **modes;
int numModes;
int i;
+ SDL_PixelFormat *format = NULL;
- modes = SDL_ListModes( NULL, SDL_OPENGL | SDL_FULLSCREEN );
+#if SDL_VERSION_ATLEAST(1, 2, 10)
+ format = videoInfo->vfmt;
+# if MINSDL_PATCH >= 10
+# error Ifdeffery no longer necessary, please remove
+# endif
+#endif
+
+ modes = SDL_ListModes( format, SDL_OPENGL | SDL_FULLSCREEN );
if( !modes )
{
@@ -202,22 +211,32 @@ static int GLimp_SetMode( int mode, qboolean fullscreen )
int i = 0;
SDL_Surface *vidscreen = NULL;
Uint32 flags = SDL_OPENGL;
- const SDL_VideoInfo *videoInfo;
ri.Printf( PRINT_ALL, "Initializing OpenGL display\n");
- if( displayAspect == 0.0f )
- {
#if !SDL_VERSION_ATLEAST(1, 2, 10)
- // 1.2.10 is needed to get the desktop resolution
- displayAspect = 4.0f / 3.0f;
+ // 1.2.10 is needed to get the desktop resolution
+ displayAspect = 4.0f / 3.0f;
#elif MINSDL_PATCH >= 10
# error Ifdeffery no longer necessary, please remove
#else
+ if( videoInfo == NULL )
+ {
+ static SDL_VideoInfo sVideoInfo;
+ static SDL_PixelFormat sPixelFormat;
+
+ videoInfo = SDL_GetVideoInfo( );
+
+ // Take a copy of the videoInfo
+ Com_Memcpy( &sPixelFormat, videoInfo->vfmt, sizeof( SDL_PixelFormat ) );
+ sPixelFormat.palette = NULL; // Should already be the case
+ Com_Memcpy( &sVideoInfo, videoInfo, sizeof( SDL_VideoInfo ) );
+ sVideoInfo.vfmt = &sPixelFormat;
+ videoInfo = &sVideoInfo;
+
// Guess the display aspect ratio through the desktop resolution
// by assuming (relatively safely) that it is set at or close to
// the display's native aspect ratio
- videoInfo = SDL_GetVideoInfo( );
displayAspect = (float)videoInfo->current_w / (float)videoInfo->current_h;
#endif