Ok, now two things...
glBegin(GL_TRIANGLE_STRIP); glColor3f(0,1,0); for (int ty = 0; ty < 20; ty ++) { glVertex3f(-10.0f,array[0][ty]-5.0f,ty-10.0f); glVertex3f(-10.0f,array[0][ty+1]-5.0f,ty-9.0f); for (int tx = 1; tx < 20; tx++) { glVertex3f(tx-10.0f,array[tx+1][ty]-5, ty -10.0f); glVertex3f(tx-10.0f,array[tx+1][ty+1]-5, ty-9.0f); } } glEnd();
There''s my rendering code again, and here''s my initializing:
line1[0] = float(rand()%100)/100.0f; line2[0] = float(rand()%100)/100.0f; for (int a = 1; a < 20; a ++) { line1[a] = line1[a-1] + float(rand()%10)/10.0f; line2[a] = line2[a-1] + float(rand()%10)/10.0f; } for (int a = 0; a < 20; a++) for (int b = 0; b < 20; b++) array[a][b] = (line1[a] + line2[b])/2;
Now it''s really strange, most of it works fine, and renders fine, but in some parts it like flips.... and looks really wierd... Its just really wierd...
And secondly how do I enable shading or lighting or something so that i can see the curves in the texture more clearly?