LineSegs Color on render2d

The materials don’t show up using a regular light source because geometry created using LineSegs doesn’t have normals; the axes will just be black (they were white previously because you hadn’t set any light to affect the GlobalFrame).

You can use vertex colours instead, which can be set using a call to axe.set_color(*co_cl), before any calls to axe.moveTo and axe.drawTo:

        for name, co_cl in axes.items(): 
            axe = LineSegs(name)
            axe.set_color(*co_cl)
            axe.moveTo(0, 0, 0)
            axe.drawTo(*co_cl)

Note that axeNP.setColor calls have no effect unless you use a priority value, as LineSegs sets a RenderState with a ColorAttrib at the Geom level.

Regarding the actual purpose of your GlobalFrame, it doesn’t work properly right now. To get the inverse of an orientation you can’t simply negate the corresponding hpr values; instead, you need the inverse of the quaternion representing that orientation. In your case, you can retrieve the quaternion of the world (“render”), relative to the camera pivot:

    def setOri(self, task):
        """Set orientation of global frame"""
        if self.app.viewChanged:        
            self.set_quat(self.app.render.get_quat(self.app.camPivot))
            self.app.viewChanged = False
        return task.again

Good luck with your project :slight_smile: .