Archived

This topic is now archived and is closed to further replies.

noxa

How is it possible to disable perspective in D3D?

Recommended Posts

Hello, I''m using D3D for my render engine, and in one of my little demo''s it is supposed to simulate a RTS with an overhead view. I want to render the 3D units over a 2D terrain - I have it all working but D3D is mucking it up! My units, as they move away from the center of the screen, appear to warp (its the perspective, I know that) - does anyone know how I can turn it off so that all things are flat? It''s hard to describe, so I''ll do some ASCII art (hehe) What it does: ______ / \ <- 3D object ++ <- camera What I want: -------- <- 3D object ++ <- camera If you have ever played the game Total Annihilation (or the sequal) - that''s what I''m going for. They used their own render API, but I don''t want to do that... Thanks for any help, Ben Vanik

Share this post


Link to post
Share on other sites
You can create an orthogonal projection matrix instead of the usual perspective projection matrix. My suggestion is to use D3DXMatrixOrthoLH() to do this.

D3DXMatrix Ortho;
D3DXMatrixOrthoLH(&Ortho, w, h, n, f);
SetTransform(D3DTRANSFORMSTATE_PROJECTION, (D3DMATRIX*)&Ortho);

Share this post


Link to post
Share on other sites