Jump to content

  • Log In with Google      Sign In   
  • Create Account

bradhe

Member Since 26 Aug 2011
Offline Last Active Jun 24 2012 12:01 AM

Posts I've Made

In Topic: Matrix to vector?

22 June 2012 - 09:21 PM

Wow, yeah that was crazy easy. I cross-referenced Wikipedia on Perspective projection matrices, your simple suggestion + Wikipedia made it obvious. Here's what I ended up with:

[source lang="java"] public static Matrix4f fromVector(Vector3f vector) { Matrix4f matrix = new Matrix4f(); matrix.m30 = vector.x; matrix.m31 = vector.y; matrix.m32 = vector.z; matrix.m33 = 1; return matrix; } public static Vector3f toVector(Matrix4f matrix, Vector3f vector) { vector.x = matrix.m30; vector.y = matrix.m31; vector.z = matrix.m32; return vector; } public static void mul(Matrix4f left, Vector3f right, Vector3f result) { Matrix4f matrix = fromVector(right); Matrix4f.mul(left, matrix, matrix); toVector(matrix, result); }[/source]

In Topic: Indexed primitive looks wonky with lighting

26 August 2011 - 11:08 AM

Looks like you don't have depth testing enabled (GL_DEPTH_TEST)


Awww god. that was it! Thanks. How did you know that? Just experience, or is there a mathematical explanation?

PARTNERS