From: Mikko Rasa Date: Sun, 13 Dec 2015 16:32:32 +0000 (+0200) Subject: Some tweaks to GL context usage X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7a472cbdabfe572481d6dd532c3aaff59405d6aa;p=geometrycompositor.git Some tweaks to GL context usage --- diff --git a/source/main.c b/source/main.c index 30833db..bfb01a4 100644 --- a/source/main.c +++ b/source/main.c @@ -271,13 +271,11 @@ unsigned create_2d_texture() return texture; } -int create_gl_resources(Compositor *compositor, CompositedScreen *screen) +int create_gl_resources(CompositedScreen *screen) { unsigned stride; int loc; - use_gl(compositor, screen); - screen->shaders[0] = compile_shader(GL_VERTEX_SHADER, vshader_src); screen->shaders[1] = compile_shader(GL_FRAGMENT_SHADER, fshader_src); screen->shaders[2] = compile_shader(GL_FRAGMENT_SHADER, masked_fshader_src); @@ -830,7 +828,9 @@ int initialize_screen(Compositor *compositor, unsigned number) if(!initialize_gl(compositor, screen)) return 0; - if(!create_gl_resources(compositor, screen)) + use_gl(compositor, screen); + + if(!create_gl_resources(screen)) return 0; xrr_res = XRRGetScreenResources(compositor->display, screen->root); @@ -1007,7 +1007,10 @@ void process_destroy_window_event(Compositor *compositor, XDestroyWindowEvent *e if((screen = find_screen_by_root(compositor, event->event))) if((window = find_window(screen, event->window))) + { + use_gl(compositor, screen); remove_window(compositor, screen, window, 1); + } } void process_map_event(Compositor *compositor, XMapEvent *event)