Creating Projection Matrix Using D3DXMatrixOrthoLH()???
Hi!
Can someone tell me why nothing appears on the screen when I use D3DXMatrixOrthoLH() to create the projection matrix. I have followed the article "2D Rendering In DirectX 8" and it tells me that I should create the projection matrix using D3DXMatrixOrthoLH() but when I use it my textured quad changes into a blue dot (1x1 pixel) in the middle of the screen.
But if I use D3DXMatrixPerspectiveFovLH() to create the projection matrix instead, everything works fine. But I don''t want to use D3DXMatrixPerspectiveFovLH() because in 2D I dont want a perspective.
-Thanks
René
You should stick this post in the directx forum, but anyways-
I had some similiar woes with ortho stuff in directx. I''m assuming your passing the heigh and width of your screen to the function and passing probably -1,1 for the z part. This makes the point 0,0 in the center of your screen, so for example the bottom left would be -width/2, -height/2.
but the reason the quad changes into a 1x1 is not clear: explain more on how your passing the coordinates of the texture. and make sure your not rotating it.
I had some similiar woes with ortho stuff in directx. I''m assuming your passing the heigh and width of your screen to the function and passing probably -1,1 for the z part. This makes the point 0,0 in the center of your screen, so for example the bottom left would be -width/2, -height/2.
but the reason the quad changes into a 1x1 is not clear: explain more on how your passing the coordinates of the texture. and make sure your not rotating it.
I know the exact problem you are having. The x and y size of D3DXMatrixOrthoLH is defined in world space , not screen space.
So if it''s declared as 640x480, you have a gigantic viewing frustum, making almost anything appear microscopic.
Instead, make your frustum 30x20. This should fix your problem, and keep the correst aspect ratio.
-----------------
The Goblin (madgob@aol.com)
-----------------
"Before critisizing somebody, walk a mile in their shoes. That way, when you do critisize them, not only will you be a mile away, but you''ll also have their shoes!"
So if it''s declared as 640x480, you have a gigantic viewing frustum, making almost anything appear microscopic.
Instead, make your frustum 30x20. This should fix your problem, and keep the correst aspect ratio.
-----------------
The Goblin (madgob@aol.com)
-----------------
"Before critisizing somebody, walk a mile in their shoes. That way, when you do critisize them, not only will you be a mile away, but you''ll also have their shoes!"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement