Opengl, windows bitmap and transparency.

Could somebody please tell me if it is possible using Opengl to set a single colour in a windows bitmap (which I've already loaded and displayed) to be invisible (i.e. make all black areas of the bitmap be completely transparent while leaving the rest totally opaque, so that the sprite doesn't seem to exist inside a box) and if so, how would this be done?

Comments

  • : Could somebody please tell me if it is possible using Opengl to set a single colour in a windows bitmap (which I've already loaded and displayed) to be invisible (i.e. make all black areas of the bitmap be completely transparent while leaving the rest totally opaque, so that the sprite doesn't seem to exist inside a box) and if so, how would this be done?
    :

    Use an alpha channel.

    Set alpha = (r + g + b)/3 and use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion