glViewport

glViewport

glOrtho是創建一個正交平行的視景體。 一般用於物體不會因為離螢幕的遠近而產生大小的變換的情況。比如,常用的工程中的製圖等。需要比較精確的顯示。 而作為它的對立情況, glFrustum則產生一個透視投影。這是一種模擬真是生活中,人們視野觀測物體的真實情況。例如:觀察兩條平行的火車到,在過了很遠之後,這兩條鐵軌是會相交於一處的。還有,離眼睛近的物體看起來大一些,遠的物體看起來小一些。

glViewport
NAME
glViewport -- set the viewport
C SPECIFICATION
void glViewport(GLint x,
GLint y,
GLsizei width,
GLsizei height)
PARAMETERS 參數說明
x, y
Specify the lower left corner of the viewport rectangle, in pixels. The default is (0, 0).
指定視口矩形左下角,以像素為單位。默認值為(0,0)。指定視口矩形左下角,以像素為單位。默認值為(0,0)。
width, height
Specify the width and height, respectively, of the viewport. When a GL context is first attached to a window, width and height are set to the Dimensions of that window.
分別指定寬度和高度。根據視窗的實時變化重繪視窗
DESCRIPTION
glViewport specifies the affine transformation of x and y from normalized device coordinates to window coordinates. Let (xnd, ynd) be normalized device coordinates. Then the window coordinates (xw, yw) are computed as follows:
Viewport width and height are silently clamped to a range that depends on the implementation. This range is queried by calling glGet with argument GL_MAX_VIEWPORT_DIMS.
ERRORS
GL_INVALID_VALUE is generated if either width or height is negative.
GL_INVALID_OPERATION is generated if glViewport is executed between the execution of glBegin and the corresponding execution of glEnd.

相關詞條

相關搜尋

熱門詞條

聯絡我們