Enumerating pixel formats for adaptors and modes with OpenGL
- by Robinson
I'm trying to code an OpenGL path for my 3D engine. The D3D path enumerates all device adaptors, all modes (by mode I mean bit depth, dimensions, available windowed, and refresh rate) for each adaptor and then all pixel formats available for the given mode and adaptor, along side certain useful caps (shader version, filter types, etc.). So, I have broadly got the following protected functions in the class:
// Enumerate all back/front buffer combinations.
virtual void EnumerateBackFrontBufferCombinations(CComPtr<IDirect3D9>& d3d9);
// Enumerate all depth/stencil formats.
virtual void EnumerateDepthStencilFormats(CComPtr<IDirect3D9>& d3d9);
// Enumerate all multi-sample formats.
virtual void EnumerateMultiSampleTypes(CComPtr<IDirect3D9>& d3d9);
// Enumerate all device formats, i.e. dynamic, static, render target, etc.
virtual void EnumerateMapFormats(CComPtr<IDirect3D9>& d3d9);
// Enumerate all capabilities.
virtual void EnumerateCapabilities(CComPtr<IDirect3D9>& d3d9);
The adaptors are enumerated with EnumDisplayDevices, the modes (resolutions and refresh rates) are enumerated with EnumDisplaySettings, so this can be done for either GL or D3D. The other functions I'm not so sure about with OpenGL. What are the equivalents to the IDirect3D9's CheckDeviceType, CheckDeviceFormat, CheckDeviceMultiSampleType, CheckDepthStencilMatch? I know I can use DescribePixelFormat, given a DC, but you kind-of need to have created the window before you can use a DC with it, but you can't create the window correctly until you know what formats you're going to use.
Any tips you can give me?
Thanks.