Jump to content
  • Advertisement
Sign in to follow this  
EXGE

Problem with perspective projection(solved)

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

Hi folks, I've got a problem with my projection I think. I actually started writing a plattform independent 3D engine. OpenGL and DirectX 9 and 10. I ran into a problem when trying to render objects with DirectX. For the projection matrix I am using the following code:
D3DXMatrixPerspectiveFovLH( &ProjectionMatrix, D3DX_PI/4, 1.0f, 0.2f, 100.0f );
D3DXMatrixTranspose (&m_matWorldViewProjection, &ProjectionMatrix);




This matrix is then multiplied with the positions inside the vertex shader. When I am rendering the following triangle:
CVertex4(   250.0f,  50.0f, 0.05f, 1.0f),
CVertex4(   250.0f, 250.0f, 0.05f, 1.0f),
CVertex4(    50.0f, 250.0f, 0.05f, 1.0f)



I have two problems: A) The triangle is shown in the top left corner of my window. Assuming that the origin of my coordinate system should be in the center the triangle should be displayed at the top right corner. B) As soon as I pick z-values bigger than 1.0f the triangle is no longer rendered. Please excuse my noob question but I hope someone can drag me into the right direction of what I am missing when rendering objects in DirectX. Thanks a lot in advance Jan Problem has been solved ======================= I accidentally passed XYZRHW vertices! Should've been XYZ only. [Edited by - EXGE on April 9, 2007 12:54:13 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!