如何使用原始重启功能

Neo*_*mex -1 opengl

我正在尝试制作地形网格,现在得到这样的东西:

    GL.PushMatrix();
    GL.Begin(BeginMode.TriangleStrip);

    for (int i = 0; i < 6; i++)
    {
        for (int j = 0; j < 6; j++)
        {
            GL.Vertex2(0 + 50 * j, 0 + 50 * i);
            GL.Vertex2(0 + 50 * j, 0 + 50 + 50 * i);
        }

    }

    GL.End();
    GL.PopMatrix();
Run Code Online (Sandbox Code Playgroud)

但它看起来不像是假设,它应该如何正确完成?

图片http://img821.imageshack.us/img821/5387/otkl.jpg

Nic*_*las 7

如果没有索引列表,则无法使用原始重启.此外,原始重启是一种性能增强工具; 如果你正在使用立即模式渲染(glBegin/End),你已经放弃了性能.所以只需将开头和结尾放在循环中,如下所示:

for (int i = 0; i < 6; i++)
{
    GL.Begin(BeginMode.TriangleStrip);
    for (int j = 0; j < 6; j++)
    {
        GL.Vertex2(0 + 50 * j, 0 + 50 * i);
        GL.Vertex2(0 + 50 * j, 0 + 50 + 50 * i);
    }
    GL.End();
}
Run Code Online (Sandbox Code Playgroud)