From 7a472cbdabfe572481d6dd532c3aaff59405d6aa Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 13 Dec 2015 18:32:32 +0200 Subject: [PATCH] Some tweaks to GL context usage --- source/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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) -- 2.45.2