I am writing some 2D commands, and need to draw pixelperfect lines, points, and rectangles.
Let’s say the client area is 400x300, and I want to draw a line (0,0,400,0), across the very top of the viewport.

I set glViewport to 0,0,400,300.

I set glOrtho to 200,200,150,150.

I draw a line ((Ax200),(300Ay150),(Bx200),(300By150)) or ((0200),(3000150),(400200),(3000150)).
The line is one pixel too high, and lies offscreen. If I make a line across the very bottom, it lies right on the bottom edge. What is the correct mathematical change I need to make so that I can draw an arbitrary size window and get pixelperfect results?
Thanks.