• Advertisement

Archived

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

Applying Camera Transform in D3D

This topic is 5122 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''ve been using OpenGL for a while now, but I''ve just started using D3D. I''m used to storing the rotation/translation for my camera in one matrix and multiplying by the inverse of it before rendering. I''ve attempted to do the same in D3D, but I have a few questions...First, does applying the camera transform need to happen between BeginScene and EndScene?...Second, should I be using the DTS_VIEW flag when calling SetTransform (I''m pretty sure I should be, but anytime I translate my camera my scene seems to dissapear -- I''m just rendering a triangle at the origin and translating along the z axis). Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by mdurfee
...First, does applying the camera transform need to happen between BeginScene and EndScene?...


No it doesn''t have to be applied between Begin/EndScene. In fact, it may not work in between them (not sure on that).


quote:
Original post by mdurfee
...Second, should I be using the DTS_VIEW flag when calling SetTransform (I''m pretty sure I should be, but anytime I translate my camera my scene seems to dissapear -- I''m just rendering a triangle at the origin and translating along the z axis). Any help is appreciated...


Yeah, DTS_VIEW is correct. Are you sure you''ve set up the matrix correctly? OpenGL uses a right-handed coordinate system (positive-z out of the screen), while Direct3D uses a left-handed system (positive-z into the screen).

Share this post


Link to post
Share on other sites
thanks for the help henrym. It turns out I wasn''t setting the Projection matrix so the triangle was being clipped out whenever I translated the camera more than one unit...I shoulda thought a that before I posted!

Share this post


Link to post
Share on other sites

  • Advertisement