That's what I needed. My corrected script is
attached. I am very surprised that a separate part is
required for each turtle head and turtle nose.
Thank you.
On Thu, 2 Mar 2006, Miller, Raul D wrote:
+
+ Those are LNose and LHead. To work around the
+ problem add
+ LISTS=: LISTS-.LNose, LHead
+ before glaSwapBuffers at the bottom of run''
+
+ --
+ Raul
+ ----------------------------------------------------------------------
+ For information about J forums see http://www.jsoftware.com/forums.htm
+
(B=) <----------my "sig"
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. turtledebug.ijs
NB. standalone verseion
require 'opengl trig'
coinsert 'jgl3 jzopengl '
load 'trig'
turtle0 =: monad define
glPushMatrix ''
NB. glPushAttrib GL_CURRENT_COLOR
glEnable GL_NORMALIZE
glColor 1 0 0 1
glTranslate _1 0 0
glRotate ROTturtle
glScale SCALE * SIZE
glClipPlane GL_CLIP_PLANE0, 0 0 1 0
glEnable GL_CLIP_PLANE0
gluSphere LQuad, 1 30 30
glCallList LHead0
glDisable GL_CLIP_PLANE0
NB. glPopAttrib ''
glPopMatrix ''
)
turtle1 =: monad define
glPushMatrix ''
NB. glPushAttrib GL_CURRENT_COLOR
glEnable GL_NORMALIZE
glColor 0 0 1 1
glTranslate 1 0 0
glRotate ROTturtle
glScale SCALE * SIZE
glClipPlane GL_CLIP_PLANE0, 0 0 1 0
glEnable GL_CLIP_PLANE0
gluSphere LQuad, 1 30 30
glCallList LHead1
glDisable GL_CLIP_PLANE0
NB. glPopAttrib ''
glPopMatrix ''
)
turtlehead =: monad define
glPushMatrix ''
glPushAttrib GL_CURRENT_COLOR
glTranslate 0 1 0
glColor HCOLOR
gluSphere LQuad, TURTLE_HEAD_RELATIVE , 30 30
glCallList ".'LNose',":y.
glPopAttrib ''
glPopMatrix ''
)
turtlenose =: monad define
glPushMatrix ''
glPushAttrib GL_CURRENT_COLOR
glTranslate 0 0.25 0
glColor NCOLOR
gluSphere LQuad, TURTLE_HEAD_RELATIVE , 30 30
glPopAttrib ''
glPopMatrix ''
)
ROTturtle =: 30 0 0 1
SIZE =: 0.2 NB. turtle body size relative to 1
SCALE =: 1 2 0.5 NB. turtle elliptical rescale
TURTLE_HEAD_RELATIVE =: 0.3 NB. head size relative to body
PARTS =: i. 0
PARTSSTART =: 2000
run =: verb define
gldefault''
glinit''
stdlistlight''
LQuad =: gluNewQuadric''
gluQuadricDrawStyle LQuad,GLU_FILL
gluQuadricNormals LQuad,GLU_SMOOTH
genlist 'LTurtle0 LTurtle1'
genpartslist 'LHead0 LNose0 LHead1 LNose1'
NCOLOR =: 0 1 0 1
HCOLOR =: 1 0 1 1
turtlenose makelist LNose0 ''
turtlehead makelist LHead0 0
turtle0 makelist LTurtle0''
HCOLOR =: 0 1 0 1
NCOLOR =: 1 0 1 1
turtlenose makelist LNose1 ''
turtlehead makelist LHead1 1
turtle1 makelist LTurtle1''
glaSwapBuffers ''
glpaintx''
)
NB. patterned after genlist in jzopengl
genpartslist=: 3 : 0
bgn=. >:>./PARTS,PARTSSTART
if. 2 = 3!:0 y. do.
nms=. ;: y.
r=. bgn + i.#nms
(nms)=: r
else.
r=. bgn + i.y.
end.
PARTS=: PARTS,r
r
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm