With your help I think I have a solution to the
problem. The solution is more complicated than I ever
imagined and frankly I had to stumble upon much of it. The
bulk of the added code comes from the top of gsinit which is
surprising because gsinit is the next command in paint.

        Thanks Raul and Eric.

(B=)

NB. the system can be exercise with the following
NB. paint [ makedodec 1 0 0
NB. and you should be able to resize the openglut window, too

******* revised code follows
NB. oglanimate.ijs
NB. 6/3/6

NB. system\examples\graphics\opengl\lab\oglut1.ijs

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

OPENGLUT=: 0 : 0
  pc openglut closeok;
  xywh 0 0 200 150;cc g isigraph opengl rightmove bottommove;
  pas 0 0;
  rem form end;
)

openglut_run=: 3 : 0
if. wdisparent 'openglut'do.
  wd'psel openglut;pactive'
  wh__ogl=: ''
  makedodec 0 0 0
  openglut_g_paint''
else.
  wd OPENGLUT
  wdmove _1 0
  ogl=: ''conew'jzopengl'
  gsinit ''
  makedodec 0 0 0  NB. cannot be moved above gsinit'' *****
  glCallList DODEC
  gsfini ''
  wd'pshow;'
end.
)

openglut_close=: 3 : 0
destroy__ogl''
wd 'pclose'
)

openglut_cancel=: openglut_close

NB. =========================================================
paint=: 3 : 0

NB. extra code follows *************
  if. -.wh__ogl-:glqwh'' do.
    wh__ogl=:glqwh''
    alloc__ogl wh__ogl
    hwnd__ogl=: {.glqhandles''
    glEnable GL_DEPTH_TEST
    glViewport 0 0,wh__ogl
    glMatrixMode GL_PROJECTION
    glLoadIdentity''
    gluPerspective (%/wh__ogl) 1 } GS_PERSPECTIVE

    makedodec 0 0 0
  end.
NB. extra code above *************

  gsinit ''
  glCallList DODEC
  gsfini ''
)

DODEC =: 1

makedodec =: 3 : 0
  TRANSLATE =: y
  draw makelist DODEC ''
  i. 0 0
)

draw =: 3 : 0
  glTranslate TRANSLATE
  gsdrawdodecahedron''
)

openglut_g_paint=: paint
openglut_g_char=: gschar
openglut_default=: gsdefault

NB. =========================================================
openglut_run''
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to