DX Projection Matrix.

BlitzMax Forums/BlitzMax Programming/DX Projection Matrix.

tonyg(Posted 2007) [#1]
Can anybody explain how Mark is using the Projection Matrix?
This is what is set :
		matrix=[..
		2.0/gw,0.0,0.0,0.0,..
		 0.0,-2.0/gh,0.0,0.0,..
		 0.0,0.0,2.0/depth,0.0,..
		 -1-(1.0/gw),1+(1.0/gh),1.0,1.0]

with gw being graphicswidth(), gh is graphicsheight() and depth = 2.0.
I've read the DX7 doc for Projection Matrix and can't tally the settings with the values Mark is using.
Anybody know what's happening?


TartanTangerine (was Indiepath)(Posted 2007) [#2]
matrix=[..
         sx      ,0.0      ,0.0         ,0.0,..
         0.0      ,-sy      ,0.0         ,0.0,..
         0.0      ,0.0      ,2.0/depth   ,0.0,..
         -1-(1.0/width),1+(1.0/height),1.0,1.0] 

sx and sy are the matrix position or camera position (in your case the camera is pointed directly at the center of the view), depth = depth of view (only objects within this depth will be rendered). height and width are the size of your view on the world.


tonyg(Posted 2007) [#3]
Thanks Tim.
In D3D7Max2D the viewport is set with gw/gh.
I guess the camera height and width is creating a smaller view of that viewport. Is that right?
If so, what is the benefit and why -1-(1.0/gw) which seems a tiny amount.
I might even be looking at the wrong thing.
I want to be able to create a camera and rotate it with the correct aspect ratio as well as zoom. I have got some way to doing that.
Any ideas on this?
<edit> I have RTT working now and it was nothing to do with the matrix... my mistake.