gl3 commands are for 3D (OpenGL) drawing in an isigraph control. Script system\main\gl3.ijs defines gl3 verbs.
load 'gl3' NB. defines verbs such as: glAccum=:11!:3001
The syntax of most OpenGL verbs should be clear from standard OpenGL API documentation, even though that documentation is oriented towards C programmers.
You are encouraged to start learning OpenGL programming with the OpenGL Introduction lab from the Studio|Labsl menu command.
This section documents the gla... commands that are not part of the OpenGL specification or where the syntax needs clarification. The gla... commands are concerned with how OpenGL fits into J or with Windows extensions.
Most 2D commands do not work in a 3D isigraph control. The following are the commands that do work: glshow, glshowx, glpaint, glpaintx, glqwh, glcapture.
OpenGL Printing shows how to print 3D images.
gl3 commands
glaFont fontspec - font for glaUseFontBitmaps and glaUseFontOutlines
glaGetErrors '' - return recent errors reported by Quadric, Nurbs, and Tess error callbacks. The error callbacks must be enabled with the appropriate gluQuadricCallback, gluNurbsCallback, or gluTessCallback.
glaRC '' - create OpenGL render context for drawing on an isigraph window. This must be run before pcenter, pmove, or any other posiitioning is done.
Fails if:
control is in use by 2D graphics
unable to initialize the OpenGL dlls (opengl32.dll and glu32.dll)
control missing ws_clipchildren and
ws_clipsiblings styles
glaRC type w h - create OpenGL render context for drawing on a bitmap: type must be 1. w h give width and height of a 24bit color bitmap.
A bitmap RC is associated with an isigraph window but doesn't display anything in the window so normally this window should be hidden.
If the window is hidden, the form_isigraph_size
and form_isigraph_paint
handlers are not automatically called and they must be called explicitly.
The size handler for a bitmap RC should not use the window size (glqwh''
) for setting the viewport. It should use the width and height used to create the bitmap in glaRC
.
glaSaveBMP filename - save bitmap of an isigraph control with a bitmap RC. If the filename is '' , the bitmap is saved to the clipboard.
glaSwapBuffers '' - the front-buffer is the one displayed on the screen. Drawing is done into the back-buffer. A glaSwapBuffers makes the back-buffer the front-buffer.
glaUseFontBitmaps 0 first count listbase - create display lists based on glaFont. A display list is created for count characters starting at first. The display list numbers start at listbase.
glaUseFontOutlines 0 first count listbase deviation extrusion format - create display lists for drawing 3D characters based on glaFont.
first - first of the set of characters
count - number of characters used to create display lists
listbase - starting display list
deviation - maximum chordal deviation from the original outlines. When deviation is zero, the chordal deviation is equivalent to one design unit of the original font. The value must be equal to or greater than 0.
extrusion - how much a font is extruded in the negative z direction. The value must be equal to or greater than 0.
format - WGL_FONT_LINES or WGL_FONT_POLYGONS
Returns a matrix with a row for each character. The row contains:
BlackBoxX - black box (smallest rectangle that contains the glyph) width
BlackBoxY - black box height
OriginX - black box upper-left x coordinate
OriginY - black box upper-left y coordinate
IncX - horizontal distance from current cell origin to the next cell
IncY - vertical distance from current cell origin to the next cell
glBitmap - argument is boxed list where the last argument is the data argument
glDrawPixels - argument is boxed list where the last argument is the data argument
glCallLists integer_data
glCallLists character_data
glClearColor R G B [A] - sets clear color red, green, blue, alpha. If A is elided, it is set to 1.
glColor R G B [ A ] - sets color red, green, blue, alpha. If A is elided it is set to 1.
glFeedbackBuffer integer type - feedback buffer size in floating values. This command is only allowed once. This avoids potential crashes with the buffer being changed at the wrong time.
glGetError '' - return OpenGL error flags (there may be more than one). gluErrorString returns a string for an error number.
glPixelStore - GL_UNPACK_ALIGNMENT and GL_PACK_ALIGNMENT are the only pname arguments supported.
glSelectBuffer size - select buffer size in integers. This command is only allowed once. This avoids potential crashes with the buffer being changed at the wrong time.
The result data from the select buffer is recorded for commands done after a glRenderMode GL_SELECT. The result buffer is returned as the result of a glRenderMode any_other_mode. OpenGL defines the select buffer as returning minimum and maximum z values as unsigned integers.
unsigned int value - J signed int value
0 - smallest negative int
max 32 bit unsigned int - largest positive int
To convert the J signed integer range to a float range from 0 and up, add 2^32 to the negative integers.
glTexImage1d - argument is boxed list where the last argument is the data argument
glTexImage2d - argument is boxed list where the last argument is the data argument
glVertex X Y [ Z [ W ] ] - sets vertex coordinates. If W (rarely used scaling value) is elided it is set to 1. If Z is elided it set to 0.
gluBuild1dMipmaps - argument is boxed list where the last argument is the data argument
gluBuild2dMipmaps - argument is boxed list where the last argument is the data argument
gluPwlCurve nurb type data - count and stride parameters are fixed based on type and length of data.
gluNurbsCurve nurb uknots udata ustride uorder type data
gluNurbsCurve nurb uk ud vk vd ustride vstride uorder type data
gluScaleImage - argument is boxed list where the last argument is the data argument