Files
XCEngine/docs/api/rhi/opengl/device/get-native-device.md

36 lines
920 B
Markdown
Raw Normal View History

2026-03-20 02:35:45 +08:00
# OpenGLDevice::GetNativeDevice
```cpp
void* GetNativeDevice() override
```
获取原生图形设备指针。
## 详细描述
返回原生图形 API 的设备指针。OpenGL 是一种状态机模型,没有传统意义上的"设备"对象,因此此方法返回 `nullptr`
## 返回值
`void*` - 始终返回 `nullptr`OpenGL 无原生设备对象)
## 注意事项
- OpenGL 使用隐式状态机模式,不需要显式的设备对象
- 如需获取 OpenGL 上下文相关信息,使用 `GetCapabilities()``GetDeviceInfo()`
- 如需获取窗口句柄,使用 `GetWindow()` 方法
## 示例
```cpp
void* native = device.GetNativeDevice();
// 注意:当前实现返回 nullptr
// OpenGL 为状态机,无需设备对象
```
## 相关文档
- [OpenGLDevice](device.md) - 类总览
- [GetWindow](get-window.md) - 获取 GLFW 窗口
- [GetCapabilities](get-capabilities.md) - 获取设备能力