exporting patch: # HG changeset patch # User Martin Schreiber # Date 1316036100 -7200 # Node ID 70b9ab1db85ab6926b55936ed24146a6e15c7067 # Parent 4fc2f7e2bb52b5e65221e831de22dff1d3d9ef0d OpenGL core mode initialization updated: otherwise a core mode context is never created. This error can be reproduced by printing SDL_GetError() after trying to create a core mode window. diff -r 4fc2f7e2bb52 -r 70b9ab1db85a src/video/x11/SDL_x11opengl.c --- a/src/video/x11/SDL_x11opengl.c Sat Sep 10 19:27:39 2011 +0300 +++ b/src/video/x11/SDL_x11opengl.c Wed Sep 14 23:35:00 2011 +0200 @@ -382,6 +382,96 @@ return i; } + +int +X11_GL_GetFBAttributes(_THIS, Display * display, int screen, int * attribs, int size) +{ + int i = 0; + + /* assert buffer is large enough to hold all SDL attributes. */ + /* assert(size >= 32);*/ + + /* Setup our GLX attributes according to the gl_config. */ + attribs[i++] = GLX_RENDER_TYPE; + attribs[i++] = GLX_RGBA_BIT; + attribs[i++] = GLX_RED_SIZE; + attribs[i++] = _this->gl_config.red_size; + attribs[i++] = GLX_GREEN_SIZE; + attribs[i++] = _this->gl_config.green_size; + attribs[i++] = GLX_BLUE_SIZE; + attribs[i++] = _this->gl_config.blue_size; + + if (_this->gl_config.alpha_size) { + attribs[i++] = GLX_ALPHA_SIZE; + attribs[i++] = _this->gl_config.alpha_size; + } + + if (_this->gl_config.buffer_size) { + attribs[i++] = GLX_BUFFER_SIZE; + attribs[i++] = _this->gl_config.buffer_size; + } + + if (_this->gl_config.double_buffer) { + attribs[i++] = GLX_DOUBLEBUFFER; + attribs[i++] = True; + } + + attribs[i++] = GLX_DEPTH_SIZE; + attribs[i++] = _this->gl_config.depth_size; + + if (_this->gl_config.stencil_size) { + attribs[i++] = GLX_STENCIL_SIZE; + attribs[i++] = _this->gl_config.stencil_size; + } + + if (_this->gl_config.accum_red_size) { + attribs[i++] = GLX_ACCUM_RED_SIZE; + attribs[i++] = _this->gl_config.accum_red_size; + } + + if (_this->gl_config.accum_green_size) { + attribs[i++] = GLX_ACCUM_GREEN_SIZE; + attribs[i++] = _this->gl_config.accum_green_size; + } + + if (_this->gl_config.accum_blue_size) { + attribs[i++] = GLX_ACCUM_BLUE_SIZE; + attribs[i++] = _this->gl_config.accum_blue_size; + } + + if (_this->gl_config.accum_alpha_size) { + attribs[i++] = GLX_ACCUM_ALPHA_SIZE; + attribs[i++] = _this->gl_config.accum_alpha_size; + } + + if (_this->gl_config.stereo) { + attribs[i++] = GLX_STEREO; + attribs[i++] = True; + } + + if (_this->gl_config.multisamplebuffers) { + attribs[i++] = GLX_SAMPLE_BUFFERS_ARB; + attribs[i++] = _this->gl_config.multisamplebuffers; + } + + if (_this->gl_config.multisamplesamples) { + attribs[i++] = GLX_SAMPLES_ARB; + attribs[i++] = _this->gl_config.multisamplesamples; + } + + if (_this->gl_config.accelerated >= 0 && + _this->gl_data->HAS_GLX_EXT_visual_rating) { + attribs[i++] = GLX_VISUAL_CAVEAT_EXT; + attribs[i++] = _this->gl_config.accelerated ? GLX_NONE_EXT : + GLX_SLOW_VISUAL_EXT; + } + + attribs[i++] = None; + + return i; +} + + XVisualInfo * X11_GL_GetVisual(_THIS, Display * display, int screen) { @@ -462,7 +552,7 @@ int *)) _this->gl_data-> glXGetProcAddress((GLubyte *) "glXChooseFBConfig"); - X11_GL_GetAttributes(_this,display,screen,glxAttribs,64); + X11_GL_GetFBAttributes(_this,display,screen,glxAttribs,64); if (!glXChooseFBConfig || !(framebuffer_config =