PDA

View Full Version : Correct initialization on GLX?



Y-tension
04-26-2010, 01:45 PM
Hey people, started porting some of my openGL demos to linux (Ubuntu 9.10) but I've got a couple of compatibility issues.
On a geforce 8400,I use GLX_BUFFER_SIZE 24 for fbconfig but on an older ATI 9000 it has to be 32 or window creation fails. What is the correct way to detect a valid bit depth before I call initialization routines?

overlay
04-26-2010, 03:32 PM
glx 1.4, page 38, table 3.8:
glx will try to find a fbconfig with a value equal or smaller than the one specified GLX_BUFFER_SIZE.

One solution is to set the value to 32. If 32 is not available, it will try 24. The problem is if you don't want 32 bits on other cards than ATI, it is no really useful, but it is automatic.

Another solution is to try to get a config with GLX_BUFFER_SIZE set to 24 (or smaller). If it fails, try to get a config with GLX_BUFFER_SIZE set to 32 (or smaller).