defined Pixelsizes for Polygones

Perhaps this is a stupid question, but I haven’t found a good answer in the tutorials I looked in yet.

At the moment I just want to use openGL Routines to draw 2D Elements on the Screen. On most Tutorials it is simply solved by defining a Polygon wich Elements all have the same Value (normaly 0.0) in the Z Axis.
But my Problem here is, that theese Polygons sizes are all kind of relative to the size of the window, where they are painted on.
What I instead of that want, is for example a rectangle which is 40 Pixels wide and 40 Pixels high, without any influence from the size of the window on which it is being painted on.

Can somebody tell me, whre I can read something about doing this ?

The easiest way would be to set your viewport to a fixed size instead of the size of the window. Normally the glViewport is adjusted as the window changes, this determines the projected coordinate window mapping.

The other thing you could do is adjust the projection, matrix (probably a simple glOrtho in your case) to maintain a fixed size as the viewport changes with window dimensions.