Results 1 to 4 of 4

Thread: OpenGL specific Blending Functions

  1. #1
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    OpenGL specific Blending Functions

    I know that this may be obvious to most already using OpenGL, but I'm still fairly new to it so that said...

    How do I ADD, SUB and MUL a texture to the screen? A simple alpha isn't really what I'm going for as I'm trying to create an explosive effect that will brighten the colors as they are combined on the screen.

    I'm almost sure it's the glBlendFunc(); function... but what are the settings I want?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    OpenGL specific Blending Functions

    Ouch... figured it out on my own. :roll:

    You'll want to set...

    [pascal]glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);[/pascal]

    ...then adjust it using...

    [pascal]glColor4f(1, 1, 1, me);[/pascal]


    Honestly though, coming from a genrally 2D background, some of the definitions are somewhat unfamiliar to me. It would be handy to have a small guide for converting my existing 2D knowlage to the OpenGL state settings. :scratch:
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    OpenGL specific Blending Functions

    Additive: glBlendFunc(GL_ONE, GL_ONE);
    Subtractive: glBlendFunc(GL_ZERO,GL_ONE_MINUS_SRC_COLOR);
    Multiplicative: glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_COLOR);

    I might be wrong on the last one though as I haven't used blending for a long time
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  4. #4

    OpenGL specific Blending Functions

    On www.delphi3D.net there is an application which shows all OpenGL blend modes in action. Look for blender.zip in downloads -> libraries & tools section.

Bookmarks

Posting Permissions

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