Jump to content
  • Advertisement
Sign in to follow this  
riruilo

OpenGL Why do my PNG textures have a whitish thin border?

This topic is 3437 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 friends! I upload a picture of a texture on my Photoshop and my opengl program. My question is why I see a gray/white/whitish border? Do you see it? Is it in relationship of PNG pre-multiplied alpha channel? My render code have: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); and my initialization opengl code: glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); Does Anybody know what going on is? By the way, my textures are showed perfercly on Adobe Flash. Thanks a lot for your help. Image Hosted by ImageShack.us Image Hosted by ImageShack.us

Share this post


Link to post
Share on other sites
Advertisement
Because you are filtering your textures, and the border is getting averaged out with the white pixels that are supposed to be transparent.

It's been a few years, so i forget exactly how it's done in GL. You'll have to use point sampling, which I think is called GL_NEAREST. You call some function to set the state, and then use that for the MIN and or MAG filters.

Share this post


Link to post
Share on other sites
Or, you can make sure that the transparent areas are filled with color similar to adjacent parts of the image. That way, you can still use linear filtering, and it will average it with the colors you want.

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!