Here you go -- a multi-turtle system. (Though, when rotated -- hold down x -- this also demonstrates that I should deal with my gl_Frustum issues. And, I should really implement color properly...)
Also... I noticed that 48.ijs only worked if a_run'' had previously run... oops. I've verified that 49.ijs works in a fresh jqt session. Still... as a proof of concept, 49.ijs should be kind of in the ballpark of where you want to be? Thanks, -- Raul On Tue, Mar 3, 2020 at 6:18 PM Raul Miller <[email protected]> wrote: > > Think of vertexData and colorData (recast and restructured in 48.ijs > as renderVertices and renderColors) as being a representation of the > all the turtles and all their trails. > > You also might not have noticed my 'direction' and 'position' > variables. In 48.ijs, those were designed around the idea that there > would be only a single turtle. We could add a leading dimension to > each of those, whose index is a turtle id. > > I could throw together an implementation of that in about half an > hour, if I neglect the other updates I was thinking needed to happen. > I'll try that and send it to you, shortly. > > Thanks, > > -- > Raul > > On Tue, Mar 3, 2020 at 6:12 PM Brian Schott <[email protected]> wrote: > > > > All, > > > > Recall that I am (re)developing a multiple turtle, turtle graphics system > > using modern openGL. I have been unable to find examples of how to do this, > > and the examples that come close use C++ and GLM which hide from me some of > > the essentials. What follows is my current understanding of how I might > > proceed. I want advice, please. > > > > Consider the "model-view" line (just below) for transformations in > > shader.ijs. (The "Projection" line immediately after the "model-view" line > > in the code is not relevant to my comments.) > > > > NB. model-view (*********line wrap is bad here********) > > mvp=: (gl_Rotate (0{R), 1 0 0 ) mp (gl_Rotate (1{R), 0 1 0) mp (gl_Rotate > > (2{R), 0 0 1) mp (gl_Scale STEPS%100) mp (gl_Translate 0 0 _8) mp > > glu_LookAt EYE,LR,UD,IO,UP > > > > But I do not think that "model-view" line can be used effectively in a > > turtleS (plural) graphical system because the calculation is really moving > > the system camera (I call it the Eye) so it can focus on a specific target > > in the scene. > > > > I believe, but want to proved wrong, that instead each turtle has to have > > its own vertexData array and that array must be rewritten after each > > position or heading change. It is possible that only turtles that do so > > move require a change of their vertices and position. Furthermore, a > > separate current heading matrix and gl_Position for each turtle must be > > computed and stored after each rotation and translation, respectively. > > > > I may be wrong about gl_Position above, because that special value may be > > associated with the camera and not with the individual objects. Does anyone > > know about that? > > > > If I am correct that each turtle's moving or turning vertices have to be > > altered, I believe I understand how gl_Rotate and gl_Translate can be > > applied to vertices to generate knew vertices, and how a new 3x3 heading > > array can be computed after each rotation and how revised position vectors > > can be computed. Saving the heading array and the position vectors may be > > more efficient in j than in openGL, but I have not thought that through. > > > > It seems to me that it might be very desirable to save the revised > > vertexData vertices in their original location so that the pointer in > > "symdat <'vertexData'" can be used without rebinding the vector buffer. But > > I have no idea if or how that might be done. Help, please. > > > > Any help on these issues would be greatly appreciated. > > > > -- > > (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
