Game Development Reference
In-Depth Information
It adjusts the brightness. Quake is well known for having a very dark
video display. VID_Init uses the user-defined gamma parameter to
adjust the brightness of the display at startup.
Listing 6-10 shows an example of video initialization using VID_Init .
It creates the color palette used by the video renderer.
Listing 6-10. Video Initialization
void VID_Init(unsigned char *palette)
{
// Load user params
if ((i = COM_CheckParm("-width")) != 0)
width = atoi(com_argv[i+1]);
if ((i = COM_CheckParm("-height")) != 0)
height = atoi(com_argv[i+1]);
// Set video size & others
vid.width = vid.conwidth = width;
vid.height = vid.conheight = height;
...
// Load NanoGL
if ( !nanoGL_Init() ){
Sys_Error("Failed to load NanoGL wrapper.");
}
// Init GL
gl_vendor = glGetString (GL_VENDOR);
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
...
// Adjust Brightness
Check_Gamma(palette);
// Create palette
VID_SetPalette(palette);
}
Here are some of the functions that are critical.
VID_SetPalette : Required to create a palette used to assign colors to
textures and other graphical elements in the game. It must be a 256
RGB888 array of bytes.
VID_Shutdown : Called whenever the video subsystem is shut down; for
instance, when the user quits the game. It performs trivial cleanup tasks.
Search WWH ::




Custom Search