prolly not the best.. cause it''s not easy to change the size of the map yet but:
int generate_landscape() { GLfloat x, y; int i=0; for (y=-size/2;y<size/2;y+=1.0f) for (x=-size/2;x<size/2;x+=1.0f) { p[i].x = x; p[i].y = y; i++; } for (i=0;i<size*size;i++) { p[i].z = randFloat(-1.0f, 2.0f); } return TRUE;}int draw_landscape() { int i; glPushMatrix(); for (i=0;i<size*size;i++) { if (i != 5 && i != 11 && i != 17 && i != 23 && i != 29 && i != 35) { if (i != 30 && i != 31 && i != 32 && i != 33 && i != 34 && i != 35) { glBegin(GL_QUADS); glTexCoord2f(0.0f, 1.0f); glVertex3f(p[i].x, p[i].y, p[i].z); glTexCoord2f(1.0f, 1.0f); glVertex3f(p[i+1].x, p[i+1].y, p[i+1].z); glTexCoord2f(1.0f, 0.0f); glVertex3f(p[i+size+1].x, p[i+size+1].y, p[i+size+1].z); glTexCoord2f(0.0f, 0.0f); glVertex3f(p[i+size].x, p[i+size].y, p[i+size].z); glEnd(); } } } glPopMatrix(); // water glPushMatrix(); //glColor3f(0.0f, 0.0f, 1.0f); glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); glVertex3f(p[0].x, p[0].y, waterheight); glVertex3f(p[5].x, p[5].y, waterheight); glVertex3f(p[35].x, p[35].y, waterheight); glVertex3f(p[30].x, p[30].y, waterheight); glEnd(); glEnable(GL_TEXTURE_2D); glPopMatrix(); return TRUE;}
|
this code will prolly get garbled, but what can ya do
![](smile.gif)
Scott