OpenGL utility words - Factor Documentation (original) (raw)

OpenGL utility words
Factor handbook » UI framework » Implementing new gadgets » Customizing gadget appearance » Implementing custom drawing logic

Prev: Subclassing worlds
Next: Rendering text

The opengl vocabulary implements some utility words to give OpenGL a more Factor-like feel.

The opengl.gl and opengl.glu vocabularies have the actual OpenGL bindings.
OpenGL binding

Error reporting:

gl-error ( -- )

Wrappers:

gl-color ( color -- )

gl-translate ( point -- )
bind-texture-unit ( id target unit -- )

Combinators:

do-enabled ( what quot -- )

do-attribs ( bits quot -- )
do-matrix ( quot -- )
with-translation ( loc quot -- )
make-dlist ( type quot -- id )

Rendering geometric shapes:

gl-line ( a b -- )

gl-fill-rect ( loc dim -- )
gl-rect ( loc dim -- )