Jump to content
  • Advertisement
Sign in to follow this  
gabringo

problem with coordinates

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by intrest86
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.


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 this post


Link to post
Share on other sites
Quote:
Original post by Scet
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")?

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.

Anyway, like Scet asked: What are your matrices setup as?

Share this post


Link to post
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....




Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!