jit.gl.text3d Drawing a variable number of text boxes,different positions/angles

Sep 25, 2012 at 1:38am

jit.gl.text3d Drawing a variable number of text boxes,different positions/angles

Hello,

First of all, I want to thank all the contributors on this forum. They helped me a lot, and they saved me a lot of time every time I struggled with some programming issues.

Today, I have an issue I can’t really find an answer here, and I am wondering if one of you have an idea. This is probably a noob question, sorry about that.

What I am trying to do is to use a list of texts, along with position and angle.
For instance
“foo1″ 0. 0. 1. 360.
“bar2″ 0. 1. 0. 90.

(this list can contain a variable amount of lines)

And I would like, for each item of the list, to have the text (“foo1″, “bar2″, …) displayed at the given position and rotated with the given angle.

I know how to use jit.gl.text3d for one text, but I am struggling with it if I need to display a variable number of text boxes, at different places, and with different rotation.

One solution could be to instantiate 40 or 50 jit.gl.text3d, and modify them incrementally… but I doubt this is a elegant solution.
Would be ideal if I can do something similar to jit.gl.sketch: sending different messages to the object to draw shapes at different locations.

Does anyone has some advice for me?

Thank you very much,
Raphael

#64490
Sep 25, 2012 at 2:00am

See jit.gl.multiple.

#232652
Sep 25, 2012 at 4:46am

I don’t think jit.gl.multiple gives a solution, since you can’t write different text at different location. I’d use a poly~system with jit.gl.text3d in it

#232653
Sep 25, 2012 at 11:04am

Wow!

Thank you very much both of you, I didn’t know any of these objects.
I think that poly will definitely be a good solution for my problem.
(that awkward moment when you realise that you could have done a much better code if you had known this before ;-)).

This is perfect!

#232654
Sep 26, 2012 at 7:15am

in many cases I use poly~ instead of multiple, probably at the expense of cpu.

what I do is I have a matrix with coord sent to all pony instances with a send object. then I use a submatrix @dim 1 1 that has an offset in relation to thispoly~voice number to have just the data in the matrix I want.

the text itself could be set with a target n, text blabla message to the instance (n)

#232655

You must be logged in to reply to this topic.