beginner question about origin

Started by
4 comments, last by mlakas1 22 years, 8 months ago
For the life me I can''t figure out whats going on. Seems like all the information I have been reading, says that the origin is in the lower left hand corner of the screen, this is good. Ok well, I define some vertices to create a simple triangle, but when I render it the origin turns out to be the upper left hand corner. I would really like the origin to be in the lower left and corner but for some reason its not. Anyways, I am kind of sleepy so I appologize for this poorly writen post. Mike
Advertisement
The origin in a 3d world is (0, 0, 0,) xyz. In 2d its (0, 0) xy. I don''t know what you have been reading about lower left hand corner. The orgin is the center of everything (middle) Check where your camera is pointing to. Thats provable why your getting the triangle at the top left corner. For your view matix, it should ve (0, 0, 0,) Hope this helped
Addicted Technolagy Raven Engine - Join Us :)
In Direct3D the coords (0,0,0) are at the center of the screen.
positive X goes right, Positive Y goes up, positive Z goes in.

In DirectDraw the coords (0,0) are at the top left corner of the screen.
Positive X goes right, Positive Y goes down.
If your origin is in the top-left and you want it bottom-left (or vice versa) just use this:

      pt.y = screen.height - pt.y;  


And that''ll make the origin bottom-left.

War Worlds - A 3D Real-Time Strategy game in development.

Thanks for your responses everyone. Sorry for my slow response but I just got married.....Anyways, I still can''t seem to get the origin to the middle the screen. I am pretty sure I am using direct3D actually I am positive I am. As far as where I got in idea in my head about the lower left hand origin as the directx default world view, check this URL out.

http://gamedev.net/reference/articles/article896.asp


I understand the purposes of the world, view and projection matrics. Do they always have to be implemented, even for a simple one triangle application as my own?


As usual Confused

Mike
Basically there are transformed and untransformed triangles (see the SDK for details on using both types). If you are sending D3D some transformed triangles, this means you are telling D3D you have already transformed the triangles yourself (ie processed the vertices using your matrices), and the coordinates you specify are screen x,y coordinates.

If you are sending untransformed triangles, which you will be doing 98% of the time, then the coordinates have no relation whatsoever to screen coordinates.

If you have read that the origin is the top-left corner of the screen, well, it isn''t in Direct3D (unless you are sending transformed triangles), that only applies to DirectDraw.

Transformed triangles are for drawing 2D elements with 3D triangles, stuff like a HUD, or a score or lives icon. That''s the only thing they''re useful for.

98% of the time, you will be sending untransformed triangles, and the coordinates you specifiy for each vertex are in relation to the centre of object space (the origin). There is also another origin, the centre of world space. Neither of these origins have any relation to any particular point on your screen.

You position objects with the world, view and projection matrices. The individual vertices are in relation to the object space origin only.

This topic is closed to new replies.

Advertisement