From J Wiki
Jump to: navigation, search
J6/OpenGL  | Class  | API  | Utils   Movement   Viewing


The jzopengl class is the essential class for OpenGL, and the jzopenglutil class has additional utilities. Load both and coinsert the jzopenglutil class with:

load 'opengl'
coinsert 'jzopenglutil'


Form create and run, see Class:

WGL=: 0 : 0
pc wgl;
xywh 0 0 200 150;cc g isigraph opengl rightmove bottommove;
pas 0 0;
rem form end;

wgl_run=: 3 : 0
wd WGL
ogl=: ''conew'jzopengl'

An isigraph control is drawn in its paint event handler. When using the OpenGL utilities, this must begin with gsinit, and end with gsfini. In between these are the graphics definitions, in this case to draw a dodecahedron.

wgl_g_paint=: 3 : 0
gsinit ''
gsfini ''

Handle standard movement keys, see Movement:

wgl_g_char=: gschar      NB. standard character event handling
wgl_default=: gsdefault  NB. standard handlers for the function keys.


All nouns in class jzopenglutil have names beginning GS_, for example:

GS_AXISCOLOR        axis color
GS_CLEARCOLOR       clear color
GS_COLOR            color

For a complete list, see script defs.ijs.


All verbs in class jzopenglutil have names beginning gs, for example:

gsdrawaxes color                    draw axes
gsdrawlines vertices;size;color     draw lines
gsdrawpolygon points;normal;color   draw polygon
gsdrawtubes vertices;size;color     draw tubes

For a complete list, see source in glutil scripts.