Textures: transparent PNG problem

BlitzMax Forums/OpenGL Module/Textures: transparent PNG problem

eindbaas(Posted 2007) [#1]
I want to use images with transparent parts as textures, but i'm getting strange results with just some testing. Loading a png goes fine, but whenever i change the png into one with some transparent parts in it, the texture is completely wrong.



I didn't expect the transparency to work immediately, but this result is bugging me. What is happening here?

I'm using Odins simple textureclass for loading
http://www.blitzbasic.com/Community/posts.php?topic=47259


eindbaas(Posted 2007) [#2]
sorry, reading is your best friend...the GL_RGB in

glTexImage2D GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage.Pixels

should ofcourse be GL_RGBA


ImaginaryHuman(Posted 2007) [#3]
Yeah, the effect you're seeing there is what it looks like when you are supplying RGBA data but reading it in groups of 3 components instead of 4. It starts to read like:

RGB ARG BAR GBA etc which obviously will look all weird.

Make sure you also switch on alpha blending bend mode.