Files
XCEngine/docs/api/rhi/opengl/device/get-device-info.md
ssdfasd b414bc5326 refactor(docs): Fix broken links across multiple modules
Fixed broken references:
- texture-import-settings: Fix 16 files referencing wrong overview filename
- math/rectint: Fix 9 method links (rectint-* → get*, contains, intersects)
- rhi/opengl/device: Fix 8 cross-references (opengl-* → */**)
- resources/mesh: Fix meshsection and vertexattribute links
- rhi/d3d12/sampler: Fix RHISampler reference path
- math/vector3: Fix projectonplane → project-on-plane
- rhi/opengl/command-list: Remove broken ClearFlag enum ref
- rhi/opengl/device: Create 2 new method docs (MakeContextCurrent, GetNativeContext)
- rhi/device: Fix device-info types reference

All 0 broken references remaining.
2026-03-26 02:41:00 +08:00

54 lines
1.5 KiB
Markdown

# 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/types.md) - 设备信息结构定义
- [GetCapabilities](get-capabilities.md) - 获取设备能力
- [GetDeviceInfoImpl](get-device-info-impl.md) - 获取设备信息实现