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?
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