On 11/14/06, Joshua Gargus schwa@fastmail.us wrote:
On Nov 14, 2006, at 1:49 PM, Mikael Kindborg wrote:
If one would use OpenGL for bitmapped 2D-sprites, what would be the best/fastest approach? Using glDrawPixels was not very fast when I tested it, because of pixel conversions I guess.
Not just because of that. You still have to upload all of the pixels to the graphics card, each frame. Also, how would you scale/resize your sprite? AFAIK, common OpenGL implementations do not support such operations (I found a Google link to an HP-extension that supports scaling/resizing), so you would need to do this on the CPU.
I see, thanks.
Are textures faster? Will have to learn more about this.
Texture-mapped quads are the way to go.
Looked at glTexImage2D and the documentation says that width and height must be powers of two, which is not very nice for sprites. However, I saw that in OpenGL 2.1 "Non-Power-Of-Two Textures" are introduced as a standard: http://www.opengl.org/documentation/current_version/
Regards, Micke