I’m trying to make a speech bubble with this code:
self.frame = OnscreenImage(image="data/models/etc/speechbubble.png",scale=3)
But it will get the “speaker” texture!
I tried reseting the image with
, but it disappears
Hmm, that’s because a texture that’s applied to a parent node will also propagate to a child node. You can disable this if you use an override value with setTexture, ie. setTexture(texture, 1).
I finally got the image to work, but now I’m in trouble with the text!
self.frame = OnscreenImage(image="data/models/etc/speechbubble.png",scale=2)
p = speaker.getPos(np)
self.text = OnscreenText(text=speech,scale=.25,fg=Vec4(0, 0, 0, 1),align=TextNode.ALeft,pos=Vec3(-.9,.7,7),decal=True,parent=self.frame,wordwrap=4*1.75)
But the text seems to “fight” the image!! Look the effect:
Very similar to what happened here: Nametag wierd effect
But this time I AM passing decal=True to the constructor.
I think decal=True will only work if the text and the frame of the same OnscreenText object are fighting. In this case, you could try self.text.setDepthOffset(1).
Didn’t work (actually helped just a little, it got like 10% more readable)
Worked when I set offset to 999
In that case, the better way to eliminate z-fighting is probably to just give it a very slight positional offset so that it’s just a tiny bit in front of the other card. Depth offsets are known not to show reliable behaviour between graphics cards.