# OpenGL Cavalier Projection

This topic is 3671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

When I help my professor do the marking of a quiz, I came across a question about implementing Cavalier Projection using OpenGL. While the suggested answer from my professor and those I found on internet are both not very useful, I wrote one myself. Just in case someone might want to find one, here is the Cavalier Projection function I wrote.
void glOblique( GLdouble alpha, GLdouble phi, GLdouble aspect, GLdouble zNear, GLdouble zFar )
{
double x, z, a, b, c, m[16];
x = 1/aspect;
a = cos(phi*PI/180)/tan(alpha*PI/180);
b = sin(phi*PI/180)/tan(alpha*PI/180);
z = -2/(zFar-zNear);
c = -(zFar+zNear)/(zFar-zNear);
m[0]=x; m[4]=0; m[ 8]=-a; m[12]=a;
m[1]=0; m[5]=1; m[ 9]=-b; m[13]=b;
m[2]=0; m[6]=0; m[10]= z; m[14]=c;
m[3]=0; m[7]=0; m[11]= 0; m[15]=1;
glMultMatrixd(m);
}


Alpha and phi are measured in degree and they are defined as http://local.wasp.uwa.edu.au/~pbourke/geometry/classification/.

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633696
• Total Posts
3013396
×