OpenGL: glRotate and some 3D questions.

Posts: 281
Joined: 2009.04
Post: #1
I've been reading NeHe's OpenGL tutorials, and I don't understand glRotate. I see how it works, but how does one take glRotate and apply it to the plane? I mean, the plane in NeHe's work's coordinate's are just
glVertex3f(-1.0f, 1.0f, 0.0f);            // Top Left Of The Quad
        glVertex3f( 1.0f, 1.0f, 0.0f);            // Top Right Of The Quad
        glVertex3f( 1.0f,-1.0f, 0.0f);            // Bottom Right Of The Quad
        glVertex3f(-1.0f,-1.0f, 0.0f);

I don't see any rotated variables? And where's the connection between rquad and the Quad's coords?

PS. It looks as if NeHe is using predefined perspective algorithms. Where do they affect the shapes?

~ Bring a Pen ~
Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #2
OpenGL is stateful. Things like the current matrix transformation are kept track of internally. When you call a function like glRotate, you're performing an operation that modifies the current transformation matrix. When you call glVertex, the coordinates you specify are multiplied by the projection and modelview matrices before being rasterized.

The above is a very simplified explanation; the OpenGL Red book (an old version is available online) explains all of this in greater detail than I'd be able to. I'd highly recommend it as a learning resource.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL ES2... many questions vunterslaush 39 36,806 Sep 5, 2011 09:21 AM
Last Post: ipeku
  OpenGL ES questions regarding 2D mixed with 3D jeonghyunhan 5 7,754 Jun 20, 2009 03:54 PM
Last Post: jeonghyunhan
  Basic OpenGL questions Mercy 5 6,224 Dec 23, 2008 10:25 AM
Last Post: AnotherJake
  Some OpenGL 2D questions oskob 16 12,165 Oct 30, 2008 12:12 PM
Last Post: Wowbagger
  Dreaded noob questions: OpenGL in a Cocoa App 5thPeriodProductions 5 6,117 Apr 10, 2006 11:08 AM
Last Post: 5thPeriodProductions