Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

redcliffe

Tristrip hell

This topic is 5616 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Okay, just noticed my data is faulty not the tristrip generator. It appears to be a problem with my rotation matrix. At the moment for it I have:

data[0][0] = cos(theta);
data[0][2] = sin(theta);
data[2][0] = -sin(theta);
data[2][2] = cos(theta);

I apply those changes to an Identity matrix to form my Y rotation matrix. Thanks,

David

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!