11-08-2005, 06:45 PM
I've been having some real problems lately. I'm working on a chess program and want the pieces to be texture mapped with nice images rather then plain primitives. So the problem is I was able to get it to load BMP's however is there a way to get it to not display a certain color? I figured it'd be best to go with TGAs. Another question....Is it true that TGAs only suuport transparency at 32bpp? So basically I'm looking for the best way / easiest way to display images of the pieces along with the transparency. So I believe I loaded a TGA file before at least it said everything went ok but when I go to draw it on top of the square where it should be it is just white. So many problems here. Sorry would some of my source code help here? Any thoughts?
In addition to the R,G,B color planes of the TGA file, there's channel called 'alpha' which states the translucency of every of these pixels. You must also load them using the RGBA format and set the blending GL function if you want to 'mix' colors or set the alpha function if you want instead only to discard some pixels. Here's an example:
GL_RGBA, //The file has alpha information
GL_RGBA, // The texture will store also that alpha information per pixel
glAlphaFunc(GL_GREATER,0); //Discard pixels with alpha==0
11-09-2005, 04:48 AM
OK, I'm not really sure how but I was able to get a little demo going and it loads and displays TGA files correctly. Thanks for replying....it helped.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.