2D in OpenGL

Okay, I’m sort of interested in writing a 2d application (game) in OpenGL. It no doubt would require scrolling of some sort.

In general, I get the idea that drawing a polygon in the front of the screen with a texture map on it is the fastest way to do this. This seems counter-intuitive, but I might give it a try.

My question is, has anyone followed all the pixel drawing speed tips in the Red Book for using glDrawPixels? Apparently if you disable a lot of OpenGL’s features, your pixel drawing will be a lot faster. Anyone tested this before?


If you want to do a realtime game U definetly need to use a textured polygon (or, better to manage, a grid or multiple grid objects) on the background.
Surely that is faster than drawing pixels…


I guess I don’t understand… Isn’t drawing a texture map actually the same as drawing pixels, but with more operations involved? It seems like drawing pixels would actually be a simpler operation. Does it not fit into a pipeline somehow?


no, because 99percent of applications use textured polygons the driver writers optimize this. at least thats my take on the issue

A texture is cached in the graphics card texture memory. It is in exactly the right format and there is a huge amount of bandwidth to move data around on the graphics chip. glDrawPixels on the other hand has to send data from system memory over the AGP graphics bus, and often has to twiddle the bits to match the framebuffer. On top of this there is setup overhead talking to the graphics card like this. These problems are compounded by the fact that most PC games & applications don’t much care about glDrawPixels performance.

The performance difference would be a couple of orders of magnitude between drawing pixels and using texture.