Ortho Projection Without D3DX??
Does anyone know how to set up an orthogonal projection matrix without using the D3DX files? Is there a way to do without the D3DX files?
ozone_blue
Try this :
"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
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;
IdentityMatrix(&d3dMatrix);
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
Just curious - why?
For basic math stuff, the D3DX functions are highly recommended. I''m not sure why one would avoid them...
For basic math stuff, the D3DX functions are highly recommended. I''m not sure why one would avoid them...
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...
it''s sad for non-M$ VC++ users...
I changed d3dutil.cpp to do what Merrick posted.
D3DX justs adds unncessary overhead to your project.
The tutorial is at The Rabbit Hole.
Ben
[Icarus Independent | Jump Down The Rabbithole | Tombstone: Vendetta ]
D3DX justs adds unncessary overhead to your project.
The tutorial is at The Rabbit Hole.
Ben
[Icarus Independent | Jump Down The Rabbithole | Tombstone: Vendetta ]
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 ]
Where:
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.
ozone_blue
[ ar*q 0 0 0 ]
[ 0 q 0 0 ]
[ 0 0 0 0 ]
[ 0 0 1 1 ]
Where:
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.
ozone_blue
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.
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.
Agreed. Supposedly, the D3DX functions have optimizations for MMX, 3DNow, etc. So even if there is overhead, it''s probably worth it...
Maybe he just wants matrix routines that are portable in case someday he wants to use a differant API.
ECKILLER
ECKILLER
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement