Game Development Reference
In-Depth Information
Because Quake II allows switching screen resolutions and renderers on the fly, GLimp_Init
may fire more than once during the game life cycle; thus you must make sure initialization
occurs only once.
Setting the Video Mode and Size
The Quake II OpenGL renderer video resolution is calculated from the command line by
sending the arguments
+ set gl_mode MODE_NUMBER
where MODE-NUMBER maps to an array of screen resolutions (see Listing 7-9). For example,
gl_mode 3 tells the engine to use a 569×320 video resolution. If the video mode is not
specified at startup, the default value is 3.
Listing 7-9. Setting the Video Mode
// vid_so.c
typedef struct vidmode_s
{
const char *description;
int width, height;
int mode;
} vidmode_t;
vidmode_t vid_modes[] =
{
#ifdef ANDROID
{ "Mode 0: 256x256", 256, 256, 0 },
{ "Mode 1: 320x320", 320, 320, 1 },
{ "Mode 2: 480x320", 480, 320, 2 },
{ "Mode 3: 569x320", 569, 320, 3 },
{ "Mode 4: 800x480", 800, 480, 4 },
#else
...
#endif
};
// gl_glx.c
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
{
if ( !ri.Vid_GetModeInfo( &width, &height, mode ) )
{
ri.Con_Printf( PRINT_ALL, " invalid mode\n" );
return rserr_invalid_mode;
}
ri.Con_Printf( PRINT_ALL, " %d %d\n", width, height );
Search WWH ::




Custom Search