I am attempting to test the ability of openGL to
show intermediate steps in a simulation on the Mac. The
attached script accomplishes this in a very narrow manner by
placing the desired simulation directly into the verb
sys_timer and changing xx in wd 'timer xx' to a small
positive integer. You can observe this narrow simulation
ability by loading the script (which is patterned after the
first script in the openGL Lab) and executing run'' . If you
look closely you will see the background color of the
control change colors quickly (5 times).

        But using run'' is too limited because run'' ITSELF
defines sys_timer_z_ to be "gspaint" which in turn defines
"paint" which really does the drawing. I need a verb like
"go" which does NOT define "paint" to produce a change in
the control. I need the verb like "go" to be able to be part
of a string of immediate executions verbs like "go[go[go''"
which in this example results in 3 "go" changes in the
drawing. The verb "go" supplied in the script does nothing
currently except change focus from the .ijs window to the
control, but is included to be suggestive of what I think it
should look like.

        If you think you have seen this question before, you
have. I was trying to do the same thing with J504 but no
solution was forthcoming and I am hoping J6 has a solution.

Thanks.

(B=)

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/

NB. sys_timer.ijs for J601
NB. patterned after:
NB. system\examples\graphics\opengl\lab\ogl1.ijs

clear''     NB. clear base locale
require 'opengl gl2 gl3'
coinsert 'jgl2 jgl3'

RUNDELAY =: 1

GL3LAB=: 0 : 0
pc gl3lab closeok;
xywh 0 0 100 100;cc g isigraph rightmove bottommove;
pas 0 0;
rem form end;
)

run=: 3 : 0
  wd GL3LAB
  ogl=: ''conew'jzopengl'
  wd'pshow;'
  COUNT =: 5
  HWNDC=: wd 'qhwndc g'
  HW   =: glqwh''
  sys_timer_z_=: gspaint
  wd 'timer ',":RUNDELAY
)

go =: 3 : 0
  alloc__ogl HW
  CLEARCOLOR =. ?4#2
  glClearColor CLEARCOLOR
  glClear GL_COLOR_BUFFER_BIT
  glOrtho _1 1 _1 1 _1 1
  glColor3d 0 0 0
  glBegin GL_POLYGON
  glVertex 1  ,0  ,0,1
  glVertex 0  ,0.5  ,0,1
  glVertex _1 ,0  ,0,1
  glEnd ''
  draw__ogl''
  wd'pshow;'
)

paint=: 3 : 0
  if. COUNT do.
    smoutput COUNT =: <:COUNT
    alloc__ogl wh=. glqwh''
    CLEARCOLOR =. ,&0?3#0
    glClearColor CLEARCOLOR
    glClear GL_COLOR_BUFFER_BIT
    glOrtho _1 1 _1 1 _1 1
    glColor3d 0 0 0
    glBegin GL_POLYGON
    glVertex 1  ,0  ,0,1
    glVertex 0  ,1  ,0,1
    glVertex _1 ,0  ,0,1
    glEnd ''
    draw__ogl''
  else.
    wd 'timer 0'
    4!:55 <'sys_timer_z_'
  end.
)

gspaint=: 3 : 0
  glsel HWNDC
  NB. glClear GL_COLOR_BUFFER_BIT  +GL_DEPTH_BUFFER_BIT
  paint''
  glpaint''
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to