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
    Senior Member Regular Contributor
    Join Date
    May 2013
    Posts
    149
    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!

Similar Threads

  1. Drawing points before drawing a curve line
    By PepeBeef in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-26-2017, 09:34 PM
  2. Drawing 3D line
    By opendj in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 02-06-2011, 10:22 AM
  3. Drawing a full line over a stippled line
    By schtroumpfbleu in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 11-04-2010, 02:13 PM
  4. Need help with drawing a line
    By brett01 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-18-2010, 10:02 PM
  5. Line drawing.
    By imported_newbie in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-14-2000, 11:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean