
New to OpenTK - change 2D coordinates to more common system?
Posted Sunday, 4 December, 2011 - 12:36 by anewguy inHere's how 2D coordinates usually are for other programs/languages/whatever
^<-- top left over there is (0,0)
Bottom right over there -->v is something around (640,480), depending on window size
This is a good system and easy to work with
But OpenTK..
^<-- top left is (-1, -1)
Middle is (0,0)
Bottom right -->v is (1, 1)
..This is annoying.
How do I change it to the first system?


Comments
Re: New to OpenTK - change 2D coordinates to more common ...
That is native OpenGL coordinates system. To change it to what you want just change the projection matrix.
If you're new to OpenGL you can do it "legacy mode" by calling :
If you are already know your way in OpenGL and want to do it the "recommended way":
Send matrix in "shader mode" by creating an ortho matrix :
and sending it to your shader by calling
Judging by the nature of your question i recommend going with first option first. The second method involves many more steps than what is shown. I only put it here so that you know what can be done. If you want a book or two i recommend: The OpenGL Programming Guide 7th edition. And OpenGL Superbible 5th edition.