Skip to content

Commit f1a6867

Browse files
mardyWinterMute
authored andcommitted
Do not transpose the projection matrix
The 4x4 projection matrix is correct as-is, there's no need of transposing it. As a matter of fact, transposing it was causing the scene to always be horizontally centered regardless of the left/right planes set on glFrustum(). This went unnoticed until now because most of the examples/tutorials use a simple frustum where both vertical and horizontal coordinates are set to [-1, 1].
1 parent 19d00d6 commit f1a6867

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/gc_gl.c

+5-9
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,12 @@ static void draw_arrays_general(float *ptr_pos, float *ptr_normal, float *ptr_te
106106

107107
#define PROJECTION_UPDATE \
108108
{ \
109-
float trans[4][4]; \
110-
int i; \
111-
int j; \
112-
for (i = 0; i < 4; i++) \
113-
for (j = 0; j < 4; j++) \
114-
trans[i][j] = glparamstate.projection_matrix[j][i]; \
115-
if (trans[3][3] != 0) \
116-
GX_LoadProjectionMtx(trans, GX_ORTHOGRAPHIC); \
109+
if (glparamstate.projection_matrix[3][3] != 0) \
110+
GX_LoadProjectionMtx(glparamstate.projection_matrix, \
111+
GX_ORTHOGRAPHIC); \
117112
else \
118-
GX_LoadProjectionMtx(trans, GX_PERSPECTIVE); \
113+
GX_LoadProjectionMtx(glparamstate.projection_matrix, \
114+
GX_PERSPECTIVE); \
119115
}
120116

121117
#define NORMAL_UPDATE \

0 commit comments

Comments
 (0)