Jump to content
  • Advertisement


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


Clipping and Setting Up Viewport

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

Can somebody tell me a goodway to set up my viewing fulstrum ?? Especially about how to make a camera object in D3D application and what does it take to make a camera object ?? I want to make a view based on where my camera object is placed, I''ve tried to render my scene, but it seems that anything under 0 on z axis wasn''t rendered. HELPPPP !!!

Share this post

Link to post
Share on other sites
Set up a perspective projection matrix (what is defined in this matrix is the parameters for the frustum - the near and far planes, the viewing angle [think of it as the angle of a cone] and the aspect ratio):

D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f );
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );

Set up a "look at" view matrix (you tell it where the camera is in the world, and what it''s looking at, the "up" vector is to make the maths work, point it roughly in the direction which is "up" in the world):

D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0.0f, 3.0f,-5.0f ),
&D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),
&D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

Now here''s an interesting fact - the code above is copied directly from one of the D3D SDK tutorials. (The tutorials don''t use the D3D framework if that''s what was putting you off). I suggest you work your way through those official tutorials to the point where you totally understand all that''s going on in them.

Simon O''''Connor
Creative Asylum Ltd

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.

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

Sign me up!