The mechanism to effectively use lists is there, i.e. to define
lists only at initialization and reuse at each frame.
Because I remember we discussed it, and there was a
different mechanism before.

The pattern of list reuse is such 
(see Teapot, all Knots and Surfaces examples)

paint=: 3 : 0
  if. gsinit <args> do.
    ...
    gsnewlist L1
      ...
    gsendlist''
  end.
  glaCallList L1
  ...
)

Some samples in OpenGL demo could still be improved.

 - "Basic/OpenGL Graphics" (TrueType) 9.5 vs 60 fps

   if. gsinit GS_LIGHT do.
     ('arial';80;700;1) glaUseFontOutlines__ogl 32 95 32 0 0.3,WGL_FONT_POLYGONS
   end.

 - "Surface/Intersection" 12 vs 20 fps
   if. gsinit GS_LIGHT do.
     gsnewlist 1
     drawS1 ''
     drawS2 ''
     gsendlist''
   end.
   glaCallLists 1


--- Brian Schott <[EMAIL PROTECTED]> wrote:

>       The jzopenglutil.ijs script is very useful but I
> have been unable to find or produce an example which makes
> effective use of call lists. By effective use I mean that a
> call list (actually, more than one, too) can be created only
> one initial time and then used as needed in the verb paint.
> In contrast, the opengl Lab demonstrates this effectively in
> its use of the *conditionally executed* verb g_draw_init
> taken from the script ogl_cubes.ijs shown next. (But I have
> not been successful in combining the Lab example with the
> Demo examples.)
> 
> g_draw_init=: 3 : 0
> drawbox ''          NB. create list that draws a box
> glViewport 0 0,y
> glMatrixMode GL_PROJECTION
> glLoadIdentity''
> gluPerspective 30, (%/y),1 10
> )
> 
>       ogl_cubes.ijs executes g_draw_init only
> conditionally in gl3lab_g_paint as shown next.
> 
> gl3lab_g_paint=: 3 : 0
> smoutput 'paint'
> if. rc__ogl'' do. g_draw_init wh__ogl end.
> g_draw''
> show__ogl''
> )
> 
>       ogl_cubes.ijs accomplishes this feat by NOT calling
> paint in gl3lab_run, while all the jzopenglutil examples
> built around glviews.ijs DO call paint from opengl_run.
> 
> opengl_run=: 3 : 0
> wd OPENGL
> ogl=: ''conew'jzopengl'
> opengl_g_paint''
> wd'pshow;'
> )
> 
>       The opengl Lab examples seem to get around this
> problem by including the verb gl3lab in the PREPARE section
> of opengl.ijt as shown next. So, in the Lab, the verb gl3lab
> calls paint the first time, not the verb gl3lab_run.
> 
> gl3lab=: 3 : 0
> if. 1<+/(<'gl3lab')=<;._2 wd'qp' do.
>  while. +/(<'gl3lab')=<;._2 wd'qp' do.
>   wd'psel gl3lab;pclose' NB. close all if more than 1
>  end.
> end.
> try.
>  wd'psel gl3lab;pshow;pactive'
>  free__ogl''      NB. force new rc
>  gl3lab_g_paint'' NB. new drawing
> catch.
>  gl3lab_run''
> end.
> i.0 0
> )
> 
>       In contrast consider the script
> j601/system/examples/graphics/opengl/demo/basic5.ijs which
> contains the paint verb below, which creates the call list
> CYLINDERS *every time* paint is executed (in drawcylinders).
> 
> paint=: 3 : 0
> gsinit GS_LIGHT,GS_BLEND
> drawcylinders ''
> gsfini''
> )
> 
>       I have attempted to alter the paint verb in
> basic5.ijs to *only conditionally* execute drawcylinders as
> follows. But when I do so, the cylinders are all redrawn in
> their original orientation even after I have used arrow keys
> to reorient the graphics image.
> 
> glaIsList=:  a.&[EMAIL PROTECTED]
> paint=: 3 : 0
> gsinit GS_LIGHT,GS_BLEND
> if. -. glaIsList CYLINDERS do. drawcylinders '' end.
> gsfini''
> )
> 
>       I would like to be shown an example of this
> effective use of call lists in the context of
> jzopenglutil.ijs such as in the script basic5.ijs.
> 
> Thank you.
> 
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to