PDA

View Full Version : Bumpy Road



rp_bohs
11-24-2003, 11:57 PM
I am trying to draw an uneven surface to represent a road. To start with I wanted to draw it as a sine wave, so that the bumps would be regular, and this is what I want to measure & operate on etc. The code I'm using looks like this:
*********************************************
display_road = glGenLists(XMAX - XMIN);
glNewList (display_road, GL_COMPILE);
for (double i = XMIN; i < XMAX; i++){
bump = sin(i);
glBegin(GL_QUADS); {
glNormal3f(0.0, 1.0, 0.0);
glVertex3f(i, bump, ZMIN);
glVertex3f(i, bump, ZMAX);
glVertex3f(i+1, bump, ZMAX);
glVertex3f(i+1, bump, ZMIN);
glEnd();
}
glEndList();
}
*********************************************
This seems to execute the loop once as a small line gets drawn, but nothing else. If anyone knows where I'm going wrong, or has any other ideas about how to draw a "bumpy road" surface, I would appreciate the help.
Cheers.

hyvelbank
11-25-2003, 12:04 AM
Seems to me like the glEndList should be moved outside of the loop.