1
在OpenGL中,對於2D中的以下情況,我該如何旋轉這一個四邊形 - 並且只有這一個四邊形(場景中的其他所有東西都應該保持在原來的位置)?在2D中旋轉一個Quad
// Draw in immediate mode
glBegin(GL_QUADS); // begin drawing quads
glVertex2f(box.x,box.y); // top-left corner
glVertex2f(box.x+box.w,box.y); // top-right corner
glVertex2f(box.x+box.w,box.y+box.h); // bottom-right corner
glVertex2f(box.x,box.y+box.h); // bottom-left corner
glEnd(); // end drawing quads
glRotatef(angle, x,y,z)
似乎旋轉我的整個場景。
那麼我需要傳遞給'glRotatef'才能使我的四邊形旋轉90deg? – Ben 2012-02-10 20:02:59
@Ben:你甚至懶得看看glRotate的[文檔](http://www.opengl.org/sdk/docs/man/)嗎?它清楚地說:「指定旋轉角度,以度爲單位。」該頁面實際上是在Google中搜索「glRotatef」的第一個結果。 – 2012-02-10 20:05:58
@Nicol我不知道要傳遞什麼'x,y,z',以便它旋轉整個對象而不是一個向量。 – Ben 2012-02-10 20:08:16