DirectGUI interferes with glowShader?

I have stumbled upon an interesting “bug?” with the glowShader given in the tron example that I am now trying to use in my game development. My game has parts where I use the standard lineSegs and I make them glow using the glowShader.

        lines = LineSegs()
        node = lines.create() 
        self.myNodePath = NodePath(node) 
    def setGlow(self, sim):
        """Does the object glow"""

This works nicely, however I have noticed (at least in linux) that when I put in some DirectGUI stuff sometimes the gloweffect goes away. Sometimes it comes back if I pop in more directGUI controls. I’m unsure why directGUI would have an effect on the glowShader, but it seems to. I have also noticed that the glow effect is not bothered on my other sims, just the line segments.

Has anyone come across this before?

If this is not enough information I can put together a runnable example, but I thought I would throw this out there first to see if it has come up before.



I guess nobody has come across this, which is too bad, but I’ll throw another question out there that would get the job done for me without worrying about LineSegs.

I’ve noticed that regular objects glow properly, so I experimented with loading a square image and stretching it out so it looks like a line. Looks great with the glow effect, it also doesn’t seem to have much of a performance hit compared to the lineSegs.

LineSegs is nice because you give it x1, y1, x2, y2 and it does the rest, with this other method I did the following:

  • Calculated the middle of the two points and placed the object there.
  • Calculated the range between the two points and made the object stretch out between them

My problem (and question for you) is how to calculate the angle properly between the two points so that I can rotate the image so that it lines up properly. I’m only concerned with x and z, y is constant. All this work is on the x, z plane.

I’ve looked on the forums and found some things, but everything I have tried has not quite done the job.

This is the function (that I made from a previous game) that I tried to use, it was “close”, but in some cases it did not do the job. Also I noticed I had to add 90 degrees if the range was in (0,90,180,270).

def getRelativeAngle(x1, y1, x2, y2):

    """Return the Relative Angle from Point A's perspective between point 

    A and point B.  Return in degrees"""

    dx = x2-x1

    dy = y2-y1

    angle = 0.0

    # calculate angle

    if dx == 0.0:

        if dy == 0.0:

            angle = 0.0

        elif dy > 0.0:

            angle = math.pi / 2.0


            angle = math.pi * 3.0 / 2.0  

    elif dy == 0.0:

        if  dx > 0.0:

            angle = 0.0


            angle = math.pi


        ratio = float(dy)/float(dx)

        if  dx < 0.0:

            angle = math.atan(ratio) + math.pi

        elif dy < 0.0:

            angle = math.atan(ratio) + (2 * math.pi)


            angle = math.atan(ratio)


    # convert to degrees

    angle = 180.0*angle/math.pi


    if angle < 0:

        angle += 360.0

    return angle

Any help would be appreciated!


use lookAt :