|
|
video_flags |= SDL_HWACCEL; | video_flags |= SDL_HWACCEL; |
} | } |
| |
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 ); |
bpp = SDL_VideoModeOK(width, height, screenDepth, video_flags); |
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 ); |
if (!bpp) { |
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 ); |
printf("Error: Video mode %dx%d@%dbpp is not supported!\n", width, height, screenDepth); |
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 ); |
return FALSE; |
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); |
} |
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); |
if (bpp < screenDepth) { |
|
printf("Warning: Using colour depth of %d instead of %d.\n", bpp, screenDepth); |
|
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); |
|
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 6 ); |
|
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); |
|
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); |
|
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); |
|
} else { |
|
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 ); |
|
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 ); |
|
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 ); |
|
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 ); |
|
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); |
|
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); |
|
} |
// Set the double buffer OpenGL attribute. | // Set the double buffer OpenGL attribute. |
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
} | } |
|
|
screenMode = SCREEN_WINDOWED; | screenMode = SCREEN_WINDOWED; |
} | } |
| |
bpp = SDL_VideoModeOK(width, height, screenDepth, video_flags); |
|
if (!bpp) { |
|
printf("Error: Video mode %dx%d@%dbpp is not supported!\n", width, height, screenDepth); |
|
return FALSE; |
|
} |
|
if (bpp != screenDepth) { |
|
debug(LOG_3D, "Warning: Using colour depth of %d instead of %d.", |
|
bpp, screenDepth); |
|
} |
|
screen = SDL_SetVideoMode(width, height, bpp, video_flags); | screen = SDL_SetVideoMode(width, height, bpp, video_flags); |
if (!screen) { | if (!screen) { |
printf("Error: SDL_SetVideoMode failed (%s).\n", SDL_GetError()); | printf("Error: SDL_SetVideoMode failed (%s).\n", SDL_GetError()); |