Archived

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

Dealerz

Direct3D 8 Coordinate problem

Recommended Posts

How are the coordinate system done in d8... in 2d if I want to place a square at the corner of (20,20) I would just place that as x y... but in d3d8 they want you to use floating number as x,y,z.... How are they used in conjuction with the coordinate systems on the monitor.... I setup 2 type of vertex structures... The first on is just a x,y,z, and color structure and then the second one is a texture vertex which has x,y,z and tu, tv stuff..... But I''m having problems trying to figure out how to place a squre in the (20,20,0) area and then the problem of placing a texture in the correct placement. need help...

Share this post


Link to post
Share on other sites
Try something like (20.0f, 20.0f). The .0f means its a floating point number and that all decimal places after the f are 0 (I think).

Share this post


Link to post
Share on other sites
Make sure you''re using the correct Flexible Vertex Format and Vertex Shader for screen coordinates:

typedef struct sVertex
{
FLOAT x, y, z, rhw;
} sVertex;
#define VERTEXFVF (D3DFVF_XYZRHW)

sVertex Vert = { 20.0f, 20.0f, 0.5f, 1.0f };



Jim Adams
home.att.net/~rpgbook
Programming Role-Playing Games with DirectX 8

Share this post


Link to post
Share on other sites
Thanks I got it to work now by the way what does rhw stand for... I only have the sdk help files and its hard to find stuff on direct3d... There needs to be a book on this topic to help out... Because this is much different then D73D.

Share this post


Link to post
Share on other sites
Thanks I got it to work now by the way what does rhw stand for... I only have the sdk help files and its hard to find stuff on direct3d... There needs to be a book on this topic to help out... Because this is much different then D73D.

Share this post


Link to post
Share on other sites
quote:
Original post by Dealerz

Thanks I got it to work now by the way what does rhw stand for... I only have the sdk help files and its hard to find stuff on direct3d... There needs to be a book on this topic to help out... Because this is much different then D73D.


RHW is the homogeneous W for the transformed vertex.
RHW is actually the reciprocal (SDK Lingo ) of the W coordinate from the homogeneous point (x,y,z,w). Pretty much the distance between the eyepoint and the vertex (Just read it up in the SDK).


- Goblineye Entertainment
The road to success is always under construction

Edited by - Tornado on April 24, 2001 7:34:47 AM

Share this post


Link to post
Share on other sites