I'm not sure if I can get to this today, but what you are doing here is
closely related to my own interests, so I really would like to help you
solve it.

>From your description, I suspect the problem is in step 5. Without looking
at your code, though, I can only speculate about what's gone wrong.

If I had to take a guess, though, the first thing I'd look for is whether
you are using gl.drawArrays after using gl.bufferData (and before the next
instance of gl.bufferData for that region of the buffer).

One thing that sometimes helps is to throw console.log statements into
suspect regions of code, so that you can manually inspect the data (and see
whether you even have the data you expect at that step, whether the step is
happening, and so on). Sometimes, I've even been known to place a
console.log statement on every line or between every line - I do this when
inspecting the tests based on my initial guesses teaches me something which
I have trouble grasping and when the problem size is small enough to allow
exhaustive inspection.

Thanks,

-- 
Raul


On Sat, Mar 22, 2014 at 11:38 AM, Brian Schott <[email protected]>wrote:

> First the good news. Joe's idea to use alldata.push(row); to '...push the
> single row to a javascript array...' works fine, except that only after
> much head scratching I discovered I needed .concat in addition to .push for
> turtle paths, (not for turtle avatars).
>
> The bad news is pretty devastating. I cannot think of a way to deal with
> user entries in the text field that combine multiple turtle moves/turns.
> Only the first move or turn is reflected in the immediate visible result
> and the system seems to think for an unduly long time.
>
> To explain the issue, I will outline the current processing sequence of
> tgsjhs, the app. ***I can think of no way to cycle repeatedly through steps
> (2) to (5) when there are embedded multiple turtle moves/turns. ***
>
> (0) The user enters  a 'command' which is a turtle move or turn (and if not
> for my problem, other commands with embedded multiple turns or moves). A
> typical single command is `fd 20` to move the turtle(s) forward 20 steps.
>
> (1) That 'command' is sent via js's
> ev_command_enter(){jdoajax(["command"],"");} to jhs.
>
> (2) The command is processed in jhs to produce a new or incumbent turtle
> heading/position vectors and a new or incumbent turtle path.
>
> (3) The produced vectors and paths are sent back to js by paint's jhrajax.
>
> (4) Js receives the vectors and paths in ev_command_enter_ajax(row)
>
> (5) The collected vectors and paths are processed by the drawing js
> function draw(), which populates the canvas using webgl.
>
> (6) The web page awaits more user inputs.
>
> For example, there is a defined conjunction, repeats, as follows. The verb
> v might be `fd` from above in a silly example to repeatedly move fd in
> steps, rather than all at once.
>
> NB. enable one-liner turtle movement sequences
> repeats=: conjunction define
> for. i. m
> do. v y
> end.
> :
> for. i. m
> do. x v y
> end.
> )
>
> Surely this can be done with minimal user knowledge of the problem. But I
> cannot figure out how. Help would be appreciated.
>
> Thank you,
>
>
> >> Yes, I didn't spend the time to modify the example, but you can
> >> certainly just push the single row to a javascript array
> >>
> >> Something like:
> >>
> >> var alldata=[]
> >> function ev_command_enter_ajax(row)
> >> alldata.push(row);
> >> for(var i = 0; i < alldata.length; i++) {
> >> ts = alldata[i]
> >>
> >> //draw logic for a single row
> >> }
> >>
> >>
> >
> >
> --
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to