I am having trouble drawing polygons with opengl.
The example attached shows some of the problem. The 2
polygons should be rectangles and are not. But worse still,
if I change the order of the 2 polygons in the "glBegin
GL_POLYGON ... glEnd''" brackets, the drawing changes. (Btw,
I thought perhaps the fractional figures might be the
problem, but inserting <. between * and _3 gives similar
results.)
paint =: 3 : 0
gsinit GS_LIGHT
gscolor BLUE
glBegin GL_POLYGON
glVertex 0.005 * _3[\ 0 _108 36.67 72 _108 36.67 72 _180 39 0 _180 39 NB.
trunk
glVertex 0.005 * _3[\ 0 0 29 72 0 29 72 _72 32.33 0 _72 32.33 NB. hood
glEnd''
gsfini''
Again I am using the glviews.ijs script with only
the XX placeholder replaced with paint verb above.
I would appreciate if someone could at least verify
the same error occurs for them.
(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. The whole script follows.*******
NB. Beware of the two wrapped glVertex lines************
NB. Standalone version of the opengl demo.
require 'opengl'
cocurrent 'gldemo'
coinsert 'jzopenglutil'
OPENGL=: 0 : 0
pc opengl closeok;
xywh 0 0 200 150;cc g isigraph rightmove bottommove;
pas 0 0;
rem form end;
)
opengl_run=: 3 : 0
wd OPENGL
ogl=: ''conew'jzopengl'
opengl_g_paint''
wd'pshow;'
)
opengl_close=: 3 : 0
destroy__ogl''
wd 'pclose'
)
opengl_cancel=: opengl_close
NB.
=========================================================
paint =: 3 : 0
gsinit GS_LIGHT
gscolor BLUE
glBegin GL_POLYGON
glVertex 0.005 * _3[\ 0 _108 36.67 72 _108 36.67 72 _180
39 0 _180 39 NB. trunk
glVertex 0.005 * _3[\ 0 0 29 72 0 29 72 _72 32.33 0
_72 32.33 NB. hood
glEnd''
gsfini''
)
NB.
=========================================================
opengl_g_paint=: paint
opengl_g_char=: gschar
opengl_default=: gsdefault
NB.
=========================================================
opengl_run''
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm