comp.lang.ada
 help / color / mirror / Atom feed
* Xlib, (GLX or EGL), OpenGL. Stuck at double buffering not working properly.
@ 2020-05-12 23:15 Olivier Henley
  2020-05-14 18:40 ` onox
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Henley @ 2020-05-12 23:15 UTC (permalink / raw)


Hi to all,

In my spare time I am working on a cross-platform windowing lib for OpenGL in Ada. 

In a nutshell, a GLFW replacement.

I come to you because on Linux, wrapping, and driving Xlib with GLX or EGL in Ada, I am failing to get double buffering to work. 

Generally its working, eg. I get sample code from OpenGLAda rendering fine in the window but if I try to resize a window rapidly, I get black tearing and sometimes dropped frames. I did fix this problem on windows by threading the rendering out of the window message pump, but for Linux, threading over X11 makes things explode. I looked into XInitThread but the documentation leave me cold.

I tried two other Ada projects that paint some OpenGL in a native Linux window using (Xlib and GLX) namely Globe3D and AdaOGL. Both suffer from the same tearing and/or dropped frame when resizing the window.

Now if I compile an equivalent simple GLFW C example code, it works like a charm, no dropped frame, no tearing. I looked at their code and they do not seem to make much more than I do. I also found, compiled, and tried a really simple C source code file using Xlib/GLX and it works. (http://andrewd.ces.clemson.edu/courses/graphics/examples/glx-simple/glxsimple.c)

Anyone is aware of what is going on here? Something special about the Ada runtime that I should know about or is it just me that does not handle the Xlib window message pump incorrectly?

Any insights welcome.

Thanks,

Olivier 

Note: Now because the threading problem over X11 looks like mostly coming from the whole needed 'same thread context for window and GL' I was thinking rendering GL to a double buffer of Pixmaps/pBuffer (XLib off-screen render targets) from a separate thread and then just blit myself to the window at the 'Expose' events. Make sense, any thoughts on that?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-16  5:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 23:15 Xlib, (GLX or EGL), OpenGL. Stuck at double buffering not working properly Olivier Henley
2020-05-14 18:40 ` onox
2020-05-15 20:00   ` Olivier Henley
2020-05-16  5:51     ` onox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox