Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. cgmath::ortho(0.0, 800.0, 0.0, 600.0, -1.0, 1.0) yields
  2. [0.0025, 0, 0, -1]
  3. [0, 0.004, 0, -1]
  4. [0, 0, -1, 0]
  5. [0, 0, 0, 1]
  6. which I believe is correct.
  7.  
  8. nalgebra::OrthoMat3::new(800.0, 600.0, -1.0, 1.0) yields
  9. [0.0025, 0, 0, 0]
  10. [0, 0.003333, 0, 0]
  11. [0, 0, -1, 0]
  12. [0, 0, 0, 1]
  13. which doesn't work
  14.  
  15. based on the wikipedia page http://en.wikipedia.org/wiki/Orthographic_projection, you are missing the top two values on the right most column
  16. -((800 + 0)/(800 - 0)), -((600 + 0)/(600 - 0))
  17.  
  18. However, I do note that your ortho matrix doesn't really have a left/right and top/bottom, just a width and height so perhaps I'm missing something.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement