PDA

View Full Version : OpenGL for 2D



flaXen
10-31-2001, 01:05 PM
I wish to use the capabilities of 3D hardware for a 2D sprite-based game engine. This would be far easier for me to do in DirectX except that I can't get it to initialize from within a DLL.

I've got OpenGL initializing and drawing, but what I need is to know how to setup a camera to have absolutely no perspective and for the screen coordinates to represent pixels. It would be nice if the view could be offset so that the coordinate 0,0 is the top-left corner of the screen.

Any info or links to 2D OpenGL source would be very helpful.

Thanks!
-- Dan (flaXen)

Spiral Man
10-31-2001, 02:53 PM
gluOrtho2d(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)

top bottom left and set where the top bottom left and right cliping planes are. so you can make 0,0 wherever you want. ie:

gluOrtho2d(0,xres,0,yres)

that puts the origin at the bottom left. if its at the top left, you would have to use negative y values...