glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
//set viewpoint
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(VIEW_ANGLE,Screen_Ratio,NEAR_CLIP,FAR_CLIP);
gluLookAt(0,5,5, 0,0,0, 0,1,0);
//transform model 1
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(Theta, 0,1,0);
//draw model 1
glBegin(GL_QUADS);
...
glEnd();
上面的代碼工作正常,但有沒有任何方法可以刪除對gluPerspective的調用?如何僅使用gluPerspective一次?
我的意思是,我想在初始化時只調用它一次,而不是在每次渲染過程中重複。
因爲沒有在代碼中調用gluPerspective,渲染會導致意想不到的結果。 – jondinham
你爲什麼如此熱衷於避免這種情況? – Flexo