Simple way to determine if my application is connected to a local X-server?

106 views Asked by At

When creating a GLX context, you have to specify whether you want direct rendering or not. Direct rendering provides a performance advantage sometimes, so it's preferable to use that, but it can't be used with a remote X-server.

Is there a simple and reliable way to determine if my application is connected to a local server?

2

There are 2 answers

0
gpeche On BEST ANSWER

I think you can just request a direct rendering context, and GLX will fallback to an indirect one if appropiate. Source: http://www.opengl.org/sdk/docs/man/xhtml/glXCreateContext.xml

0
datenwolf On

In addition to the answer of @gpeche, you can test if a context is direct with glXIsDirect. Note, that by using Vertex Buffer Objects the performance differences between indirect and direct rendering are neglectible: All data is kept server side and only (short and small) drawing commands are used, that cause the rendering of large batches.