Skip to content

Commit 0a088f5

Browse files
author
Romain Guy
committed
Fix android.opengl.Matrix frustum's generation
External bug report: http://code.google.com/p/android/issues/detail?id=35646 Change-Id: I845783c05da46855f0c1d824c9a367f0e4673b85
1 parent c252595 commit 0a088f5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

opengl/java/android/opengl/Matrix.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ public static void orthoM(float[] m, int mOffset,
312312
* @param near
313313
* @param far
314314
*/
315-
316315
public static void frustumM(float[] m, int offset,
317316
float left, float right, float bottom, float top,
318317
float near, float far) {
@@ -336,10 +335,10 @@ public static void frustumM(float[] m, int offset,
336335
final float r_depth = 1.0f / (near - far);
337336
final float x = 2.0f * (near * r_width);
338337
final float y = 2.0f * (near * r_height);
339-
final float A = 2.0f * ((right + left) * r_width);
338+
final float A = (right + left) * r_width;
340339
final float B = (top + bottom) * r_height;
341-
final float C = (far + near) * r_depth;
342-
final float D = 2.0f * (far * near * r_depth);
340+
final float C = -(far + near) * r_depth;
341+
final float D = -2.0f * (far * near * r_depth);
343342
m[offset + 0] = x;
344343
m[offset + 5] = y;
345344
m[offset + 8] = A;

0 commit comments

Comments
 (0)