# problem with coordinates

This topic is 4925 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello everyone, I am learning directX and i encountered a small problem, whenever i render something to the screen the coordinates start fromthe topleft corner of the screen. I have tried source code from other sources and everything is ok. the origin is in the middle of the screen. Does anybody know solve this? I will keep looking into this Cheers,

##### Share on other sites
Are you using transformed vertices? If so, then it is doing exactly the right thing. On a computer, the top left of the screen is always (0,0), the origin. You sould simply write a function though to take a point and switch it from "Centered on the screen" coordinate system to "top-left screen" coordinate system.

##### Share on other sites

i do not know what transformed vertices are(maybe that is the problem), my vertex struct looks exactly like this

struct Vertex
{
FLOAT x, y, z; // x, y, and z coordinates.
DWORD color; // Color of this vertex.
};

I have source code from other sources and there is no such function on the code, i mean i can write that function, i just thought there would be a more straightforward way of doing this.

but thank you for your suggestion. If nobody else answers i will certainly write that function so that i cna continue my learning.

thank you

gabringo

##### Share on other sites
Quote:
 Original post by intrest86On a computer, the top left of the screen is always (0,0), the origin. You sould simply write a function though to take a point and switch it from "Centered on the screen" coordinate system to "top-left screen" coordinate system.

In 2D the origin is (0,0). However in 3D (0,0) should be the center. What function are you using to create you perspective projection matrix(look for "D3DXMatrixPerspective")?

You are using 3D right?

##### Share on other sites
Quote:
 Original post by ScetIn 2D the origin is (0,0). However in 3D (0,0) should be the center. What function are you using to create you perspective projection matrix(look for "D3DXMatrixPerspective")?

Sorry, should have been more specific. I was talking about transformed vertices, and I'm ... pretty sure that transformed vertices use the "Top left = (0,0)" policy. Anyway, his format is obviously not transformed.

##### Share on other sites
oops,

i am not using any function to create perspective or any projection matrices(look for "D3DXMatrixPerspective")? in the book that i am using she didn't mention any of that and in the sample code that i found they do not use that.
I have the book beginning directx 9 by wendy jones, i have found mistakes in this book and her sample code does not match the code in the book... it takes ours just to do a simple chapter....

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634090
• Total Posts
3015432
×