Jump to content
  • Advertisement
Sign in to follow this  

Alha blend, billboard and png files

This topic is 3905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys!! i have a problem with a png file and the alpha channel, i try to implement a billboard effect but y can't avoid the transparent of the texture, when i load the texture with Photoshop i see a transparent effect... but when i load it into my engine a get all the background black ... :( i use this code to load the texture using devIL
 glGenTextures(1, &id); 
    glBindTexture(GL_TEXTURE_2D, id); 
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	gluBuild2DMipmaps (GL_TEXTURE_2D, 3,ilGetInteger(IL_IMAGE_WIDTH),ilGetInteger(IL_IMAGE_HEIGHT), ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData());

and them when i render a texture over a simple 4 vertex poly i use glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_EQUAL, 1.0); // Draw my objects... glDisable(GL_ALPHA_TEST); any clue on what happend ?? thanks in advance!

Share this post

Link to post
Share on other sites
Here is the man page for gluBuild2DMipmaps. Take a look at the internalFormat parameter. You're creating a texture with 3 color channels (RGB), so there is no alpha channel. If alpha is missing, when OpenGL expands the color to RGBA it takes the alpha channel to be 1.0.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!