In using opengl to create graphics for my

        In my turtle graphics systems I have wanted the
user inputs to be typed-in text phrases like early
interactive Logo interpretters. A problem for me has been
that under certain circumstances more than one graphic panel
can exist when I use the handy jzopenglutil.ijs script
(for example if the user does not cancel one panel before
creating another). Using some code in the PREPARE section of
the opengl.ijt lab I have attempted to finesse the
possibility of latent extra panels occurring. The script
below demonstrates that attempt to revise the script
glviews.ijs which is available for standalone versions of
opengl demos.

        I welcome comments.

(B=)


NB. Revised version of
NB.  system/examples/graphics/opengl/demo/glviews.ijs
NB. This revision does not allow the user to
NB.    inadvertently create multiple graphic controls.
NB. However, this revision contains a sample 'paint'
NB.    verb to show how 'paint' must be revised, too.
NB.    (original glviews.ijs does not contain 'paint')
NB. All revisions are near the bottom, beginning
NB.    where the 'opengl' verb is added in the
NB.    section where the unique 'paint' would be placed
NB. Brian Schott 2/24/8

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

require 'opengl'
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.
=========================================================
opengl=: 3 : 0 NB. Brian borrowed 'opengl' from 'gl3lab'
               NB. in opengl.ijt and renamed all 'gl3lab'
               NB. references to 'opengl'
if. 1<+/(<'opengl')=<;._2 wd'qp' do.
 while. +/(<'opengl')=<;._2 wd'qp' do.
  wd'psel opengl;pclose' NB. close all if more than 1
 end.
end.
try.
 wd'psel opengl;pshow;pactive'
 free__ogl''      NB. force new rc
NB.  opengl_g_paint'' NB. new drawing NB. removed by Brian
catch.
 opengl_run''
end.
i.0 0
)

NB. Brian added basic1.ijs 'paint' to glviews.ijs
paint=: 3 : 0
opengl''  NB. Brian added this line to basic1.ijs 'paint'
gsinit''
gsdrawviewbox RED
gsdrawdodecahedron ''
gsfini''
)

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

NB.
=========================================================
opengl_run_gldemo_''      NB. Brian added _gldemo_

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to