orthogonal projection (D3D)

Started by
3 comments, last by risingdragon3 23 years, 3 months ago
Well, basically what I need is the matrix values for a ortho. matrix. If I had a width, height, near z plane, far z plane, -> what''s the matrix? (Or even better whats the function? ) Oh yeah, I can''t use D3DX* funcs. because I use Borland C++Builder. Sorry! Thanxs in advance, C++Freak ------------------------------ BCB DX Library - RAD C++ Game development for BCB
Advertisement
width is the width of the screen. Height is the height of the screen. near z is however close something has to be before it is behind the viewer. Far clipping plane is how far away something has to be before it is out of sight.


Just because you're outnumbered doesn't mean you're wrong.


sharewaregames.20m.com

Edited by - furby100 on January 11, 2001 12:34:01 PM

quote:
width is the width of the screen. Height is the height of the screen. near z is however close
something has to be before it is behind the viewer. Far clipping plane is how far away
something has to be before it is out of site.

I get that!
But whats the matrix? i.e. is it
[1 0 0 0]
[0 1 0 0]
[0 0 0 0]
[0 0 0 1]
(I think this drops the z coordinate, am I right)?
If it is right, do I translate by -width/2, -height/2, 0 or what?
And what do I scale by?


------------------------------
BCB DX Library - RAD C++ Game development for BCB
It translates it screen_res_width/2 and screen_res_height/2 (if you think about it, this must be correct). scalex = width/screen_res_width; scaley = height/screen_res_height

You could make it throw away the Z coordinate, but what happens in D3D is:
z = z/(farzplane - nearzplane)

This makes z between 0.0 and 1.0, and makes most efficient use of the Z-Buffer. And RHW is set to 1


Just because you''re outnumbered doesn''t mean you''re wrong.


sharewaregames.20m.com

Thanks Furby!

------------------------------
BCB DX Library - RAD C++ Game development for BCB

This topic is closed to new replies.

Advertisement