Jump to content
  • Advertisement
Sign in to follow this  
Phy

D3D Matrix Problem

This topic is 4504 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 making a wrapper for Direct3D for a few weeks now, but recently I ran into a problem. I changed a few things in my code and afterwards nothing would show on the window. I've been looking for the problem but I can't find it. I've tried reverting everything and rewriting some code. I think that the problem is with the matrices. I draw a couple hundred garbage triangles to the screen and all I see is one or two taking up half of the screen at seemingly random places. I've removed all of the code that deals with the matrices and replaced it with this:
D3DXMATRIX mMat;
D3DXMatrixIdentity( &mMat );
D3DXMatrixPerspectiveFovLH( &mMat, D3DX_PI/4, 1.333333333333f, 1.0f, 256.0f );
m_pD3D8Device->SetTransform( D3DTS_PROJECTION, &mMat );
but I still have the same problem.

Share this post


Link to post
Share on other sites
Advertisement
That projection matrix is fine, what are your view and world martices? Are you running any (vertex) shaders?

Share this post


Link to post
Share on other sites
View and World both have the identity, and I haven't done anything with shaders. I even used GetTransform to test them, and they look fine.

Share this post


Link to post
Share on other sites
Try to use a real view matrix. With world and view as identity, you're unlikely to see anything meaningful, since you'll be inside your objects (assuming they're around the origin).

Share this post


Link to post
Share on other sites
That doesn't change anything either. Here's an image of me drawing 200 lines with random coordinates 8 units away from the origin.

Share this post


Link to post
Share on other sites
Sounds more like you have indexing problems in your buffers. Make sure you've set the vertex buffer sizes and vertex strides correctly, and all the paramaters to DrawIndexedPrimitive() are correct.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!