Direct3D Rendering Matrices

Started by
4 comments, last by drstrangeluv 24 years, 2 months ago
I have the following problem. Despite the fact that it seems I''m setting up the world, view, and projection matrices properly, when I go to render a simple triangle centered around the origin, the triangle always appears in the upper left hand corner of the screen. If I try moving the camera (the view matrix) only, the triangle continues to stay in the upper left hand corner. Anyone have any thoughts on this? Thanks
Advertisement
Two questions that might help:

Have you set up your viewport correctly?

Are you sending D3DTLVERTEX to D3D? If you are you bypass Direct3D''s transformations and the matrices wont affect your coordinates.
please tell me that you remembered to send the matrix to the device!
I''m definitely setting the matrices. Here is the code I''m using to draw the primitive:

IDirect3DDevice3_DrawPrimitive(lpDevice,D3DPT_TRIANGLELIST, D3DFVF_VERTEX,pvTriangleVertices, 6, NULL );

How could the setting of the viewport cause the kind of anomally I''m witnessing? I''m currently relying on someone else''s code to initialize the device and set the port, I''m just accessing the device.
I think SpellBound is right, if your viewport size is smaller than the screen (and the viewport is rendering to the default position of 0,0) then the scene will just be smaller and in the upper left corner of the screen.

Good Luck!
Hello Again

I also ran into a problem with matrixes, but slightly different. The program displays the 3d object just fine, but when I try to apply a matrix, Nothing apears at all. I apply it like so...

m_pD3DDev->SetTransform(D3DTRANSFORMSTATE_WORLD, &gameship.matLocal );

and then render using...

m_pD3DDev->DrawPrimitive( D3DPT_TRIANGLELIST, D3DFVF_VERTEX, vTriangle, NUM_SHIPFACES, 0 );

but it doesn't display anything. If I comment the SetTransform line out, it works good.

If anyone can help me with this, I would be very thankful.

Thank you for your time...
-Doddler

Edited by - Doddler on 2/17/00 2:00:08 PM

This topic is closed to new replies.

Advertisement