Opengl Fundamental alignment problem

Hi people
I tried to draw a simple quad from (-3,-4) to (0,0) using the commands below:

glVertex2i(-3,-4);//Top left
glVertex2i(0,-4);//Top right
glVertex2i(0,0);//Bottom right
glVertex2i(-3,0);//Bottom left

and i got the output in the left picture.The blue pixel is the origin.The yellow pixels are the pixels where i expected the quad boundary to be.And the red pixels are the actual output.What i cant get is if i want the upper left corner of the quad at(-3,-4) why is it ending up at (-3,-3)?
Also the bottom is not at the origin.there is a problem with the y-direction here

Then i tried positive numbers as:

glVertex2i(0,0);//Top left
glVertex2i(0,3);//Top right
glVertex2i(3,4);//Bottom right
glVertex2i(0,4);//Bottom left

Now i get the output at the right.Now there is a problem with the x-direction !!
Is there some convention regarding the drawing of quads in opengl ? That the boundary pixels will not be drawn?


Google rasterization fill convention.

Don’t confuse pixels with points. A pixel is a little rectangle, so claiming that the blue rectangle is the origin is meaningless (the origin is the bottom-left corner of the blue rectangle).

In OpenGL, integer window coordinates correspond to the corners of pixels; (0, 0) is the bottom-left corner of your screen (DirectX is weird and so (-0.5, -0.5) is the bottom-left corner).

As other mentioned, you need to get familliar with OpenGL’s rasterization rules.

The result looks correct to me though. Assuming those grid white lines are on integer coordinates (that is, spacing is 1 unit), it looks like it should.

The quad is 3x4 units large (from (0,0) to (3,4)) and it covers 3x4 pixels. Just as it should, since each pixel corresponds to 1 unit. It also connects the yellow pixels correct and in a consistent way. The quad is rasterized such that is touches the lower left corner of each desired yellow pixel.