PDA

View Full Version : 2d graphics with OpenGL



mbk
05-28-2007, 01:05 AM
Hi there. I'd like to make simple 2d games, the only problem is that there don't seem to be any tutorials just focusing on 2d with opengl. nehe and various other tutorials seem to do a little intro about 2d, then immediately move on to 3d stuff. is this a correct assumption? I ask this because I haven't started anything, I was just trying to do a little research.

mainly, I guess that I'm asking how I would go about learning just 2d graphics programming, and is opengl the way to go?

(and sorry in advance if this is the wrong place to ask this.)

Overmind
05-28-2007, 02:31 AM
In OpenGL, there is not much difference between 2D graphics and 3D graphics. 2D is a special case of 3D. Just use glOrtho2D for the projection matrix and leave the z coordinate of everything at 0...

Everything else is exactly the same.

vbovio
05-28-2007, 07:37 AM
There are lot of libraries ready for writing 2D games, like Allegro, SDL, PTK, ClanLib, HAAF, etc.. most of them have the features you need, really.
But if you really want to do your own in OpenGL (Note that you will need to take care of any non-graphic tasks), then I suggest to read some of the chapters of red book (chapters 1, 2, 3, 4, 6, 8, and 9) and write examples. In fact you can just start with 2, 3, 4, and 9, which resumes to display 2D textured quads in an Ortho2D view.