Index: GL/canvas_opengl.cpp =================================================================== --- GL/canvas_opengl.cpp (revision 168) +++ GL/canvas_opengl.cpp (working copy) @@ -176,52 +176,58 @@ #ifdef __APPLE__ // todo: add AGL pbuffer code #else - if (glXCreateGLXPbufferSGIX == 0) - { - throw CL_Error("GLX_SGIX_pbuffer OpenGL extension not supported by this card"); - } + int scrnum; + GLXFBConfig *fbconfig; + XVisualInfo *visinfo; + int nitems; - int configAttribs[] = - { -// GLX_DOUBLEBUFFER, False, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_DRAWABLE_TYPE_SGIX, GLX_PBUFFER_BIT_SGIX, - (int) None - }; + int attrib[] = { + GLX_DOUBLEBUFFER, False, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DEPTH_SIZE, 1, + GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT, + None + }; + int pbufAttrib[] = { + GLX_PBUFFER_WIDTH, selected_surface->surface_size.width, + GLX_PBUFFER_HEIGHT, selected_surface->surface_size.height, + GLX_LARGEST_PBUFFER, False, + None + }; - int num_configs_returned = 0; - GLXFBConfig *config = glXChooseFBConfigSGIX( - CL_DisplayWindow_OpenGL::get_display(), - DefaultScreen(CL_DisplayWindow_OpenGL::get_display()), - configAttribs, - &num_configs_returned); + scrnum = DefaultScreen( CL_DisplayWindow_OpenGL::get_display() ); - if (num_configs_returned == 0 || config == 0) - { - throw CL_Error("glXChooseFBConfigSGIX could not find any suitable pbuffer pixel formats on this card!"); - } + fbconfig = glXChooseFBConfig(CL_DisplayWindow_OpenGL::get_display(), + scrnum, + attrib, + &nitems); + if (NULL == fbconfig) { + fprintf(stderr,"Error: couldn't get fbconfig\n"); + exit(1); + } - int pbufAttribs[] = { - GLX_PRESERVED_CONTENTS, True, - (int) None }; + pbuffer = glXCreatePbuffer(CL_DisplayWindow_OpenGL::get_display(), fbconfig[0], pbufAttrib); - pbuffer = glXCreateGLXPbufferSGIX( - CL_DisplayWindow_OpenGL::get_display(), - *config, - selected_surface->surface_size.width, - selected_surface->surface_size.height, - pbufAttribs); + visinfo = glXGetVisualFromFBConfig(CL_DisplayWindow_OpenGL::get_display(), fbconfig[0]); + if (!visinfo) { + fprintf(stderr, "Error: couldn't get an RGBA, double-buffered visual\n"); + exit(1); + } - pbuffer_context = glXCreateContextWithConfigSGIX( - CL_DisplayWindow_OpenGL::get_display(), - config[0], - GLX_RGBA_TYPE, - CL_DisplayWindow_OpenGL::share_context, - True); + pbuffer_context = glXCreateContext( CL_DisplayWindow_OpenGL::get_display(), visinfo, + dynamic_cast(CL_Display::get_current_window()->get_gc()->impl)->get_context(), GL_TRUE ); + if (!pbuffer_context) { + fprintf(stderr, "Error: glXCreateContext failed\n"); + exit(1); + } + + XFree(fbconfig); + XFree(visinfo); + #endif #endif