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 2 of 2

Thread: how to use texture combiners?

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

    how to use texture combiners?

    Hello,

    I am having a hard time finding good information about texture combiners. Can they be used to draw a texture half-transparently? The texture already has its own alpha mask which defines its shape. But I want to draw the whole thing at a specifiable level of transparency.

    I know that ordinarily you would use glColor and blend mode to do this. But it isn't working, and I am wondering if I have my combiner set up incorrectly.

    It's really unclear to me what the relationship is between the blending mode setting and the combiner settings. Is there a good reference for learning about that?

    Thanks!
    Bob
    Last edited by bsabiston; 11-25-2013 at 03:09 PM.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,180
    There's no relationship between the combine state and the blending state; the output of the per-fragment stage (set via the combiner mode) is used as input to the blending stage (set via the blend mode) (potentially after going through some other tests which don't really concern us here) so all that the blend stage needs is some form of input; it doesn't really care about what kind of states were used to get that input.

    In your case, glColor (1, 1, 1, 0.5) with an old-fashioned TexEnv of GL_MODULATE (i.e. no combines needed) will get you an output from the per-fragment stage that contains alpha 0.5. Then setting up a glBlendFunc of (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), together with glEnable (GL_BLEND) (of course) should be all you need.

    I'm curious what you mean by "it isn't working" here. You really should post some code so that we can help you properly because this is something that should work.

    It's also the case that if you're talking about using GL_COMBINE modes, you're really at the stage where you should be seriously considering shaders instead.

Posting Permissions

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