Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/video.cc42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/client/video.cc b/src/client/video.cc
index ceea25d..5a4e535 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -86,15 +86,32 @@ bool init()
bpp = sdl_videoinfo->vfmt->BitsPerPixel;
- SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
- SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
- SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
- SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
- SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 2);
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+ if (bpp == 32) {
+ 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);
+ } else if (bpp == 24) {
+ SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 6);
+ SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 6);
+ SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 6);
+ SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 6);
+ } else if (bpp == 16) {
+ SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 4);
+ SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 4);
+ SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 4);
+ SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 4);
+ } else {
+ con_warn << "Display depth " << bpp << " is not supported!" << std::endl;
+ }
+
+ SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1);
- if (r_fullscreen->value()) flags = SDL_OPENGL | SDL_FULLSCREEN;
- else flags = SDL_OPENGL;
+ if (r_fullscreen->value()) {
+ flags = SDL_OPENGL | SDL_FULLSCREEN;
+ } else {
+ flags = SDL_OPENGL;
+ }
if(!SDL_SetVideoMode(width, height, bpp, flags )) {
con_warn << "Failed to set video mode " << width << "x" << height << "x" << bpp << "bpp" << std::endl;
@@ -109,6 +126,15 @@ bool init()
return false;
}
con_print << " video mode " << width << "x" << height << "x" << bpp << "bpp" << std::endl;
+ int red, green, blue, alpha, depth;
+
+ SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &red);
+ SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &green);
+ SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &blue);
+ SDL_GL_GetAttribute( SDL_GL_ALPHA_SIZE, &alpha);
+ SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &depth);
+
+ con_debug << " visual r: " << red << " g: " << green << " blue: " << blue << " alpha: " << alpha << " depth: " << depth << std::endl;
render::Camera::set_aspect(width, height);
(*r_width) = width;