J6/OpenGL/API

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

The interface to OpenGL is defined in script ~system/main/gl3.ijs. This is loaded automatically with load 'jzopengl', and populates the jgl3 locale.

The gl3.ijs script defines standard OpenGL properties and methods. Most verb definitions are straight covers for the underlying OpenGL methods. Nouns have names prefixed GL_, and straight cover verbs have names prefixed gl (main verbs) or glu (utility verbs).

For example:

GL_2D=: 16b0600
GL_2_BYTES=: 16b1407
GL_3D=: 16b0601
...

glAccum=: 'opengl32.dll glAccum > n i f' & (15!:0)
glAlphaFunc=: 'opengl32.dll glAlphaFunc > n i f' & (15!:0)
glAreTexturesResident=: 'opengl32.dll glAreTexturesResident > c i *i *c' & (15!:0)
...

There are additional verbs that provide covers where arguments are not simply lists of scalars. These have names prefixed gla, for example:

glaBitmap=: 3 : 'glBitmap (;/>0{y),1{y'                  NB. cover for glBitmap
glaDrawPixels=: 3 : 'glDrawPixels (;/>0{y),1{y'          NB. cover for glDrawPixels
gluaPickMatrix=: 3 : 'gluPickMatrix (;/4{.y),<4{.4}.y'   NB. cover for gluPickMatrix