10-10-10-2

After unsuccessfully bump-hijacking a very old thread in coding:advanced, that wasn’t exactly covering my question, I reckon this is the appropriate place to ask.

I’d like to try out R10G10B10A2 pixel formats for OpenGL rendering and direct display (i.e. no pbuffer). Matrox Parhelia supports this layout, and so does the S3 Graphics DeltaChrome family. I happen to own a DCS8, but no luck so far.
I can’t seem to get any of these formats, and I think I already know why I can’t …

… ChangeDisplaySettings and its DEVMODE mechanism doesn’t support/know about differing color/alpha resolutions. The DEVMODE struct has, as its only means to specify color depth, the dmBitsPerPel member. However, going for 32 will yield the usual 8-8-8-8 rgba split. You can’t specifically ask for 10-10-10-2.

I figure that once the display mode has been set to 8-8-8-8, a 10-10-10-2 format is deemed incompatible with the current display mode, and so it isn’t returned when querying for pixel formats.

DirectX Graphics can do it, as it integrates the mode switch with the pixel format request into a single operation.

What’s the correct way to do this for an OpenGL supported window?

DirectX Graphics can do it, as it integrates the mode switch with the pixel format request into a single operation.
How? You can setup the backbuffer format but the front buffer is up to the driver it seems. Perhaps I missed something.

The same situation with GL. Choose a back buffer format. The driver may be smart enough to match front buffer format with back.

I have no experience with this, but this is my guess.

Originally posted by zeckensack:
… ChangeDisplaySettings and its DEVMODE mechanism doesn’t support/know about differing color/alpha resolutions. The DEVMODE struct has, as its only means to specify color depth, the dmBitsPerPel member. However, going for 32 will yield the usual 8-8-8-8 rgba split. You can’t specifically ask for 10-10-10-2.
I’m not sure I understand this correctly but maybe you could try extended wgl.
I don’t remember the extension name (maybe WGL_ARB_buffer_format?) but this also allows to set multisampling and stuff.
The problem is that you need to create a GL context, get the extension and destroy the context to do it. This may seem a problem at first, but I has been told the pointer remains valid between the different contexts (even if it’s not guaranteed to be) and I personally never seen any problem.

Originally posted by Obli:
I’m not sure I understand this correctly but maybe you could try extended wgl.
I don’t remember the extension name (maybe WGL_ARB_buffer_format?) but this also allows to set multisampling and stuff.
The problem is that you need to create a GL context, get the extension and destroy the context to do it. This may seem a problem at first, but I has been told the pointer remains valid between the different contexts (even if it’s not guaranteed to be) and I personally never seen any problem.

I might try that in the next round. Thanks.
But theoretically the “classic” PFD approach should suffice. There are separate members for rgb and alpha, so the struct itself is flexible enough to express the 10-10-10-2 split. For the record, my current best try is this:

const PIXELFORMATDESCRIPTOR pfd_blank=
{
	sizeof(PIXELFORMATDESCRIPTOR),1,
        PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER|
        PFD_SWAP_EXCHANGE|PFD_DRAW_TO_WINDOW|
        PFD_STEREO_DONTCARE,
	PFD_TYPE_RGBA,
	0,	//cColorBits
	0,0,0,0,0,0,0,0,0,0,0,0,0,
	0,	//cDepthBits
	0,	//cStencilBits
	0,
	PFD_MAIN_PLANE,
	0,0,0,0
};

bool
setup_gl_context(HDC dc,HGLRC& rc)
{
<...>
	PIXELFORMATDESCRIPTOR pfd=pfd_blank;
	if (derived_config.color.try_billions)
	{
		pfd.cColorBits=30;   //< look here
		pfd.cAlphaBits=2;    //< and here
		pfd.cDepthBits=24;
		pfd.cStencilBits=8;
	}
	else
	{
		pfd.cColorBits=24;
		pfd.cAlphaBits=8;
		pfd.cDepthBits=24;
		pfd.cStencilBits=8;
	}
<...>
}

Doesn’t the PFD have separate fields for red/green /blue bit count? Maybe try out these instead of simply setting the sum of the three.

If it doesn’t work however, then I think I’m out of ideas.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.