Howdy, Stranger!

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

Categories

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

  • gautamgautam Member Posts: 642
    : 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);
  • Shawn CarterShawn Carter Member Posts: 0

    ________ < http://forcoder.org /> free ebooks and video tutorials about || Objective-C, Perl, Swift, Assembly, C++, R, Python, JavaScript, Go, PL/SQL, Ruby, Delphi, Visual Basic .NET, MATLAB, C#, Visual Basic, Scratch, C, PHP, Java Kotlin, Lisp, COBOL, Alice, D, Julia, LabVIEW, SAS, ABAP, Hack, Transact-SQL, Clojure, Awk, Rust, FoxPro, Dart, Scala, Logo, Erlang, ML, Bash, VBScript, F#, Lua, Prolog, Crystal, Scheme, Apex, Ada, Fortran || _______

Sign In or Register to comment.