PDA

View Full Version : X11 events and GL rendering



_arts_
11-19-2010, 03:17 PM
This can look like a simple question, but I would like to be sure about this.

I would like to know if some certain X11 events prevent from using GL functions or to achieve some rendering (swapping buffers for example).

Under some circumpstancies, from what I could analysed, some programs could crash after an "Expose" event. It happens only on starting some applications.

Can someone says me more about this or points me to relevant information ?

Dark Photon
11-21-2010, 07:32 PM
I would like to know if some certain X11 events prevent from using GL functions or to achieve some rendering (swapping buffers for example).
Not that I'm aware of. Given a reasonable window event mask (the .event_mask attribute of the last arg you pass create XCreateWindow, for instance), you shouldn't have to do anything with the events you receive if you don't wan't -- just read them and toss them. Of course, if you don't want them, why register to receive them at all.

It's probably more likely there's a bug in the code -- perhaps using X or GLX incorrectly. Do you have an X Error Callback registered which prints errors if they occur (XSetErrorHandler)? Make sure you have it set up before you do glX calls like glXMakeCurrent to ensure you catch things like GLXBadDrawable and such. Also, since X/GLX/GL are pipelined, inserting calls such as XSync, glXWaitX, and glXWaitGL can sometimes be useful for nailing down where the problem call is. Also don't forget checking for GL errors (glGetError()).

All else fails, see if you can isolate the problem into a short compilable test pgm you can post.

_arts_
11-24-2010, 03:13 AM
Thanks for the reply, I'll have a look.

From further analysis, it seems it could happend when the window gain or loose focus during start-up.

Hope to say more soon.