Eric's demogl1 has gone a long way toward creating webgl graphics in JHS. I
am now trying to understand how to trigger "non-event" and "multiple" draws
with my adaptation of opengl turtle graphics scripts to webgl.

First to explain "multiple" draws, the user commands produce dynamic
simulations of the turtle(s); each turtle may produce a draw or not
depending on its state when a command is entered. Examples of multiple
draws would be triggered by the 3 examples below entered in my html5 text
field. In the opengl version, I could supply an array of rank x,y where x
was the number of draws and y was the either starting and ending
coordinates for a line or angles for turns. I cannot think of ways to
supply such arrays of varying number of rows to a draw() type function.
That is my first question, how to supply multiple move or turns, preferably
without loops, but not necessarily.

fd 20          NB. 1 or all turtles move forward 20 steps
fd 10 20      NB. turtles 1 and 2 move forward 10 and 20 steps
yw 90          NB. 1 or all turtles move turn right 90 degrees

Regarding "non-event" draws: I want the user to be able to supply their own
j verbs that contain multiple steps.

fdyw =: dyad define
fd x
yw y
)

100 50 _50 fdyw 30 30 30 NB. 3 turtles move and turn

In my earlier turtle graphics scripts (without html involved) I was able to
deliver path arrays and movement sequences to opengl by embedding a
draw/paint action ONLY into each fd and rt element. But fd's and yw's are
contained inside other user defined functions. For example, inside fdyw,
which is a j verb containing first fd and then yw, but the only event
triggered is the text change event, not the fd nor the yw. So my second
question is how to achieve this in JHS?

Thanks,

-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to