How to wait for VSYNC in Xlib app?

后端 未结 1 1874
甜味超标
甜味超标 2020-12-15 08:54

I am drawing something on screen using XWindow Drawable, Pixmap, and XRender. I can see that sometimes there is flicker. Is there a way to wait for VBLANK? I googled a lot a

相关标签:
1条回答
  • 2020-12-15 09:05

    I find the by far most simple solution is using GLX because of its excellent high level interface towards synchronization and double buffering. Please note GLX is not OpenGL, it is an X extension. You need a dummy OpenGL context as SwapBuffers (for some odd reason) demands it but that´s about it.

    If you want to do it without GLX for any reason, you can do it by creating double buffers through X Double Buffer Extension (DBE) and syncronize manually towards display using the X Syncronization Extension. I have not done so myself but you should be able to find something to your liking calling XSyncListSystemCounters (after proper initialization!):

    XSyncListSystemCounters returns a pointer to an array of system counters supported by the display

    Can´t find much more myself about the hard way though. Good Luck.

    0 讨论(0)
提交回复
热议问题