glOrtho

glOrtho

這個函式描述了一個平行修剪空間。這種投影意味著離觀察者較遠的對象看上去不會變小(與透視投影相反)。在3D笛卡爾坐標中想像這個修剪空間,左邊和右邊是最小和最大的X值,下邊和上邊是最小和最大的Y值,近處和遠處是最小和最大的Z值。 正射投影,又叫平行投影。這種投影的視景體是一個矩形的平行管道,也就是一個長方體。正射投影的最大一個特點是無論物體距離相機多遠,投影后的物體大小尺寸不變。這種投影通常用在建築藍圖繪製和計算機輔助設計等方面,這些行業要求投影后的物體尺寸及相互間的角度不變,以便施工或製造時物體比例大小正確。

中文解釋

函式簡介

使用glOrtho 函式可以將當前的可視空間設定為正投影空間。基參數的意義如圖,如果繪製的圖空間本身就是二維的,可以使gluOrtho2D.他的使用類似於glOrtho.

函式用途

設定或修改修剪空間的範圍

句法

void glOrtho(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble near,GLdouble far);

描述

glOrtho就是一個正射投影函式。它創建一個平行視景體。實際上這個函式的操作是創建一個正射投影矩陣,並且用這個矩陣乘以當前矩陣。其中近裁剪平面是一個矩形,矩形左下角點三維空間坐標是(left,bottom,-near),右上角點是(right,top,-near);遠裁剪平面也是一個矩形,左下角點空間坐標是(left,bottom,-far),右上角點是(right,top,-far)。所有的near和far值同時為正或同時為負。如果沒有其他變換,正射投影的方向平行於Z軸,且視點朝向Z負軸。這意味著物體在視點前面時far和near都為負值,物體在視點後面時far和near都為正值。

MSDN中的解釋

glOrtho

NAME

glOrtho -- multiply the current matrix by an orthographic matrix

C SPECIFICATION

void glOrtho(GLdouble left,

GLdouble right,

GLdouble bottom,

GLdouble top,

GLdouble near,

GLdouble far)

PARAMETERS

left, right

Specify the coordinates for the left and right vertical clipping planes.

bottom, top

Specify the coordinates for the bottom and top horizontal clipping planes.

near, far

Specify the distances to the nearer and farther depth clipping planes. These distances are negative if the plane is to be behind the viewer.

DESCRIPTION

glOrtho describes a matrix that produces a parallel projection. (left, bottom, -near) and (right, top, -near) specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, respectively, assuming that the eye is located at (0, 0, 0). -far specifies the location of the far clipping plane. Both near and far can be either positive or negative.

The current matrix is multiplied by this matrix with the result replacing the current matrix. That is, if M is the current matrix and O is the ortho matrix, then M is replaced with M*O.

Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.

ERRORS

GL_INVALID_OPERATION is generated if glOrtho is called between a call to glBegin and the corresponding call to glEnd.

相關詞條

相關搜尋

熱門詞條

聯絡我們