total beginner, need help!

hi all,

i’ve never really done any OpenGL at all, and i’m trying to draw a ground plane going from -10 to 10 in X and -10 to 10 in Z, with grid lines spaced 1 unit apart. How would i do this?

Start with a tutorial, like those on nehe.gamedev.net.

Once you have your feet wet, just draw a quad and a bunch of lines, using polygon offset for the lines.

I think a quad strip is suited better. The choice is up to you. Look at the primitives and see for your self.

how exactly does polygon offset work?
i’ve used GL_LINE_LOOP to create the outer edge of the ground plane, but i’m still not sure how to draw in the grid lines

You can do a for-loop that draws GL_LINES, for instance:

glBegin(GL_LINES);
for(x=-10;x<=10;++x)
{
  glVertex3f(x,0,-10);
  glVertex3f(x,0,10);
}
for(z=-10;z<=10;++z)
{
  glVertex3f(-10,0,z);
  glVertex3f(10,0,z);
}
glEnd();