使用 OpenGL 枚举适配器和模式的像素格式
我正在尝试为我的 3D 引擎编写 OpenGL 路径。 D3D 路径枚举每个适配器的所有设备适配器、所有模式(我所说的模式是指位深度、尺寸、可用窗口和刷新率),然后枚举可用于给定模式和适配器的所有像素格式,以及某些有用的上限(着色器)版本、过滤器类型等)。因此,我在类中大致获得了以下受保护的函数:
// 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);
使用 EnumDisplayDevices 枚举适配器,使用 EnumDisplaySettings 枚举模式(分辨率和刷新率),因此可以为 GL 或 D3D 完成此操作。我不太确定 OpenGL 的其他功能。 IDirect3D9 的 CheckDeviceType、CheckDeviceFormat、CheckDeviceMultiSampleType、CheckDepthStencilMatch 的等效项是什么?我知道我可以使用DescribePixelFormat,给定一个DC,但是您需要先创建窗口,然后才能使用DC,但是在您知道要使用什么格式之前,您无法正确创建窗口使用。
你能给我什么建议吗?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么?
标准方法是:
Why?
The standard approach is: