
Change scale/perspective to 1:1
Posted Tuesday, 8 February, 2011 - 13:20 by patricker inI'm just just getting started with OpenTK and I'm working in 2D. I'm drawing rectangles and I want to view them at 1:1 scale where 1 unit in my code == 1px on screen.
I'm working from the base example code that shows a triangle with three colors. console app, inherits from GameWindow.
I got this working so that it showed a rectangle but when I tell it to draw a rectangle that is a 5x5 cube with it's origin at 0,0 I get a HUGE cube that goes off the edge of the screen. If I'm doing anything obviously wrong please let me know, otherwise how can I adjust the scale/perspective so that I see things in the desired scale?
Thanks,
Pat


Comments
Re: Change scale/perspective to 1:1
You need to setup a correct orthographic projection. Use Matrix4.CreateOrthographicOffCenter:
and set this as your projection matrix.