View Full Version : OpenGL for 2D

07-13-2006, 01:08 PM
I'm doing a 2D graphics project for a class. Is
it reasonable to use OpenGL? I've got it working
OK for drawing, but I need an inverse transform
(viewport to worldspace). This is indeterminate
in a 3D-2D projection, is there some way around


07-13-2006, 01:17 PM
Yes there is, use glOrtho projection, with it you can set the projection to match the window coordinates, or use some custom coordinate grid.

07-13-2006, 01:45 PM
Exactly, you have complete control over the projection matrix and the viewport.

If you draw primitives on an x y plane where z is constant this can work even with a glFrustum call made to set up the projection.

If you go drawing 3D stuff and expect to infer the position from a 2D screen then the solution is not actually indeterminate, is a 3D solution i.e. a point in teh screen defines a world space vector from the eye and a rectangle on the screen is a frustum.

Doing basic 2D is very straightforward, you have all the tools for this in OpenGL.

07-13-2006, 11:33 PM
OpenGL is really good for 2D vector graphic. You can see the results that i have achieved with my engine here: http://www.youtube.com/watch?v=7fdSlw3F92U .
Then, if you are interested, you can learn more here: http://www.amanithvg.com