Archived

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

IceFire

D3DLVERTEX vs D3DTLVERTEX

Recommended Posts

Ok, I''m new (two months into this tutoring myself) so please speak in layman''s terms My question: The description of the D3DLVERTEX structure says it''s pre-lit and DirectX is to perform the tranformation. The description of the D3DTLVERTEX structure says it''s pre-lit and pre-transformed. I''ve an app that D3DTLVERTEX works fine, but no output when using D3DLVERTEX. I''m assuming that the world transform is missing before I fill in the structure with data. I''ve the view and projection matrix setup. What do I need to do to transform my model/screen coordinates to world coordinates so that D3DLVERTEX behaves like D3DTLVERTEX? Also an explanation of screen, model, and world transform would clear up some confusion on my part and be deeply appreciated. IceFire

Share this post


Link to post
Share on other sites
I already know you read my tutorial on the view and world matrices, but I''ll try to give a brief explanation of all matrices in the geometry pipeline:

WORLD

This matrix is used to transform matrices within the world, usually to move geometry from their local system centered around the origo to their place in the world before rendering.

VIEW

This matrix is used to transform the world coordinates into view coordinates so that they are as if the camera position where the origo and the camera''s forward direction where the z axis, and so on.

PROJECTION

This matrix is what describes how the vertices are projected onto the screen. Here you can set the field of view of the camera or orthogonal projection.

VIEWPORT

Finally the vertices are also transformed with another matrix called the VIEWPORT matrix, this matrix isn''t set directly by you but instead with the function SetViewport(). It is this viewport that describes where the final image will end up on the screen.

So you need to set up the WORLD and VIEW matrices so that the camera is facing the object you are interested in viewing. Usually this only requires a simple translation matrix in the WORLD matrix to move the object away from the camera a bit along the positive z-axis.

I hope you get it working.

- WitchLord

Share this post


Link to post
Share on other sites
So other newbie''s don''t fight this thing for a week like I did.....

I forgot when using D3DLVERTEX that I have to disable lighting, lol.

// Disable Direct3D lighting
lpD3device->SetRenderState(D3DRENDERSTATE_LIGHTING,FALSE);

Thanks from much help by WitchLord. I was starting to think I''d be using D3DTLVERTEX and not have the ability to use DirectX''s lighting for my objects.

Frustrating learning this thing, but still satisfying

IceFire

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I dont want to offend you, but why do waste you time like this and dont read the most basic information, like FAQs or troubleshooting? I still fail to understand why people think its unhip to RTFM.

http://msdn.microsoft.com/library/psdk/directx/imover_7cmc.htm

Please dont take it as personal insult even if it sounds so (im not native english-speaker), im just curious about this phenomenon. like 50% of questions asked on boards here are always answered in some most basic FAQs, gamedev''s for instance.

Share this post


Link to post
Share on other sites
No offense taken at all. Part of my learning curve is knowing where to look to find answers. A large part of my learning curve is how to not repeat previous mistakes.

I reviewed many of the FAQ''s at gamedev before my original posting. Since my post I''ve found other related answers to my question. For the experienced programmer''s the answers I search for may be obvious, but for me It''s a struggle. I''m a newbie at 47 years old

We had stone tablets instead of computers when I was growing up, lol. Just kidding

IceFire
(the old fart)

Share this post


Link to post
Share on other sites
Anon, I know it wasn''t your intention, but that post was pretty harsh. I mean, the fact that D3D tries to light an already "lit" vertex is definitely confusing, and I think the SDK only mentions this as a little sidenote (I made the same oversight once).

Regarding FAQ''s, I''ve a D3D question which I''m just now going to research in FAQs around here, but I''m also going to post the question in this forum. The forum is another resource, like a FAQ or a tutorial -- it''s not just a "last resort" as far as I''m concerned.

Share this post


Link to post
Share on other sites