Jump to content
  • Advertisement


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


Matrices and positions..

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

Gah! My mesh will not show up the way I want it to. The whole viewport seems tilted; this is clearly the case when rotating the mesh around any axis. It''s not straight Where could I have done wrong? /Sandman

Share this post

Link to post
Share on other sites
more info + code would be nice.

also, check your view matrix. be sure it isnt bent out of shape.

and your projection matrix. if you have it set wrong it can cause some... strange... effects.

Brett Lynnes

Share this post

Link to post
Share on other sites
The strange thing is, if I render a quadrilateral using vertex buffers etc with _the same_ view- and projection matrix setup, it''s all fine!

// projection matrix
D3DXMatrixPerspectiveFovLH(&ProjMatrix, D3D_PI / 4.0f, (float)wndWidth / (float) wndHeight, 1.0f, 1000.0f);

// view matrix
D3DXMatrixLookAtLH(&ViewMatrix, &D3DXVECTOR3(100.0f, 50.0f, -150.0f), &D3DXVECTOR3(0.0f, 50.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f));

I rotate the mesh around the x-axis. (World space). What about the view space transformations? Or the correct name for it..


Share this post

Link to post
Share on other sites
Assuming the matrices below get sent straight to SetTransform() with D3DTS_PROJECTION and D3DTS_VIEW respectively and no extra manipulation happens, then what you''ve posted looks fine.

Since a single quad works ok, some other things to check would be:

- that the cause isn''t really what you''re setting for the D3DTS_WORLD matrix. Maybe there''s a bug in all of the world matrices. Try forcing them to identity before rendering to test.

- if you''re using vertex shaders, check that what you''re transforming by the correct matrices (i.e. NOT by transposed matrices - you only need a single transpose to get the data in the right format).

- how are you rotating around the axes?

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
Hi thanks for the response,

I'm in the middle of writing a DX8 wrapper so I used some home-cooked matrix functions BUT! they work as they shall and even though I rewrote a large portion of the code with pure DX function calls, testing and logging; it still screws.

Hmm the Y axis is the only one functioning correctly when rotating..

How I'm rotating? Well in my render func, I simply:

// simply put
// i.e:
D3DXMatrixRotationZ(&matRotZ, timeGetTime() / 1000.0f);
D3DXMatrixMultiply(&matWorld, &matWorld, &matRotZ);
g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);

Does this seem correct?

[EDIT] What about rotating using the view matrix?? [/EDIT]


[edited by - Saandman on October 19, 2002 5:09:06 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!