Jump to content
  • Advertisement
Sign in to follow this  
Andrew1979

Rotating triangle strips

This topic is 3636 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

Hi Everyone I've created a hemisphere which will be in the end a sky dome. However once I've generated the points and generated the sphere (no textures as yet), it needs rotating so it's in the correct position (it's on its side at the moment). I'm not fully sure how to do this and have had a few goes at it using glRotate but having no look. The following code segment draws up the points to make the hemisphere: glBegin(GL_TRIANGLE_STRIP); for(int i = 0; i != NumVertices; i++) { glVertex3f(Vertices.x, Vertices.y, Vertices.z); } glEnd(); I know I'll need to use glRotate3f but I'm not sure how in this situation. Any help appreciated. Thank you in advance. Andrew

Share this post


Link to post
Share on other sites
Advertisement
glRotetef takes 4 floats, first for the amount of rotation, and 3 others to determine around what it should rotate.

glRotatef(xRotation,1.0f,0.0f,0.0f);
glRotatef(yRotation,0.0f,1.0f,0.0f);
glRotatef(zRotation,0.0f,0.0f,1.0f);

there, examble on how to rotate around x, y, and z axels.

Share this post


Link to post
Share on other sites
And because the question itself hints at some misunderstandings: you have to call glRotate BEFORE you draw the strip... or any other kind of whatever it is you want to rotate. Doesn't matter if it's a triangle, a strip or a complex model consisting of 20 seperate parts.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!