Is it possible to use GL.Vertex3 in a for loop?

Hello.

I want to draw some lines using GL.Vertex3, but I need to draw them in a for loop.
like this:

private void OnPostRender()
    {
        GL.PushMatrix();
        // set the current material
        lineMaterial.SetPass(0);

        GL.Color(new Color(0, 0, 0, 0.4f));

        GL.Begin(GL.LINES);

        // horizontal
        for (int i = 0; i < 10; i++)
        {
            GL.Vertex3(-10, 0.01f, i * 2 - 10);
        }
        GL.End();

        GL.PopMatrix();
}

But when I try to do it like this, no lines are drawn at all. Is it possible to do this in another way?

I know its very late still, Yes it can be used in a for loop…
However as you are using GL.LINES as mode for GL.Begin(), You should keep in mind that the vertexes will be paired…

So if you add 10 vertices it the lines will be in between 1-2 ,3-4 , 5-6, 7-8,9-10… meaning there wont be any line between point 2 and 3… similarly 4 and 5 and so on…

And Since you are calling these in OnPostRender() make sure you attach the script with a camera object.