Next | Prev | Up | Top | Contents | Index
Performance Considerations for X and OpenGL
Due to synchronization and context switching overhead, there is a possible performance hit for mixing OpenGL and X in the same window. GLX does not constrain the order in which OpenGL commands and X requests are executed. To ensure a particular order, use the GLX commands glXWaitGL() and glXWaitX().
- glXWaitGL() prevents any subsequent X calls from executing until all pending OpenGL calls complete. When you use indirect rendering, this function does not contact the X server and is therefore more efficient than glFinish().
- glXWaitX(), when used with indirect rendering, is just the opposite: it makes sure that all pending X calls complete before any further OpenGL calls are made. This function, too, doesn't need to contact the X server, giving it an advantage over XSync() when rendering indirectly.
- Remember also to batch Expose events. See "Exposing a Window".
- Make sure no additional Expose events are already queued after the current one. You can discard all but the last event.
Next | Prev | Up | Top | Contents | Index