Hopefully this is quite simple but as I’m not so familiar with jit.gl.render I can’t get my head around this.
I’d like to display text with jit.gl.text2d (multiple word actually) and I’d like to be able to "turn on and off" those words separately. I’ve manage to write separately words (easy enough) but it seams that only by reseting the jit.gl.render object I can delete them… when I would like only to delete them individually (I hope it make sense), I’m attaching the patch anyway.
Thanks for your help,
Ps: I’ve search in the forum and couldn’t find anything related, so I hope I’m not asking something too obvious here…
My understanding is that once you’ve rendered something, the only way to get rid of it is to clear the context entirely or draw something else over it.
If your words overlap a lot, probably the only way to do it reasonably easily is to draw every word every frame and just disable the ones you don’t want. If there isn’t a lot of overlap, maybe you can figure out some kind of invalidation routine wherein you just draw over the part of the screen that needs redrawn with the bg color and redraw that specific piece of text. If you’ve got enough speed, I’d just do the former.
Be warned though, redrawing lots of text objects in this way seems to expose a pretty severe memory leak in the jit.gl.text*d objects, as I described in a post a couple of days ago.