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

31 lines
796 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OpenGLDevice::GetDC
获取 OpenGL 设备的设备上下文Device Context
```cpp
HDC GetDC() const;
```
返回与 OpenGL 渲染上下文关联的 Windows 设备上下文句柄。
**参数:**
**返回:** `HDC` - Windows 设备上下文句柄
**线程安全:**
**注意:** 此方法返回原生 Windows HDC可用于低级 GDI 操作或与原生 Windows OpenGL 上下文交互。大多数情况下不需要直接使用此方法。
**示例:**
```cpp
HDC hdc = device.GetDC();
// 可以使用 hdc 进行原生 Windows OpenGL 操作
HDC currentDC = wglGetCurrentDC();
```
## 相关文档
- [OpenGLDevice 总览](device.md) - 返回类总览
- [GetContext](get-context.md) - 获取 OpenGL 渲染上下文
- [GetWindow](get-window.md) - 获取 GLFW 窗口指针