Computergrafik

OpenGL Perspektive

GL Matrix Manipulation | | GL Transformationen

Um mit OpenGL die Perspektive festzulegen, multipliziert man im Matrix Mode “GL_PROJECTION” eine entsprechende 4×4 Projektionsmatrix an die Identitätsmatrix:

// switch to modify projection matrix
glMatrixMode(GL_PROJECTION);
// load identity into projection matrix
glLoadIdentity();
// multiply perspective transform onto projection matrix
gluPerspective(fovy,aspect,nearp,farp);
// switch back to modify modelview matrix
glMatrixMode(GL_MODELVIEW);

Die Parameter, um ein Frustum mit 90 Grad Blickwinkel (ca. 50mm KB-Brennweite) zu definieren, sind:

float fovy=90; // 50mm standard lens
float aspect=1; // quadratic window
float nearp=1;
float farp=100;


GL Matrix Manipulation | | GL Transformationen

Options: