Algorithms for 2D sprites in OpenGL

Started by
15 comments, last by MARS_999 17 years ago
*tags topic for later*

This'll prove useful when I rewrite my engine.

Also a question: are display lists a good or a bad thing when doing 2D?

Learn to make games with my SDL 2 Tutorials

Advertisement
Quote:Original post by Lazy Foo
*tags topic for later*

This'll prove useful when I rewrite my engine.

Also a question: are display lists a good or a bad thing when doing 2D?


DL are fine, but with the newer OpenGL models coming down the road I would stay away from DL if possible and use VBOs.
Quote:Original post by MARS_999

DL are fine, but with the newer OpenGL models coming down the road I would stay away from DL if possible and use VBOs.


Are there any good articles about the changes coming to OpenGL?

Learn to make games with my SDL 2 Tutorials

Here is a link on what's coming

http://www.khronos.org/library/detail/gdc_2007_opengl_21_and_beyond/
Vertex buffer objects look pretty intriguing; I'm not very knowledgable about OpenGL yet so I don't know much about them. I am planning to go with indexed vertex arrays for my sprite engine but I don't know enough about VBOs to know if they're a viable alternative.

A possibly newbie question: Are VBOs standard in most OpenGL driver implementations, and thus safe to use for a system wanting to target 2D games? If they're a new feature I might be best off sticking with something that's more likely to be compatible with older drivers.
I did some quick experiments with VBO a while back, the interface is quite nice, so it's pretty easy to have a class/wrapper which uses VBO if available or regular vertex arrays otherwise.

My test was filling up a VBO with sprite data each frame and drawing that, as you'd expect for sprites. I didn't find any speed difference between using VBOs and using vertex arrays. VBOs started being faster when the same sprite data was re-rendered (maybe as some kind of multi-pass stuff?) but I havn't found a good use for this yet. So VBOs don't seem to be as useful as you'd expect for 2d stuff. [sad]
Thing is VBO's aren't any hardered to setup than vertex arrays... So you might as well learn them instead... Plus they will be as fast and might be faster in certain situations.

This topic is closed to new replies.

Advertisement