c - Strange effects with OpenGL app when compositing is enabled on Linux + Intel driver -


i'm having problem simple sdl2+opengl code:

#include <gl/glew.h> #include <sdl2/sdl.h> #include <sdl2/sdl_opengl.h>  int main() {     sdl_init(sdl_init_video);     sdl_gl_setattribute(sdl_gl_context_profile_mask,    sdl_gl_context_profile_core);     sdl_gl_setattribute(sdl_gl_context_major_version, 3);     sdl_gl_setattribute(sdl_gl_context_minor_version, 2);     sdl_gl_setattribute(sdl_gl_stencil_size, 8);     sdl_window *window = sdl_createwindow("opengl", sdl_windowpos_undefined, sdl_windowpos_undefined, 800, 600, sdl_window_opengl);     sdl_glcontext context = sdl_gl_createcontext(window);     sdl_event windowevent;      while(true) {         if(sdl_pollevent(&windowevent)) {             if(windowevent.type == sdl_quit) break;         }         sdl_gl_swapwindow(window);     }      sdl_gl_deletecontext(context);     sdl_quit();     return 0; } 

this code should show blank window. when running nvidia driver works (even window manager compositor enabled), when run intel driver , compositor enabled randomly full black screen second, window shows, black screen comes etc. when disable compositor (kwin 5.10.4) alt+shift+f12 before running program, works. tested mutter (the gnome compositor) , same happens. program works if comment out sdl_gl_setattribute part, sdl_glcontext variable declaration, , change sdl_window_opengl sdl_window_shown (basically if set window managed sdl).

i tried glfw instead of sdl, got same problem.

how should solve it?

update: program works if disable vsync in kde compositor settings.

you're swapping framebuffer never cleared or drawn framebuffer covering primitive to. hence outcome undefined , kind of output might appear.

add glclear(gl_color_buffer_bit) inner drawing loop , see does.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -