PDA

View Full Version : texture has alpha or not ?



{MSX}
28-01-2005, 07:49 PM
i have this code:


function LoadGLTexture(filename: string; var TextureID : GLuInt ): Boolean;
var
// Create storage space for the texture
TextureImage: PSDL_Surface;
begin
// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
TextureImage := IMG_Load(pchar(filename));


that uses sdl_image..
How ho i check if the loaded image has alpha channel or not ? i've looked at the TSDL_Surface and PixelFormat but i've found nothing..

Thanks

Paulius
28-01-2005, 08:19 PM
Checking if surface formats BitsPerPixel is 32 should give what you want

savage
30-01-2005, 08:18 PM
SDL_Image will set the alpha channel in the surface if the image that it loads, already contains an alpha channel.

Also note that TSDL_PixelFormat structure should contain alpha value information. In sdl.pas look for alpha: UInt8; // Alpha value information (per-surface alpha).

Or using your code it should be
TextureImage.format.alpha

I am not sure if this actually works, but theoretically that is where the information should be stored.