Vitaliy Margolen wrote:
Few notes: You constructed the array of some attributes which you never use. You don't check if those attributes match anything - the part you removed. When app will ask for something that can't be supported your code will return it to the app - which is plain wrong.
We simply have nothing to choose from, wine supports only a single pixelformat. And as described in the comment, once the infrastructure is in place the helper function will do the real job.
MSDN: If the function succeeds, the return value is a pixel format index (one-based) that is the closest match to the given pixel format descriptor. You must ensure that the pixel format matched by the ChoosePixelFormat function satisfies your requirements. For example, if you request a pixel format with a 24-bit RGB color buffer but the device context offers only 8-bit RGB color buffers, the function returns a pixel format with an 8-bit RGB color buffer.
There's also a _lot_ code that goes like this:
GLXFBConfig *pCfgs = glXGetFBConfigs(...); ConvertPixelFormatWGLtoGLX(.., &index, ..); glXGetFBConfigAttrib(.., *pCfgs[index], ..); XFree(pCfgs);
This malloc()/free() can be removed by keeping a copy of the GLXFBConfig the the pixelformat registry (instead of the index to the GLXFBConfig list).
tom