Jump to content
  • Advertisement

Archived

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

tomwindcloud

a orthogonal projection problem, help!!!

This topic is 5931 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

Now i''m working with orthogonal projection, i use directx8.1 D3DXMatrixOrthoLH() to set ortho matrix(i think i set all value correctly). However i still get a perspective projection just as D3DXMatrixPerspectiveFovLH() doing. Why??? Maybe i can''t get orthogonal projection in directx??? help me!! thanks

Share this post


Link to post
Share on other sites
Advertisement

more detail, the code like this:

//d3dsdBackBuffer is the Surface desc of the backbuffer
m_fAspect = m_d3dsdBackBuffer.Width / m_d3dsdBackBuffer.Height;
D3DXMATRIX matProj;
D3DXMatrixOrthoLH(&matProj, m_fAspect * m_fBufferHeight, m_fBufferHeight, 1.0f, 2000.0f);
m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );

But it don''t work as i think. The scene is like a perspective scene. Why??????


Share this post


Link to post
Share on other sites
D3DXMatrixOrthoLH(&matProj, m_d3dsdBackBuffer.Width, m_d3dsdBackBuffer.Height, 1.0f, 2000.0f);

The second and third parameters should be the width and height of the rendering area.

Also, check the HRESULT coming back from SetTransform(...). It might be telling you something. *Always* check your HRESULTs.

Alan

Share this post


Link to post
Share on other sites
thank you, AlanKemp.
Something i must say.
First, "The second and third parameters should be the width and height of the rendering area", yes, no problem.
Second, the HRESULT coming back from SetTransform(...) is D3D_OK.
Third, in fact, all work fine but the result.
oh, my god, why??????

Share this post


Link to post
Share on other sites
Maybe i get it, but i''m more confused.
In fact i have get the *right* orthogonal projection. In my orthogonal projection, when i look a cuboid, the far edge seems a little bigger than the near edge. That''s why i don''t think it is a orthogonal projection.
But when i measure the length of the two edges, all is same.Now i think it is illusion, but the illusion is so big . Anyone has thus experience ? why????

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Now i really get it. My orthogonal projection is quite right. When we see a scene, we often use perspective projection. So we look a cuboid with orthogonal projection, the far edge is a little big than the near edge(two parallel edge), this is a illusion.
That is why perspective projection is more true.

Share this post


Link to post
Share on other sites
Now i really get it. My orthogonal projection is quite right. When we see a scene, we often use perspective projection. So we look a cuboid with orthogonal projection, the far edge is a little big than the near edge(two parallel edge), this is a illusion.
That is why perspective projection is more true.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!