jit.gl.lua Reference

Script OpenGL and Jitter with Lua.

jit.gl.lua

Description

jit.gl.lua provides and interface to both OpenGL and Jitter through the Lua scripting language. jit.gl.lua is similar to the js object for JavaScript.

Examples

Discussion

This object requires one argument: the name of a drawing context. A named drawing context is a named instance of a jit.window, jit.pwindow, or jit.matrix object that has an instance of the jit.gl.render object associated with it. Additionally it can reference the name of a jit.gl.node sub-context. This value may also be set via the OB3D drawto attribute. If no argument is present, the object is implicitly added to the first valid drawing context or sub-context found in the current patch or by searching up the patcher hierarchy.

Attributes

args [16 atoms]

any symbols or numbers can be entered that will be assigned to the Lua variable 'args'. args[1] is the first typed-in argument.

autowatch [int]

Enable autowatching of the loaded script file.

file [symbol]

The file to load.

gc [int]

Garbage collection flag.

inlets [int]

The number of inlets.

last_inlet [int]

g/s(get)

With scripts with multiple inlets, this attribute tracks what inlet was last used by an incoming message, enabling scripts to generate different behavior depending on what inlet a message is sent to.

outlets [int]

The number of outlets.

path [symbol]

g/s(get)

The path of the loaded script.

Common Box Attributes

OB3D Attributes

Messages

int

Send an int to the msg_int function.

float

Send an int to the msg_float function.

list

Send an int to the msg_list function.

anything

Call a function with arbitrary arguments.

call

Explicitly call a function with arbitrary arguments.

closebang

When the closebang message is triggered, jit.gl.lua will look for a closebang() function in the currently running Lua script and call it.

(mouse)

Double-click to open Lua editing window

loadbang

When the loadbang message is triggered, jit.gl.lua will look for a loadbang() function in the currently running Lua script and call it.

open

Opens the text window where the object's Lua source file can be edited.

read

Read a Lua script

wclose

Closes the text window where the object's Lua source file is edited.

OB3D Messages

See Also

Name Description
Working with OpenGL Working with OpenGL
Lua in Max Lua in Max
js
jit.gl.sketch
jit.gl.lua Overview jit.gl.lua Overview
jit.gl.lua OpenGL Bindings jit.gl.lua OpenGL Bindings
jit.gl.lua Color Bindings jit.gl.lua Color Bindings
jit.gl.lua Vector Math jit.gl.lua Vector Math