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

Thread: How to do additive line drawing

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    6

    Question How to do additive line drawing

    Hi All,

    I am having a hard time converting code to draw a vectorscope which is currently drawn with Qt using QPainter.
    I can't figure out now to get the additive line drawing effect: I am drawing a large number of "randomn" dark gray lines on top of each other and the points where they cross they should get brighter. Somehow I am not allowed to post an example image

    Thanks for you help
    Markus

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    Are you doing alpha blending?

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    6
    No, currently I am only setting glBegin(GL_LINE_STRIP) and draw using glVertex3f().
    I am not sure how to use alpha blending.

  4. #4
    Intern Contributor
    Join Date
    May 2013
    Posts
    60
    If you use a black surface as base (glClearColor(0,0,0,0)), you can simply use additive blending. Meaning if you draw the value 20,20,20 two times on a pixel then the pixel will be 40,40,40. Three times will be 60,60,60 and so one...

    Code :
    glBlendFunc(GL_ONE, GL_ONE);
    glEnable(GL_BLEND);
     
    //your drawing
     
    glDisable(GL_BLEND);

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    6
    Thanks a lot, that worked!

Posting Permissions

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