LineSegs with alpha no smooth!

hi, i’m drawing a graph and i’m using LineSegs for drawing edges.

i have this code:

class MyApp(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)
        base.win.setClearColor(VBase4(1,1,1,1))
        render.setTransparency(TransparencyAttrib.MAlpha)
.... 
seg = LineSegs()
for e in edges:
    alpha = getSomeAlpha()
    seg.setColor( VBase4(0,0,0,alpha) )
    t0 = getVertex1(blabla)
    t1 = getVertex2(blabla)
    seg.moveTo( t0.getPos() )
    seg.drawTo( t1.getPos() )
    
self.graphdraw = graphnode.attachNewNode( seg.create() )

the alpha is set as i want but there is no smooth, no anti aliasing.

some advice?

Try something like:

graphnode.setAttrib(AntialiasAttrib.make(AntialiasAttrib.MLine))

Note that you probably also ought to replace render.setTransparency(…) with graphnode.setTransparency(…), unless you really do want transparency enabled on the entire scene. But enabling transparency is expensive and causes sorting artifacts, so it’s usually better to enable it only where you really want it.

David

perfect! it is perfect!

now, i would like to add a bit of glow on the linesegs… advice?