# OpenGLCommandList::Draw ```cpp void Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t startVertex, uint32_t startInstance) ``` 绘制非索引图元(实例化绘制)。 **参数:** - `vertexCount` - 每个实例的顶点数量 - `instanceCount` - 要绘制的实例数量 - `startVertex` - 第一个顶点的索引 - `startInstance` - 第一个实例的 ID **返回值**:无 **详细描述**: 此方法使用 `glDrawArraysInstanced` 执行实例化绘制。当 `instanceCount` 为 1 时,等同于普通的非实例化绘制。 **示例:** ```cpp // 绘制单个实例(相当于 glDrawArrays) commandList->Draw(3, 1, 0, 0); // 绘制 100 个实例 commandList->Draw(3, 100, 0, 0); // 绘制多个实例,从实例 ID 10 开始 commandList->Draw(3, 50, 0, 10); ``` ## 相关文档 - [OpenGLCommandList 总览](command-list.md) - 返回类总览 - [DrawIndexed](draw-indexed.md) - 索引绘制 - [OpenGL 特有 Draw 方法](opengl-methods.md#draw-primitivetype) - 使用 PrimitiveType 的版本