Advertisement

tga loading and transparency

Started by April 22, 2003 03:28 PM
1 comment, last by Develin 21 years, 10 months ago
Hi I''ve got a problem with tga files. My code is heavyly based on the tutorial concerning loading of compressed and uncompressed tga files. That works perfectly but I want them to be transparent for sprites. So i enabled the Alphatest - I thought than the transparency from the file is used but that didn''t work. I use the following code and it seems to work flawlessly (type is GL_RGBA) but without transparency. Are there other things to change/include? glGenTextures(1, &_mytextures[filename].texID); glBindTexture(GL_TEXTURE_2D, _mytextures[filename].texID); gluBuild2DMipmaps(GL_TEXTURE_2D,3,_mytextures[filename].width, _mytextures[filename].height, _mytextures[filename].type, GL_UNSIGNED_BYTE, _mytextures[filename].imageData);
I havent used gluBuild2DMipmaps for a long time but I belive 2nd parametr should be 4 not 3 (GL_RGBA -> 4 components). Otherwise go to www.opengl.org and read gluBuild2DMipmaps spec.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Advertisement
Yeah! Now it works!
I must admit that that was an damn stupid mistake and the only excuse that I have is that I''m a lazy newbie and I just copied the code and missed that change - thanks a lot - especially for the quick answer!

This topic is closed to new replies.

Advertisement