gl_mult_matrixf(mat);
}
-void gl_ortho(float left, float right, float bottom, float top, float near, float far)
+void gl_ortho(float left, float right, float bottom, float top, float znear, float zfar)
{
float mat[] = MAT_IDENT;
float dx = right - left;
float dy = top - bottom;
- float dz = far - near;
+ float dz = zfar - znear;
float tx = -(right + left) / dx;
float ty = -(top + bottom) / dy;
- float tz = -(far + near) / dz;
+ float tz = -(zfar + znear) / dz;
float sx = 2.0 / dx;
float sy = 2.0 / dy;
gl_mult_matrixf(mat);
}
-void gl_frustum(float left, float right, float bottom, float top, float near, float far)
+void gl_frustum(float left, float right, float bottom, float top, float znear, float zfar)
{
float mat[] = MAT_IDENT;
float dx = right - left;
float dy = top - bottom;
- float dz = far - near;
+ float dz = zfar - znear;
float a = (right + left) / dx;
float b = (top + bottom) / dy;
- float c = -(far + near) / dz;
- float d = -2.0 * far * near / dz;
+ float c = -(zfar + znear) / dz;
+ float d = -2.0 * zfar * znear / dz;
- mat[0] = 2.0 * near / dx;
- mat[5] = 2.0 * near / dy;
+ mat[0] = 2.0 * znear / dx;
+ mat[5] = 2.0 * znear / dy;
mat[8] = a;
mat[9] = b;
mat[10] = c;
gl_mult_matrixf(mat);
}
-void glu_perspective(float vfov, float aspect, float near, float far)
+void glu_perspective(float vfov, float aspect, float znear, float zfar)
{
float vfov_rad = M_PI * vfov / 180.0;
- float x = near * tan(vfov_rad / 2.0);
- gl_frustum(-aspect * x, aspect * x, -x, x, near, far);
+ float x = znear * tan(vfov_rad / 2.0);
+ gl_frustum(-aspect * x, aspect * x, -x, x, znear, zfar);
}
void gl_apply_xform(unsigned int prog)
void gl_translatef(float x, float y, float z);
void gl_rotatef(float angle, float x, float y, float z);
void gl_scalef(float x, float y, float z);
-void gl_ortho(float left, float right, float bottom, float top, float near, float far);
-void gl_frustum(float left, float right, float bottom, float top, float near, float far);
-void glu_perspective(float vfov, float aspect, float near, float far);
+void gl_ortho(float left, float right, float bottom, float top, float znear, float zfar);
+void gl_frustum(float left, float right, float bottom, float top, float znear, float zfar);
+void glu_perspective(float vfov, float aspect, float znear, float zfar);
void gl_apply_xform(unsigned int prog);