Skip to content
trishume edited this page Nov 16, 2011 · 3 revisions

The OpenGL module allows you to render things in 3D, really fast. Currently it only supports very basic operations (no textures.) Also, There is currently no way to get mouse/keyboard input from the OpenGL window. You have to use a small control window.

module pervasive GL
    export all

    fcn NewWin (width, height : int) : boolean
    proc CloseWin ()

    proc Cls ()
    proc Update ()
    
    % 1 is enabled 0 is disabled. Disabled by default
    proc SetLight (enabled : int)

    % pushmatrix and popmatrix manipulate the matrix stack (you don't need to know how to use this.)
    % clearmatrix resets all transforms
    proc PushMatrix ()
    proc PopMatrix ()
    proc ClearMatrix ()

    % transforms. These apply to anything drawn after they are called. These can be changed with the matrix functions.
    proc Scale (x, y, z : real)
    proc Translate (x, y, z : real)
    proc Rotate (angle, x, y, z : real)

    % coordinates go from -1 to 1 on both axes for the default viewport.
    % this means square windows will have distorted coordinates.
    % you can fix this with a scale transform.
    proc DrawLine (x1, y1, z1, x2, y2, z2 : real, r, g, b : int)
    proc DrawFillTriangle (x1, y1, z1, x2, y2, z2, x3, y3, z3 : real, r, g, b : int)
    proc DrawTriangle (x1, y1, z1, x2, y2, z2, x3, y3, z3 : real, r, g, b : int)
end GL

Clone this wiki locally