Skip to main content
gamedev.net
🔒 Locked

Perspective Matrix

Started by Shyft777 1 reply 450+ views
Original Post
Shyft777
Shyft777
How can I create a perspective matrix where 1 unit is 1 pixel, and (0,0) is the upper-left corner of the screen? I''m trying to implement a GUI system in my game, and I''d like to be able to place windows (textured quads) at a particular screen position. Thanks, Shyft
c t o a n
c t o a n
Well, you can use an Orthogonal matrix (D3DXMatrixOrthoOffCenterLH()) and specify the minimum x value as 0, the minimum y value as zero, and the maximum of both dimensions to your window dimensions, like 640 x 480 or whatevever.

Chris Pergrossi
My Realm | "Good Morning, Dave"
Chris PergrossiMy Realm | "Good Morning, Dave"
Namethatnobodyelsetook
Namethatnobodyelsetook
Or you could use pretransformed (XYZRHW) coordinates. Set x and y to pixel values, and set Z and W to something valid (between 0 and 1)... some cards draw when z and/or w are 0.0... some don''t. Disable ZBuffer when rendering your gui it if helps.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.