Public Group

# 3D Coordinate Confuse

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

## Recommended Posts

Hey guys, I'm new to 3D and i'm a little bit confuse on how 3D coordinate work.
I have wrote a little test app that simply init the main window, and D3D, then created a vertexbuffer to draw a square.
Setting the square like: -1,-1,0 -1,1,0 1,-1,0 1,1,0
with no camera and world transform, this fill the entire screen or window. Am I ok to assume that the origin in 3D is the center
of the window or screen? and if so how do you position an object at a precise location?

I meen let say for exemple, that I wanted to draw my square at 100 pixel in the left top corner, that is 100 x, 100 y
since -1 if way left and 1 is way right, I could translate the square maybe like -0.700 but that would be a guest not precision.
I'm kinda confuse a bit. Another ex: would be, let say I have a texture 64x64 pixel image. I want to apply it to my square, Logicaly
if I don't want to tile the texture, the square have to be 64x64, I could scale the scare but how do I make it the perfect size?

Anyone can shade some light???
Thank's

##### Share on other sites

Hey guys, I'm new to 3D and i'm a little bit confuse on how 3D coordinate work.
I have wrote a little test app that simply init the main window, and D3D, then created a vertexbuffer to draw a square.
Setting the square like: -1,-1,0 -1,1,0 1,-1,0 1,1,0
with no camera and world transform, this fill the entire screen or window. Am I ok to assume that the origin in 3D is the center
of the window or screen? and if so how do you position an object at a precise location?

This will be easier to understand once you know more about how the graphics pipeline works, but when all transforms are identity, the origin is in the center of the screen, more or less. (More specifically, the projection is orthographic and the point (0, 0, 0) will map to the center of the screen.)

To position or orient an object or the (virtual) camera, you use an appropriate transform or series of transforms.

I meen let say for exemple, that I wanted to draw my square at 100 pixel in the left top corner, that is 100 x, 100 y
since -1 if way left and 1 is way right, I could translate the square maybe like -0.700 but that would be a guest not precision.
I'm kinda confuse a bit. Another ex: would be, let say I have a texture 64x64 pixel image. I want to apply it to my square, Logicaly
if I don't want to tile the texture, the square have to be 64x64, I could scale the scare but how do I make it the perfect size?[/quote]
By setting the projection transform (most likely orthographic in this case) appropriately, you can 'map' the viewport coordinates in different ways. For example, you could set up an orthographic projection such that the viewport coordinates mapped to the actual window coordinates. Then, for example, if the window dimensions were 800x600, a rectangle with dimensions 400x300 (and appropriately positioned) would occupy half the screen.

##### Share on other sites
Thank's Jyk. I 'l keep working on it....

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
16
5. 5

• 14
• 29
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002284
×