From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:4809:: with SMTP id g9mr24912712qtq.33.1589325309478; Tue, 12 May 2020 16:15:09 -0700 (PDT) X-Received: by 2002:aca:816:: with SMTP id 22mr24372858oii.51.1589325308650; Tue, 12 May 2020 16:15:08 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 May 2020 16:15:08 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=208.114.128.69; posting-account=MRPdDAoAAADUJmZVjnYaoafXFMadSeY1 NNTP-Posting-Host: 208.114.128.69 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <705052ba-5cff-46af-a28c-1e25e60e2eef@googlegroups.com> Subject: Xlib, (GLX or EGL), OpenGL. Stuck at double buffering not working properly. From: Olivier Henley Injection-Date: Tue, 12 May 2020 23:15:09 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58668 Date: 2020-05-12T16:15:08-07:00 List-Id: Hi to all, In my spare time I am working on a cross-platform windowing lib for OpenGL = in Ada.=20 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.=20 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 threadin= g the rendering out of the window message pump, but for Linux, threading ov= er X11 makes things explode. I looked into XInitThread but the documentatio= n leave me cold. I tried two other Ada projects that paint some OpenGL in a native Linux win= dow using (Xlib and GLX) namely Globe3D and AdaOGL. Both suffer from the sa= me 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 real= ly simple C source code file using Xlib/GLX and it works. (http://andrewd.c= es.clemson.edu/courses/graphics/examples/glx-simple/glxsimple.c) Anyone is aware of what is going on here? Something special about the Ada r= untime that I should know about or is it just me that does not handle the X= lib window message pump incorrectly? Any insights welcome. Thanks, Olivier=20 Note: Now because the threading problem over X11 looks like mostly coming f= rom 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?