# OpenGL DirectX 11 coordinate system question

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

## Recommended Posts

How do I make the coordinate system in DirectX 11 relative to the top left of the screen? I've setup an orthographic projection matrix, so that I can use screen coordinates but it makes more sense to me to have a top left origin, since I come from working with OpenGl.

I setup my projection matrix like this:
ww = the width of the window
and wh = the height of the window

 projection = XMMatrixIdentity (); projection = XMMatrixOrthographicLH (ww, wh, -1, 1);  Edited by Lyev

##### Share on other sites
The Direct3D post-projective normalized viewport coordinate space spans from [-1, 1] in X direction, +X being towards right, and [-1, 1] in Y direction, +Y being towards the top of the screen. See http://msdn.microsoft.com/en-us/library/windows/desktop/cc308049(v=vs.85).aspx
Assuming vector*matrix transformation order, to make an orthographic space that has (0,0) as top-left and (1,1) as bottom-right, (and depth range of [0,1]) you can use the matrix:
 2 0 0 0 0 -2 0 0 0 0 1 0 -1 1 0 1 
If you use matrix*vector, transpose the above matrix.

##### Share on other sites
Thanks for your help. XMMatrixOrthographicOffCenterLH worked great.

1. 1
2. 2
JoeJ
20
3. 3
frob
19
4. 4
5. 5

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

• Total Topics
632206
• Total Posts
3004772

×