Skip to main content
GameDev.net gamedev.net
🔒 Locked

2D Texture Alpha Transparency

Started by Erondial Mar 25, 2006 at 6:17 PM 1 replies 800+ views
Original Post
Erondial
Erondial
I'm sorry for dumping threads and problems on you guys, but I just don't know where to go from where I am... I've loaded my png into an unsigned character buffer, loaded that as a texture, clamped it to a quad, and everything's peachy, except that the area that's transparent, isn't. I've enabled bledning with glEnable(GL_BLENDING);, I've set the blending function with glBlendFunc(GL_SRC_ALPHA,GL_ONE);, and set the colour as such: glColor4f(1.0f,1.0f,1.0f,1.0f);... I loaded the texture with glTexImage2D(GL_TEXTURE_2D, 0, 4, structure->w, structure->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, structure->data);, so yes, it DOES have an alpha channel... I just don't know what to do? Why isn't it working?
Sumo
Sumo
You may have loaded the texture with an alpha channel but is the alpha channel actually encoded in the png? Also, I tend to use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). You then keep depth testing on and draw things from back of the scene to front.
Erondial
Erondial
... I brought it down from 65x65 to 64x64 in paint... and paint doesn't support alpha channels. Argh. Okay. Thanks :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.