Use glXWaitGL() rather than glFinish() to force X rendering commands to follow GL rendering commands.
Likewise, use glXWaitX() rather than glXSync() to force GL rendering commands to follow X rendering commands.
Be careful when using glXChooseVisual() because boolean selections are matched exactly. Since some implementations won't export visuals with all combinations of boolean capabilities, you should call glXChooseVisual() several times with different boolean values before you give up. For example, if no single-buffered visual with the required characteristics is available, check for a double-buffered visual with the same capabilities. It might be available, and it's easy to use.
OpenGL Programming Guide