PDA

View Full Version : total beginner, need help!



gunnerSM14
09-24-2004, 07:38 AM
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?

endash
09-24-2004, 08:06 AM
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.

dvm
09-24-2004, 09:14 AM
I think a quad strip is suited better. The choice is up to you. Look at the primitives and see for your self.

gunnerSM14
09-24-2004, 09:27 AM
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

marcus256
09-27-2004, 11:40 PM
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();