View Full Version : Bumpy Road

11-24-2003, 10: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);
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.

11-24-2003, 11:04 PM
Seems to me like the glEndList should be moved outside of the loop.