/// <summary>
///
/// </summary>
/// <param name="program"></param>
/// <param name="vaos"></param>
/// <param name="switchList"></param>
public void Draw(ShaderProgram program, VertexArrayObject[] vaos, GLSwitchList switchList = null)
{
// 绑定shader
program.Bind();
program.PushUniforms(); // push new uniform values to GPU side.
if (switchList != null)
{
switchList.On();
}
this.Bind();
foreach (var vao in vaos)
{
DrawMode mode = vao.DrawCommand.CurrentMode;
this.Begin(mode);
vao.Bind();
this.Draw(mode);
vao.Unbind();
this.End();
}
this.Unbind();
if (switchList != null)
{
switchList.Off();
}
// 解绑shader
program.Unbind();
}