First test: Assume x=0 and width=800, then the window coordinates go from 0 to 799

No, the coordinates go from 0 to 800, 800 being the right-hand edge of the right-most pixel. 799 would be the left-hand edge of the right-most pixel, which is one pixel in from the right-hand edge of the window.

No, the coordinates go from 0 to 800, 800 being the right-hand edge of the right-most pixel. 799 would be the left-hand edge of the right-most pixel, which is one pixel in from the right-hand edge of the window.

Hello GClements,

thanks for your answer. As I understand you, in OpenGL the edges between the pixels are counted? Then there are 800 edges between 801 pixels. Do you know a reference for that?

In the MacOS X API the pixels themselves are counted. Because the pixel on position zero has also a count, a window with width=800 goes here from 0 to 799.

As I understand you, in OpenGL the edges between the pixels are counted? Then there are 800 edges between 801 pixels.

No; there are 801 edges "around" 800 pixels. There is an edge before the first pixel, after the last pixel, and between each pair of adjacent pixels.

Originally Posted by NanoGL

In the MacOS X API the pixels themselves are counted. Because the pixel on position zero has also a count, a window with width=800 goes here from 0 to 799.

You're conflating coordinates with row/column indices.

Consider an 800x600 window, which has 800 columns and 600 rows.

The bottom-left pixel has its bottom-left corner at (0,0) in window coordinates, while its top-right corner is at (1,1) and its centre is at (0.5,0.5). Similarly, the top-right pixel has its bottom-left corner at (799,599), its top-right corner at (800,600), and its centre at (799.5,599.5).

The bottom-left corner of the window is at (0,0) while the top-right corner is at (800,600).

Essentially, a pixel as a whole doesn't have specific coordinates; particular points within a pixel (e.g. corners, centre, edge midpoints) have specific coordinates. The pixel spans a range of coordinates.