DirectLabel

i am having some trouble attaching a DirectLabel to an object in the render graph. I can create the label but when I try to attach the label to a node it disappears.


        from direct.gui.DirectLabel import DirectLabel
        label=DirectLabel(parent=render2d, text="Testing", text_wordwrap=10,
                   relief=None, text_scale=(.08,.08),
                   text_frame=(0,0,0,1),
                   text_bg=(1,1,1,1))
        label.component('text0').textNode.setCardDecal(1)
        import time
        time.sleep(5)
        
        chatBubble.wrtReparentTo(icon)

the camera has been rotated as well


from pandac.PandaModules import OrthographicLens
        lens = OrthographicLens()
        lens.setFilmSize( width, height
                         )
        
        lens.setFar( 5000 )#input
        base.cam.node().setLens( lens )
        base.camLens.setFar( 5000 ) #input
        base.cam.setPos( width/2, height/2, 2000 )
        base.cam.setHpr( 0, -90, 0 ) #input

thanks

is it possible to retrieve the texture containing the text of a textnode and use it on a different GeomNode?

DirectGui objects must be attached at aspect2d or below–you can’t parent them to render2d, because they require special handling by the mouse processor, and that handling begins at the aspect2d node.

The text output by a TextNode is not contained in one texture, but is actually a collection of polygons with different UV coordinates mapped across their faces. You can copy that geometry, if you like, if you have the TextNode:

np = myTextNode.node().generate()
np.copyTo(dest1)
np.copyTo(dest2)

David