• Advertisement

Archived

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

Ortho again...

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

I know orthogonal projection has had many posts but I haven''t really got a good answer.. how do I set up my projection right with D3DXMatrixOrthoLH for a 800x600 resolution. Does the z values near and far matter? how do I draw using the new matrix then? my renderfunction looks like this now: pd3ddevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(20, 0, 255), 0.0f, 0); pd3ddevice->BeginScene(); // Setup Perspective Projection D3DXMATRIX mProj; D3DXMatrixPerspectiveFovLH(&mProj, D3DX_PI/4, ((float)SCREENWIDTH / (float)SCREENHEIGHT), 1.0f, //Near view plane 100.0f ); // Far view plane pd3ddevice->SetTransform(D3DTS_PROJECTION, &mProj); // x, y, z, rotation, blend Sprite0.Draw(x, y, 0.0f, 0, false); // Setup Ortho Projection D3DXMATRIX mOrtho; D3DXMatrixOrthoLH(&mOrtho,(float)SCREENWIDTH, (float) SCREENHEIGHT, 0.0f, 100.0f ); pd3ddevice->SetTransform(D3DTS_PROJECTION, &mOrtho); Sprite1.Draw(2.0f, 2.0f, 0.0f, 0, true); pd3ddevice->EndScene(); pd3ddevice->Present(NULL, NULL, NULL, NULL);

Share this post


Link to post
Share on other sites
Advertisement
hiya, sorry this is not the answer on your question but an additional to your question, hope ya don''t mind,

actually, is it common to put two projection trans in the gameloop? also with the camera, is it common too, to put more than 1 camera trans in the gameloop? if so, how does these things help?

thanks,

Share this post


Link to post
Share on other sites
If you are going to use sprites to draw fake 2D stuff on the screen, then I suggest you use the ID3DXSprite interface. Look it up in the DX documentation.It''s pretty well covered.And it''s really easy to use.The interface will take care of setting up orthogonal projection and the likes.

I was in your shoes once and I did get orthographic projection working.But then I descovered the DX sprites and my life was alot more simpler

Share this post


Link to post
Share on other sites
Yeah I used it too at first but now I''ve made my own sprite class... and can you use lighting and alpha blending using the d3dxclass? I don''t want to use screenspace and rhw vertices at this point.

I would appreciate more if you help me set up the ortho projection.

But thanx anyway.

Share this post


Link to post
Share on other sites

  • Advertisement