Sign in to follow this  
Andrew1979

Rotating triangle strips

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[i].x, Vertices[i].y, Vertices[i].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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this