0

Currently, I am using DirectX 11 to draw a primitive on my screen. Currently the Vertex is in normalized coordinates where the position ranges from -1, -1 to 1, 1.

I would like to set up my Vertex to use Cartesian coordinates 0, 800 to 0, 600. Indeed I am aware that I can convert it manually, but I would rather set it up to work automatically. Similar to glOrtho in OpenGL where you pass the screen resolution to use Cartesian coordinates instead.

What calculation can I do on my view port or what function can I use to accomplish this?

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85
John
  • 5,942
  • 3
  • 42
  • 79
  • `glOrtho` is deprecated in newer versions of OpenGL; doing it "manually" (or, more likely, getting a math library like GLM) and using shaders is the only option. I suspect it's similar in DirectX. – Colonel Thirty Two Dec 15 '15 at 21:17
  • Do you really need these values in the vertex shader? By default, the normalized coordinates are automatically converted to viewport-based coordinates (e.g. 800x600) when output from the vertex shader. Also, the Cartesian property of the coordinates is unrelated to their scale - both normalized and viewport-space coordinates are Cartesian. – MooseBoys Dec 16 '15 at 07:24

0 Answers0