X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fglx%2Fglcontext.cpp;h=e4662f37627ceb18685c660692704f065b45e5f1;hb=a8a9191481151f049781b670ea8883025a594a5f;hp=a73b9c554760af4f1c5d368b69605533c48be16f;hpb=849fc4ee770924d57f8cdf06bd5224573989ccde;p=libs%2Fgui.git diff --git a/source/graphics/glx/glcontext.cpp b/source/graphics/glx/glcontext.cpp index a73b9c5..e4662f3 100644 --- a/source/graphics/glx/glcontext.cpp +++ b/source/graphics/glx/glcontext.cpp @@ -22,29 +22,27 @@ struct GLContext::Private void GLContext::platform_init(const GLOptions &opts) { - priv = new Private; - vector attribs; - + attribs.push_back(GLX_RGBA); attribs.push_back(GLX_DEPTH_SIZE); attribs.push_back(1); - + if(opts.alpha) { attribs.push_back(GLX_ALPHA_SIZE); attribs.push_back(1); } - + if(opts.stencil) { attribs.push_back(GLX_STENCIL_SIZE); attribs.push_back(1); } - + if(opts.doublebuffer) attribs.push_back(GLX_DOUBLEBUFFER); - + if(opts.multisample>0) { attribs.push_back(GLX_SAMPLE_BUFFERS_ARB); @@ -52,7 +50,7 @@ void GLContext::platform_init(const GLOptions &opts) attribs.push_back(GLX_SAMPLES_ARB); attribs.push_back(opts.multisample); } - + attribs.push_back(0); DisplayHandle dpy = display.get_private().display; @@ -60,6 +58,8 @@ void GLContext::platform_init(const GLOptions &opts) XVisualInfo *vi = glXChooseVisual(dpy, DefaultScreen(dpy), &attribs.front()); if(!vi) throw unsupported_gl_mode(opts); + + priv = new Private; priv->context = glXCreateContext(dpy, vi, 0, true); XSetWindowAttributes attr; @@ -92,7 +92,6 @@ void GLContext::swap_buffers() void GLContext::window_resized(unsigned w, unsigned h) { XMoveResizeWindow(display.get_private().display, priv->subwnd, 0, 0, w, h); - glViewport(0, 0, w, h); } } // namespace Graphics