Skip to content

Commit 8dddc02

Browse files
committed
bugfix: opengl proj
1 parent 301ff0f commit 8dddc02

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

math3d.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,9 @@ static inline union matrix44 *
344344
matrix44_perspective(union matrix44 *m, float l, float r, float b, float t, float n, float f, int homogeneousDepth) {
345345
matrix44_identity(m);
346346
float *mx = m->x;
347-
const float aa = (homogeneousDepth ? (f + n) : f) / (f - n);
348-
const float bb = homogeneousDepth ? 2.0f * f * n : n * aa;
347+
const float diff = f - n;
348+
const float aa = (homogeneousDepth ? (f + n) : f) / diff;
349+
const float bb = homogeneousDepth ? 2.0f * f * n / diff : n * aa;
349350

350351
mx[0] = 2.0f * n / (r - l);
351352
mx[5] = 2.0f * n / (t - b);

0 commit comments

Comments
 (0)