Results 1 to 4 of 4

Thread: alpha texture problem

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2012
    Posts
    2

    alpha texture problem

    Hello,

    I show 2 triangles with png textures RGBA, it works without alpha activated.

    But, when i activate alpha with
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    My all screen become black. But alpha works without texturing.
    Someone can help me please ? Thanks

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: alpha texture problem

    Most probably you do not fill the A of your texture properly the the bendfunc you use.
    0.0 means completely transparent, 1.0 (or 255) means opaque.

    Quick fix could be to use this instead :
    glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    3

    Re: alpha texture problem

    Thanks, but with

    glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
    alpha is replaced by a black color.

    i tried with

    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    it works for alpha, but all pixels are transformed, like this : a green pixel from texture_1 is transformed into a light blue pixel when it's over the blue pixel from texture_0.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2012
    Posts
    2

    Re: alpha texture problem

    Solved,

    The problem was from SDL_CreateRGBSurface( ... );
    to direct copy blits :

    SDL_SetAlpha(surface,0,0);
    SDL_CreateRGBSurface( ... );

    This allows all the alpha values from the source surface to be copied to the destination surface during blitting.

    Thanks

Similar Threads

  1. Texture Vs Geometry Alpha Problem
    By 7th in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 01-06-2005, 09:13 AM
  2. problem with texture and alpha blending
    By jean-bobby in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-05-2004, 12:02 AM
  3. Render To Texture Problem : No Alpha
    By [hjd_uk] in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-02-2003, 02:25 AM
  4. Lighting / texture / alpha problem
    By vladv in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-23-2003, 09:51 AM
  5. Draw ALpha Texture Problem
    By pongkm in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 08-23-2002, 01:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean