[SOLVED] Render + TextNode + Background Color

I’m using a textnode in the 3d world (attached to render) and I can’t get a correct background color.

    self.text = TextNode('node')
    self.text.setText("root")
    self.text.setTextColor(myColor.Brown)
    self.text.setCardColor(myColor.Red)
    self.text.setCardAsMargin(0, 0, 0, 0)
    self.text.setAlign(TextNode.ACenter)

A text node is created but the background color is over the text color so I can’t read the text. I tried without the “Card” and I get a correct text with a transparent background.

How can I use a background color ?

Where did you attach the text? It makes a difference whether you parent it to render or render2d, because of the different render-order requirements for both scene graphs.

Under render, you might also need to call:

self.text.setCardDecal(True)

which enables a slightly-more-expensive rendering mode that should guarantee the card appears behind the text.

David

It was attached to render.

Thank you for this solution it works very well.