Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: color alpha?

  1. #1
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40

    color alpha?

    Hello,

    When I set my vertex color in my glsl vertex shader like this, it doesn't do what I expect. Specifically I expect that setting the alpha to 0 would cause the vertex to be transparent. But it isn't. The color stays there pretty visibly, and seems to get lighter. Why is that? Are they supposed to be pre-multiplied or something, where the following color might be illegal?

    colorVarying = vec4(0.3,0.1,0.75, 0.0);

    Thanks
    Bob

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    You have to enable blending before the alpha value has an effect

    http://www.opengl.org/archives/resou...ansparency.htm

  3. #3
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40
    Yes, it is enabled. I do see transparency, but just not how I expect. Basically I am accustomed to thinking "oh if I want a half-transparent red color, will set it to RGBA 1.0 0.0 0.0 0.5"

    But it appears that for me at least, I would have to tell openGL 0.5 0.0 0.0 0.5 to get something half transparent. Basically, with red set at 1.0, it does not seem to have much effect changing the alpha value. It looks about the same at .75 alpha as .01 alpha. It doesn't seem right to me.

    Bob

Posting Permissions

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