Centering an image in the window

I’m trying to center an image in my window, but I’m not able to do that.

I have the xmin, xmax, y min, y max, zmin, zmax of the image, and I’ve got window’s vertex, using rect->bottom, etc.

Then, I’ve tried to use glOrtho, but not in the correct way, I’m afraid.

Any sugestion?

Thank you,


Hi !

If you look in the FAQ on this website you will find information about how to setup glOrtho views. when that is done all you need is the width and height of the viewport and the width and height of the image.



has a tutorial on masking & ortho mode if you want to check it out. They also center something somewhere, have no idea in what tut .