On 11/14/06, Joshua Gargus schwa@fastmail.us wrote:
On Nov 14, 2006, at 2:40 PM, Mikael Kindborg wrote:
On 11/14/06, Joshua Gargus schwa@fastmail.us wrote:
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/
If you are willing to waste some memory, you can always set up your texture coordinates to only include the region of the power-of-two texture that has sprite data. Or, as you say, use NPOT textures. Although they're only now becoming part of the standard, they are usable via extensions of a wide range of hardware.
Josh
Thanks for this info Josh. While I feel more comfortable with SDL sprites, I should look into OpenGL. Squeak already has much of the basic functionality that SDL offers (input, etc), and OpenGL seems to be a very capable option for 2D sprite-based games. Not an easy decision however. Found this nice example of sprites in OpenGL on the gpwiki: http://gpwiki.org/index.php/OpenGL_Tutorial_Framework:Ortho_and_Alpha Will try to recreate this demo in Squeak at some point.
Best, Micke