Original Post
I''m building a skydome. I have a std::vector of vertices. There are 4 rows, and 8 vertices per row. The vertices contains the data sequentially(see below). Here''s my render code:
for (int i = 0; i < (resolution / 2); i++) {
glColor3f(0.0f, 0.0f, 1.0f);
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glBegin(GL_TRIANGLE_STRIP);
for (int j = 0; j < resolution; j++) {
glVertex3f(vertices[vertCounter].x, vertices[vertCounter].y, vertices[vertCounter].z);
glVertex3f(vertices[vertCounter + resolution].x, vertices[vertCounter + resolution].y, vertices[vertCounter + resolution].z);
vertCounter++;
}
glEnd();
}
Basically I draws the first vertex, then steps 8 forward(resolution = 8), draws that vertex, then steps 7 back, draws that, then 8 forward, draws that, etc. So it should basically draw one from the top row, then one from the bottom row, then back to the top row, etc.
Unfortunately it''s creating an absolute mess of lines everywhere. Instead of neatly tesselating triangles, I have overlapping ones, etc. Here''s the raw vertices std::vector:
0, 100, 0
0, 100, 0
0, 100, 0
0, 100, 0
0, 100, 0
0, 100, 0
0, 100, 0
0, 100, 0
0, 100, 0
-37.4607, 92.7184, 0
-26.4887, 92.7184, -26.4887
26.4887, 92.7184, -26.4887
-2.6974e-06, 92.7184, 37.4607
5.97231e-06, 92.7184, -37.4607
-26.4887, 92.7184, 26.4887
26.4887, 92.7184, 26.4887
37.4607, 92.7184, -3.618e-06
37.4607, 92.7184, 2.93183e-06
-69.4658, 71.934, 0
-49.1198, 71.934, -49.1198
49.1198, 71.934, -49.1198
-5.3948e-06, 71.934, 69.4658
1.14677e-05, 71.934, -69.4658
-49.1198, 71.934, 49.1198
49.1198, 71.934, 49.1198
69.4658, 71.934, -6.31627e-06
69.4658, 71.934, 5.82952e-06
-91.3545, 40.6737, 0
-64.5974, 40.6737, -64.5974
64.5974, 40.6737, -64.5974
0, 40.6737, 91.3545
7.98647e-06, 40.6737, -91.3545
-64.5974, 40.6737, 64.5974
64.5974, 40.6737, 64.5974
91.3545, 40.6737, -1.54012e-05
91.3545, 40.6737, 5.71711e-07
-99.9391, 3.48995, 0
-70.6676, 3.48995, -70.6676
70.6676, 3.48995, -70.6676
0, 3.48995, 99.9391
8.73695e-06, 3.48995, -99.9391
-70.6676, 3.48995, 70.6676
70.6676, 3.48995, 70.6676
99.9391, 3.48995, -1.68485e-05
99.9391, 3.48995, 6.25434e-07
Anyone got any ideas as to what I may be doing wrongly here? Thanks,
David