Jump to content
  • Advertisement


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


Creating a projection matrix without d3dx

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

yep, i''m the one who''d like to learn it "the hard" way before using d3dx. so far i''ve implemented my rotation and translations matrix operations, but got stuck on the viewport matrix.
memset(&m_Data, 0, sizeof(float) * 16);

float n_p = 1.0f;
float f_p = 10.0f;

float aspect = 768.0f / 1024.0f;

float w = aspect * (cosf(90.0f / 2.0f) / sin(90.0f /2.0f));
float h = 1.0f * (cosf(90.0f / 2.0f) / sin(90.0f /2.0f));
float q = f_p / (f_p - n_p);

m_Data[0]  = w; // this is the matrix._11
m_Data[5]  = h; // the matrix._22
m_Data[10] = q; // the matrix._33
m_Data[11] = 1.0f; // the matrix._34
m_Data[14] = -q * n_p; // the matrix._43

later on, i''ll convert my own matrix into a d3dmatrix and set the D3DTS_PROJECTION but something seems wrong

Share this post

Link to post
Share on other sites
Forgive me if I''m wrong, but I think there is a section in the sdk where it goes over all the maths it uses for the projection matrices, and lighting and stuff like that.

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!