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


Question about device coordinate system

Recommended Posts

Flack    130
Hello, I was following a simple tut on directx and I have a simple question. In the app, the origin of the device is located at the center of the device. Is it possible for me to have the origin be at the top-left corner of the screen so that if the vertex value is (0,0,0) it is mapped to the top-left corner instead of the center of the screen? Im new to this stuff so if im not clear plz let me know. -Flack

Share this post

Link to post
Share on other sites
Use a translation matrix and move from point a to point b then restore the Identity matrix to reloate back to the original point. eg.

D3DXMATRIX identMat;
D3DXMATRIX translation;

float x=1.0f;
float y=0.0f;
float z=0.0f;

// translate matrix, to new origin

D3DXMatrixTranslation( &translation, x, y, z);
device->SetTransform( D3DTS_WORLD, &translation);

// draw your object..

// restore location using the identity matrix.

D3DXMatrixIdentity( &identMat);
device->SetTransform( D3DTS_WORLD, &identMat );

[edited by - DevLiquidKnight on January 24, 2004 2:07:05 AM]

Share this post

Link to post
Share on other sites