Using glRotate and glTranslate with collision detection.

Posted by Cetra on Stack Overflow See other posts from Stack Overflow or by Cetra
Published on 2010-03-25T05:19:09Z Indexed on 2010/03/25 5:23 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

Hey guys,

Say I use glRotate to translate the current view based on some arbitrary user input (i.e, if key left is pressed then rtri+=2.5f)

glRotatef(rtri,0.0f,1.0f,0.0f);

Then I draw the triangle in the rotated position:

glBegin(GL_TRIANGLES);  // Drawing Using Triangles
    glVertex3f( 0.0f, 1.0f, 0.0f);  // Top
    glVertex3f(-1.0f,-1.0f, 0.0f);  // Bottom Left
    glVertex3f( 1.0f,-1.0f, 0.0f);  // Bottom Right
glEnd();  // Finished Drawing The Triangle

How do I get the resulting translated vertexes for use in collision detection? Or will I have to manually apply the transform myself and thus doubling up the work?

The reason I ask is that I wouldn't mind implementing display lists.

© Stack Overflow or respective owner

Related posts about opengl

Related posts about c++