# OpenGLDevice::GetDeviceInfo ```cpp const RHIDeviceInfo& GetDeviceInfo() const override ``` 获取 OpenGL 设备信息。 ## 详细描述 返回设备的标识和版本信息。设备信息在 `InitializeWithExistingWindow()` 期间通过 `glGetString()` 和 `glGetIntegerv()` 查询获得。 ### 设备信息内容 | 信息字段 | 描述 | OpenGL 来源 | |----------|------|-------------| | `vendor` | GPU 厂商 | GL_VENDOR | | `renderer` | GPU 渲染器名称 | GL_RENDERER | | `version` | OpenGL 版本字符串 | GL_VERSION | | `majorVersion` | OpenGL 主版本号 | GL_MAJOR_VERSION | | `minorVersion` | OpenGL 次版本号 | GL_MINOR_VERSION | ### 厂商示例 - **NVIDIA**: "NVIDIA Corporation" - **AMD**: "AMD" 或 "Advanced Micro Devices, Inc." - **Intel**: "Intel" 或 "Intel Corporation" ## 返回值 `const RHIDeviceInfo&` - 设备信息结构的常量引用 ## 复杂度 O(1) - 返回内部缓存的设备信息 ## 示例 ```cpp const RHIDeviceInfo& info = device.GetDeviceInfo(); std::wcout << L"Vendor: " << info.vendor << std::endl; std::wcout << L"Renderer: " << info.renderer << std::endl; std::wcout << L"Version: " << info.version << std::endl; std::cout << "GL Version: " << info.majorVersion << "." << info.minorVersion << std::endl; ``` ## 相关文档 - [OpenGLDevice](device.md) - 类总览 - [RHIDeviceInfo](../../types/device-info.md) - 设备信息结构定义 - [GetCapabilities](get-capabilities.md) - 获取设备能力 - [GetDeviceInfoImpl](get-device-info-impl.md) - 获取设备信息实现