D3D Matrix Problem

Started by
4 comments, last by RenderTarget 18 years ago
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.
Advertisement
That projection matrix is fine, what are your view and world martices? Are you running any (vertex) shaders?
Ollie"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]
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.
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).
That doesn't change anything either. Here's an image of me drawing 200 lines with random coordinates 8 units away from the origin.

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.
[sub]My spoon is too big.[/sub]

This topic is closed to new replies.

Advertisement