Lesson30 Texturing question

Started by
3 comments, last by canond 18 years ago
I have a real quick question. I noticed that all the textures in Lesson 30 which deals w/ collision detection are bitmaps and are loaded in RGB format but the spark in the example has transparency. The black background of it doesn't show up in the demo. Can anyone tell me why this is?
Advertisement
32-bit bitmaps contain 8bits of transparency.

ARGB = (alpha)(red)(green)(blue)

8 bits each.
-------Harmotion - Free 1v1 top-down shooter!Double Jump StudiosBlog
How does opengl know which is the transparency color?

And why does he use this code

glTexImage2D(GL_TEXTURE_2D, 0, 3, image2->sizeX, image2->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, image2->data);

for loading the bmp? Shouldn't it be 4 or GL_RGBA for the 3rd and 7th parameter?
because it uses glBlendFunc(GL_SRC_ALPHA, GL_ONE); blending and it blends everything tohether aditivly wich means that the darker it is the more transparent it gets, alpha in this case is used to decide the strength of this blending type and is set with glColor4f.
so the textures are still 24 bit bitmaps.
Nehes code can't load 32bit bitmaps, infact i have rearly seen 32bit bitmaps being used anywhere.
If you want 32 bit then tga is the way to go.
Thanks I needed that!

This topic is closed to new replies.

Advertisement