Fix RHI documentation discrepancies and add missing doc files
Fixed incorrect links in OpenGL documentation:
- Fixed wrong links to threading/task-system docs for Initialize/Shutdown methods
- Fixed wrong links to buffer docs for GetNativeHandle methods
- Fixed wrong links to shader docs for Bind/Unbind methods
- Fixed wrong links to command-list docs for Clear/Reset/Close methods
- Fixed wrong links to buffer/get-size.md for width/height methods
Added missing documentation files:
- OpenGL buffer: bind.md, unbind.md, get-type.md, initialize.md
- OpenGL fence: initialize.md, reset.md
- OpenGL swap-chain: get-size.md, initialize.md
- OpenGL render-target-view: initialize.md, shutdown.md, bind.md, unbind.md, clear.md, get-size.md
- OpenGL depth-stencil-view: initialize.md, shutdown.md, bind.md, unbind.md, get-size.md
- OpenGL command-list: clear.md
All links validated with fix_links.py - no broken references.
2026-03-19 00:54:54 +08:00
|
|
|
|
# OpenGLCommandList::Clear
|
|
|
|
|
|
|
|
|
|
|
|
```cpp
|
2026-03-20 02:35:45 +08:00
|
|
|
|
void Clear(float r, float g, float b, float a, unsigned int buffers)
|
Fix RHI documentation discrepancies and add missing doc files
Fixed incorrect links in OpenGL documentation:
- Fixed wrong links to threading/task-system docs for Initialize/Shutdown methods
- Fixed wrong links to buffer docs for GetNativeHandle methods
- Fixed wrong links to shader docs for Bind/Unbind methods
- Fixed wrong links to command-list docs for Clear/Reset/Close methods
- Fixed wrong links to buffer/get-size.md for width/height methods
Added missing documentation files:
- OpenGL buffer: bind.md, unbind.md, get-type.md, initialize.md
- OpenGL fence: initialize.md, reset.md
- OpenGL swap-chain: get-size.md, initialize.md
- OpenGL render-target-view: initialize.md, shutdown.md, bind.md, unbind.md, clear.md, get-size.md
- OpenGL depth-stencil-view: initialize.md, shutdown.md, bind.md, unbind.md, get-size.md
- OpenGL command-list: clear.md
All links validated with fix_links.py - no broken references.
2026-03-19 00:54:54 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-20 02:35:45 +08:00
|
|
|
|
清除指定的缓冲区。
|
Fix RHI documentation discrepancies and add missing doc files
Fixed incorrect links in OpenGL documentation:
- Fixed wrong links to threading/task-system docs for Initialize/Shutdown methods
- Fixed wrong links to buffer docs for GetNativeHandle methods
- Fixed wrong links to shader docs for Bind/Unbind methods
- Fixed wrong links to command-list docs for Clear/Reset/Close methods
- Fixed wrong links to buffer/get-size.md for width/height methods
Added missing documentation files:
- OpenGL buffer: bind.md, unbind.md, get-type.md, initialize.md
- OpenGL fence: initialize.md, reset.md
- OpenGL swap-chain: get-size.md, initialize.md
- OpenGL render-target-view: initialize.md, shutdown.md, bind.md, unbind.md, clear.md, get-size.md
- OpenGL depth-stencil-view: initialize.md, shutdown.md, bind.md, unbind.md, get-size.md
- OpenGL command-list: clear.md
All links validated with fix_links.py - no broken references.
2026-03-19 00:54:54 +08:00
|
|
|
|
|
|
|
|
|
|
**参数:**
|
2026-03-20 02:35:45 +08:00
|
|
|
|
- `r` - 清除颜色红色分量(范围 0.0f - 1.0f)
|
|
|
|
|
|
- `g` - 清除颜色绿色分量(范围 0.0f - 1.0f)
|
|
|
|
|
|
- `b` - 清除颜色蓝色分量(范围 0.0f - 1.0f)
|
|
|
|
|
|
- `a` - 清除颜色 Alpha 分量(范围 0.0f - 1.0f)
|
|
|
|
|
|
- `buffers` - 要清除的缓冲区标志,使用 `ClearFlag` 枚举值的位或组合:
|
|
|
|
|
|
- `ClearFlag::Color` (1) - 清除颜色缓冲区
|
|
|
|
|
|
- `ClearFlag::Depth` (2) - 清除深度缓冲区
|
|
|
|
|
|
- `ClearFlag::Stencil` (4) - 清除模板缓冲区
|
|
|
|
|
|
|
|
|
|
|
|
**返回值**:无
|
Fix RHI documentation discrepancies and add missing doc files
Fixed incorrect links in OpenGL documentation:
- Fixed wrong links to threading/task-system docs for Initialize/Shutdown methods
- Fixed wrong links to buffer docs for GetNativeHandle methods
- Fixed wrong links to shader docs for Bind/Unbind methods
- Fixed wrong links to command-list docs for Clear/Reset/Close methods
- Fixed wrong links to buffer/get-size.md for width/height methods
Added missing documentation files:
- OpenGL buffer: bind.md, unbind.md, get-type.md, initialize.md
- OpenGL fence: initialize.md, reset.md
- OpenGL swap-chain: get-size.md, initialize.md
- OpenGL render-target-view: initialize.md, shutdown.md, bind.md, unbind.md, clear.md, get-size.md
- OpenGL depth-stencil-view: initialize.md, shutdown.md, bind.md, unbind.md, get-size.md
- OpenGL command-list: clear.md
All links validated with fix_links.py - no broken references.
2026-03-19 00:54:54 +08:00
|
|
|
|
|
|
|
|
|
|
**示例:**
|
|
|
|
|
|
|
|
|
|
|
|
```cpp
|
2026-03-20 02:35:45 +08:00
|
|
|
|
// 清除颜色缓冲区
|
|
|
|
|
|
commandList->Clear(0.0f, 0.0f, 0.0f, 1.0f, static_cast<unsigned int>(ClearFlag::Color));
|
|
|
|
|
|
|
|
|
|
|
|
// 清除颜色和深度缓冲区
|
|
|
|
|
|
commandList->Clear(0.0f, 0.0f, 0.0f, 1.0f,
|
|
|
|
|
|
static_cast<unsigned int>(ClearFlag::Color) |
|
|
|
|
|
|
static_cast<unsigned int>(ClearFlag::Depth));
|
|
|
|
|
|
|
|
|
|
|
|
// 清除所有缓冲区
|
|
|
|
|
|
commandList->Clear(0.0f, 0.0f, 0.0f, 1.0f,
|
|
|
|
|
|
static_cast<unsigned int>(ClearFlag::Color) |
|
|
|
|
|
|
static_cast<unsigned int>(ClearFlag::Depth) |
|
|
|
|
|
|
static_cast<unsigned int>(ClearFlag::Stencil));
|
Fix RHI documentation discrepancies and add missing doc files
Fixed incorrect links in OpenGL documentation:
- Fixed wrong links to threading/task-system docs for Initialize/Shutdown methods
- Fixed wrong links to buffer docs for GetNativeHandle methods
- Fixed wrong links to shader docs for Bind/Unbind methods
- Fixed wrong links to command-list docs for Clear/Reset/Close methods
- Fixed wrong links to buffer/get-size.md for width/height methods
Added missing documentation files:
- OpenGL buffer: bind.md, unbind.md, get-type.md, initialize.md
- OpenGL fence: initialize.md, reset.md
- OpenGL swap-chain: get-size.md, initialize.md
- OpenGL render-target-view: initialize.md, shutdown.md, bind.md, unbind.md, clear.md, get-size.md
- OpenGL depth-stencil-view: initialize.md, shutdown.md, bind.md, unbind.md, get-size.md
- OpenGL command-list: clear.md
All links validated with fix_links.py - no broken references.
2026-03-19 00:54:54 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
|
|
|
|
|
|
- [OpenGLCommandList 总览](command-list.md) - 返回类总览
|
2026-03-20 02:35:45 +08:00
|
|
|
|
- [ClearColor](clear-color.md) - 仅清除颜色缓冲区
|
|
|
|
|
|
- [ClearDepth](clear-depth.md) - 仅清除深度缓冲区
|
|
|
|
|
|
- [ClearStencil](clear-stencil.md) - 仅清除模板缓冲区
|
|
|
|
|
|
- [ClearDepthStencil](clear-depth-stencil.md) - 清除深度和模板缓冲区
|
|
|
|
|
|
- [ClearFlag 枚举](../../enums/clear-flag.md) - 清除缓冲区标志
|