我有這樣的代碼爲什麼我們在openGL中默認查看負z?
glColor3f(1, 0, 0);// red quad
glBegin(GL_QUADS);
glVertex3f(-1, 0, -0.1);
glVertex3f(1, 0, -0.1);
glVertex3f(1, 1, -0.1);
glVertex3f(-1, 1, -0.1);
glEnd();
glColor3f(0, 1, 0); //green quad
glBegin(GL_QUADS);
glVertex3f(-1, 0, -0.2);
glVertex3f(1, 0, -0.2);
glVertex3f(1, 1, -0.2);
glVertex3f(-1, 1, -0.2);
glEnd();
glutSwapBuffers();
使用默認的投影矩陣,顯示是我的綠四的一個。
如果我們看到負z(從1到-1),那麼紅色四邊形後面的綠色四邊形不應該是?
您是否啓用了深度測試? – vesan
定義「默認投影矩陣」。 –
@NicolBolas我只是說我沒有改變投影矩陣。我讀過的默認值與glOrtho(-1,1,-1,1,1,-1)相同,根據https://www.opengl.org/discussion_boards/showthread.php/145698-what -is-the-default-projection-matrix – Rei