gl2 and gl3 commands have an implicit target isigraph. When the host calls the paint handler the correct isigraph is automatically
selected as the target. If you are going to be switching between windows and calling the paint handler manually then you have to
make sure the isigraph is selected. The easiest way to do this is to get its handle when it is created and then do a glsel handle as
required.
----- Original Message -----
From: "Brian Schott" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, June 10, 2006 8:15 PM
Subject: Re: [Jbeta] J6 changes in openGL (jzopenglutil.ijs) (fwd)
I have been noticing some peculiar behavior in the
JAVA IDE while working on my openGL projects, but no
reproducibles ... until now.
When I load an openGL script (like the script below)
and try to execute commands from a "temp" window like 22.ijs
then I get errors from the verb "paint" when I execute it
with Ctrl+R or Ctrl+E or Ctrl+W in the "temp" window. For
example the following error appears in the ijx window. The
same commands work without error when typed directly into
the ijx window.
makedodec 1 0 0
paint ''
|domain error: glqwh
| -.wh__ogl-: glqwh''
paint [ makedodec 1 0 0
|domain error: glqwh
| -.wh__ogl-: glqwh''
(B=)
---------- Forwarded message ----------
Date: Sat, 10 Jun 2006 01:41:53 -0400 (EDT)
From: Brian Schott <[EMAIL PROTECTED]>
Reply-To: Beta forum <[email protected]>
To: Beta forum <[email protected]>
Subject: Re: [Jbeta] J6 changes in openGL (jzopenglutil.ijs)
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm