24 using namespace mondschein;
25 using namespace display;
27 SDL_Visual::SDL_Visual() :
Visual(), renderer::Context(), visual()
33 Visual(_dsp), renderer::Context(_c), visual()
38 SDL_Visual::~SDL_Visual()
40 SDL_FreeSurface(visual);
49 uint32 flags=SDL_HWACCEL|SDL_OPENGL;
53 SDL_GL_SetAttribute(SDL_GL_RED_SIZE,c.
color_depth(0));
54 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,c.
color_depth(1));
55 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,c.
color_depth(2));
56 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,c.
color_depth(3));
57 SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,c.
accum_depth(0));
58 SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,c.
accum_depth(1));
59 SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,c.
accum_depth(2));
60 SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,c.
accum_depth(3));
63 if (c.
doublebuffer) SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
64 else SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,0);
70 std::string err(
"Mondschein Engine ERROR: ");
71 err+=
"Video mode or GL visual not supported";
72 err+=
", exception raised in function\n\t";
73 err+=
"void mondschein::display::SDL_Visual::init()";
80 dsp.
bpp=visual->format->BitsPerPixel;
84 SDL_GL_GetAttribute(SDL_GL_RED_SIZE,&c.
color_depth(0));
85 SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE,&c.
color_depth(1));
86 SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE,&c.
color_depth(2));
87 SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE,&c.
color_depth(3));
88 SDL_GL_GetAttribute(SDL_GL_ACCUM_RED_SIZE,&c.
accum_depth(0));
89 SDL_GL_GetAttribute(SDL_GL_ACCUM_GREEN_SIZE,&c.
accum_depth(1));
90 SDL_GL_GetAttribute(SDL_GL_ACCUM_BLUE_SIZE,&c.
accum_depth(2));
91 SDL_GL_GetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,&c.
accum_depth(3));
94 SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER,&db);
102 SDL_FreeSurface(visual);
109 std::string err(*boost::get_error_info<exception_error>(e));
110 err+=
", called in function\n\t";
111 err+=
"void mondschein::display::SDL_Visual::update()";
120 std::cerr<<
"Mondschein Engine DEBUG: SDL visuals cannot be made current."<<std::endl;
126 SDL_GL_SwapBuffers();