OpenGL sprites - please help this n00b
Gillissie Wrote:The trick is to multiply each of the color values by the alpha value too, otherwise you'll still see the sprite even at 0 alpha, which seems weird to me.
It's because you're using images with a pre-multiplied alpha channel. There's nothing wrong with it. It's pretty common on iPhone because CoreGraphics pre-multipies alpha on load, and Texture2D uses CoreGraphics for loading images. Plus, as I've been recently reminded, Apple has a "PNG optimization" script that runs during build, which pre-multiplies the alpha among other things (which can be disabled BTW, but still...). If you study up on pre-multiplied alpha and glBlendFunc, you'll see why the math works out that way, and it won't seem quite so weird.
Possibly Related Threads...
|openGL n00b looking for FBO drawing examples or direction||auptown||5||8,123||
Nov 4, 2009 02:16 AM
Last Post: Eskema
|iPhone opengl 2d sprites landscape mode||mnorton||6||6,197||
Sep 9, 2009 08:27 PM
Last Post: mnorton