Jump to content
  • Advertisement


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



This topic is 5830 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''ve got a wierd problem. I''m drawing a mesh, in which currently the Y axis coordinate of every vertex is 3. Yet for some reason, my mesh is skewed at 45 degrees to the X axis. It''s really wierd. Here''s the code in question. I generate my mesh like this: int numStepsLength = (int)(CLOTH_LENGTH / CLOTH_RES); int numStepsWidth = (int)(CLOTH_WIDTH / CLOTH_RES); int clothCounter = 0; // Step through all points for (float x = CLOTH_START_X; x < (CLOTH_LENGTH + CLOTH_START_X); x = (x + CLOTH_RES)) { for (float z = CLOTH_START_Z; z > (CLOTH_START_Z - CLOTH_WIDTH); z = (z - CLOTH_RES)) { cloth_points.push_back(); cloth_points[clothCounter].id = clothCounter; cloth_points[clothCounter].x = x; cloth_points[clothCounter].y = CLOTH_START_Y; cloth_points[clothCounter].z = z; cloth_points[clothCounter].v.dx = x; cloth_points[clothCounter].v.dy = CLOTH_START_Y; cloth_points[clothCounter].v.dz = z; clothCounter++; } } The actual mesh drawing is done like this: int numStepsLength = (int)(CLOTH_LENGTH / CLOTH_RES); int numStepsWidth = (int)(CLOTH_WIDTH / CLOTH_RES); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // Now that we''ve done all the vector calculations and rubbish draw our quads glBegin(GL_QUADS); for (int i = 1; i < numStepsWidth; i++) { for (int j = 1; j < numStepsLength; j++) { glColor3f(1.0f, 0.0f, 0.0f); glVertex3f(cloth_points.x, cloth_points[i].y, cloth_points[i].z); glVertex3f(cloth_points[(i+(1*j))].x, cloth_points[(i+(1*j))].y, cloth_points[(i+(1*j))].z); glVertex3f(cloth_points[((i+(1*j))+1)].x, cloth_points[((i+(1*j))+1)].y, cloth_points[((i+(1*j))+1)].z); glVertex3f(cloth_points[(i+1)].x, cloth_points[(i+1)].y, cloth_points[(i+1)].z); } } glEnd(); Can anyone see anything I''m missing? 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!