Results 1 to 3 of 3

Thread: texture has alpha or not ?

  1. #1

    texture has alpha or not ?

    i have this code:

    [pascal]
    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));
    [/pascal]

    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
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  2. #2

    texture has alpha or not ?

    Checking if surface formats BitsPerPixel is 32 should give what you want

  3. #3

    texture has alpha or not ?

    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
    [pascal]TextureImage.format.alpha[/pascal]

    I am not sure if this actually works, but theoretically that is where the information should be stored.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •