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

Ortho Projection Without D3DX??

This topic is 5974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Try this :

    D3DMATRIX7 d3dMatrix;

    float fAspect = ((float)dwHeight)/((float)dwWidth);
    float fTemp = (sinf(fFOV/2.0f) / (sinf(fFOV/2.0f) * fZoom));

    float w = fAspect * fTemp;
    float h = fTemp;

    d3dMatrix._11 = w;
    d3dMatrix._22 = h;
    d3dMatrix._33 = 0.0f;
    d3dMatrix._43 = 1.0f;

    lpD3DDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &d3dMatrix);

"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick

"It is far easier for a camel to pass through the eye of a needle if it first passes through a blender" -- Damocles

Edited by - Merrick on August 9, 2001 8:12:02 PM

Share this post

Link to post
Share on other sites
for example, like me, not using M$ VC++ with DirectX, so D3DX utility lib may not compile correctly...

it''s sad for non-M$ VC++ users...

Share this post

Link to post
Share on other sites
Thanks for the help, guys. To double check, though, my matrix should simplify to something that looks like this (right?):

[ ar*q 0 0 0 ]

[ 0 q 0 0 ]

[ 0 0 0 0 ]

[ 0 0 1 1 ]

q = 1 / fzoom
ar = dwHeight / dwWidth

I needed it because I am working in d3dim, and didn''t want to have to deal with the overhead from d3dx if I was just taking one orthographic projection matrix.
Thanks again.


Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Umm, what overhead?

D3DX is just a static lib providing some convenience functions. It doesn''t add any overhead to your code. A good linker will only include the functions you actually use into the exe file, so if you only use D3DXOrthoMatrix (whatever it''s called), then that is the only part of D3DX that will be included in yuor exe file.

D3DX is nothing like the old D3DRM if that''s what you think.

Share this post

Link to post
Share on other sites