Sign in to follow this  
GKalman

World Coordinates

Recommended Posts

I'm using one of Jack Hoxley's tutorial 3D samples (but NOT with the Fullscreen display, buth rather with a Window display). When I create a, say, Cube object with local coordinates at vertices (1,1,1) ... etc, the Cube is rendered somewhere in the middle of frmMain. Question: How and where is the frmMain's scalewidth (in pixels) defined with respect to the Cube's local coordinates, say, (1,1,1)? In ther words, how and where is the "world-space" scale defined?

Share this post


Link to post
Share on other sites
Yay, someone using my tutorials [grin]


There are many coordinate systems that your data will transition through between creation and rendering. A common path would be Model -> World -> View -> Projection -> Viewport.

Only the latter two (and typically you don't work with the viewport matrix) are directly related to the 2D surface of your form. Projection space is defined in [-1,+1] ranges and is resolution independent (but it's easy enough to go from -1,+1 to 0..pix_width).

The middle of the form will usually be the camera's "look at" coordinate - whatever you've set when creating your view matrix. Although because you're dealing with 3D it's more accurately a ray from the "Look from" (aka "eye") to the "look at" position as any 3D location along that ray will be projected onto the same middle pixel on your 2D form.

hth
Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this