My graphics turtle simulation is working better now because I have
removed the line ( wd'psel opengl;pactive') from the paint verb, but I
still am observing some problems. For now the problem is that I want
to give users 3 or 4 lines of J code to paste into the ijx window and
then click menu Run|Selection on the selected lines. But when I do
this with my application (even with a single line like "try 2" for
example) I get an error message like this.
try 2
|domain error: glqwh
| wh-: glqwh''
wd 'qer'
no error : 0
wd 'qwd'
jjava
glqwh''
|domain error: glqwh
| glqwh''
Now here is the really frustrating thing. If I add the line ( wd'psel
opengl;pactive') *back into* the paint verb, then this problem goes
away: I can Run|Selection then.
So, with the line ( wd'psel opengl;pactive') in the paint verb I get
poor behavior of the application itself (keystrokes in the graphics
window begin to fail after just a few simulations), but without the
line, the application fails using Run|Selection from the ijx window.
Can you tell me how to work around this dilemma?
I have placed the test script below, again.
Thank you, all,
****************************************************
require 'opengl'
NB. cocurrent 'gldemo'
coinsert 'jzopenglutil'
gsetdefaults''
OPENGL=: 0 : 0
pc opengl;
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: * ] % ^...@+&*:)"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.
g...@pickone@? 144
end.
)
go =: monad define
GS_CLEARCOLOR=: y
paint''
)
paint=: 3 : 0 NB. even this paint fails with "try 100"
NB. wd'psel opengl;pactive'
gsinit ''
gsclearcolor GS_CLEARCOLOR
gsfini''
)
paint=: 3 : 0
NB. 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''
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm