I have uploaded a better version of the tgsj script
to the file tgsj3ogl.ijs at the following (same) link.  I
would especially like if I could get some feedback from a
Windows user as to whether the following experiments work,
for example. (I hope they work both with the java and the
windows gui.)

0       With the graphics window in focus, can you get
expected changes in the graphics when you press single keys
like jklJKL, xyzXYZ, and io; similarly do the arrow keys and
PageUp/Dn produce expected results and does pressing the F4
function key snap the scene back to its original position.

1       In the .ijx window can you type commands like the
following and get expected results (ie, results like you got
for some of the results in 0, above)?

Eye fd 2
Eye bk 3
Eye yw 45
Eye yw _45
Eye jumpright 3
Eye jumpleft 3
Eye jumpup 4
re ''  NB. reseteye like F4 key

        If you are interested you can periodically type the
following line into the .ijx window to see the numeric
results of the these trials. The THIRD row of each output
box reports the state values for the Eye; the other rows
report state values for the other two turtles. What is a
little disorienting is that the Heading values correspond to
the degrees of pitch, yaw, and roll, not degrees of x,y, and
z rotation.

Heading;Position

http://www.jsoftware.com/jwiki/BrianSchott/code/turtleGraphics/3Dogl

        I would really appreciate feedback.

        I am still having trouble with failures that grow
out of programmed results when turtle movements (not Eye
movements, necessarily) are repeated too many times in a
"for."  loop. When the loop gets too long, the Eye
keystrokes suddenly stop working as the following script
will demonstrate. If you load the following TEST script and
then in the .ijx window enter the command "try 5" the
background color will change 5 times and then you can used
the usual keystroke commands to change the view as you have
before with all of the above keys like the jklJKL and arrow
keys.  BUT when the 5 is changed to some higher number (35
was such a number on my computer), the keystroke commands
all stop working until I delete the graphic window and
reload the script and start over. I suspect I am getting
some sort of stack overflow, but I did not expect that with
a "for." loop.

        The script below is self-contained except that you
must experiment by typing "try N" in the .ijx window for
various values of N.

*******script below************

NB. testoglrepeat.ijs
NB. 12/24/6

NB. Standalone version of opengl demo.
NB.
NB. This text can be cut and pasted into a single script.

require 'opengl'
NB. cocurrent 'gldemo'
coinsert 'jzopenglutil'

gsetdefaults''

OPENGL=: 0 : 0
pc opengl;
NB. the next line may be too long and wrap ******
xywh 0 0 200 150;cc g isigraph opengl rightmove bottommove;
pas 0 0;
rem form end;
)

opengl_run=: 3 : 0
wd OPENGL
ogl=: '' conew 'jzopengl'
wd'pshow;'
)

opengl_close=: 3 : 0
destroy__ogl''
ogl=: ''
wd 'pclose'
)

opengl_cancel=: opengl_close

NB. ============================================
NB. cups surface - colored by height

j=. steps _2.4 2.4 35
f=. (5: * ] % [EMAIL PROTECTED]&*:)"0/~
CUPS=: 1.4*gsfit11 gsmakexyz (];];f) j

j=. (1r4"_ ,. |. ,. ]) _2}.8}. gsint01 16
CUPCLR=: j gshue gsfit01 {:"1 CUPS

".COLORTABLE

gsetdefaults''
GS_CLEARCOLOR=: IVORY

pickone =: COLORTABLE&(13 : '".>{.;:y{x')

try =: monad define
  for. i. y do.
    [EMAIL PROTECTED]@? 144
  end.
)

go =: monad define
  GS_CLEARCOLOR=: y
  paint''
)

paint=: 3 : 0
  wd'psel opengl;pactive'
  if. gsinit GS_LIGHT do.
      gsdrawsurface2 makelist 1 CUPS;CUPCLR
    end.
    gsclearcolor GS_CLEARCOLOR
    glCallList 1
    gsfini''
)


NB. ===============================================
opengl_g_paint=: paint
opengl_g_char=: gschar
opengl_default=: gsdefault

NB. ===============================================
opengl_run''


**********script ends here *****************


(B=) <----------my "sig"

Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to