Fixing size of shapes when window resizes


I’ve got a program where I have a triangle that takes up half the screen. When I resize the window, the triangle also changes size. Can anyone tell me how to make sure the triangle stays the same size no matter what?


I assume you setup your projection matrix with:

void gluOrtho2D(
GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top

I assume you are giving it always the same values.

You must pass your window’s size instead:

gluOrtho2D(0, widht, height, 0);