Advertisement

Orthogonal Projection in D3D

Started by January 07, 2000 11:41 AM
3 comments, last by Ro 25 years, 2 months ago
How do I setup an orthogonal projection matrix in D3D? In OpenGL all I have to do is say gluOrtho(). I''m texture mapping two triangles and using them to rotate my bitmaps, and want to have control over where they are placed in pixels. Is this possible? Also, how do I change the 3d origin from the center of the screen to the top left corner? Thanks!!
One thing you can do is use a D3DTLVERTEX structure instead of the normal D3DVERTEX structure. TLVertex''s are transformed and lit, and the x,y,z members are in screen coordinates, so you can render a triangle strip of 2 triangles making a rectangle to do what you want. The "origin" of screen coords is the UL corner. I use it in my program, its a great way to do fade-in, fade-out, and to "blt" semitransparent bitmaps on top of other stuff (in my case a 3d scene). When using these, I dont think the projection matrix is even used (but I''d set it to a good 3d projection matrix, how to do this is explained in the docs. An orth. matrix should not be hard to make either, but like I said you dont need one when using the above method.
Hope this helped.
-ns

-ns
-ns-
Advertisement
The Direct3DX Utility Library has a function called D3DXMatrixOrtho and D3DXMatrixOrthoLH (for left-handed coord system) that does the same thing.

Thanks for the help!!!
Another suggestion: Just use an identity matrix for your projection matrix.

--TheGoop

This topic is closed to new replies.

Advertisement