A newer version of Max is available. Click here to access the latest version of the Max documentation

jit.gl.lua OpenGL GLU Bindings

jit.gl.lua OpenGL GLU Bindings

The GLU (openGL Utility) bindings are located in the opengl.glu module. It is a sub-module of opengl module. To access them, use Lua's built-in require function as follows:

local glu = require("opengl.glu")

For the standard OpenGL bindings, see the jit.gl.lua OpenGL Bindings.

LookAt(eye, center, up)

Define a viewing transformation

OpenGL Documentation: gluLookAt

If LookAt has nine arguments, it expects unpacked vectors. Otherwise, it will look for 3 vectors as arguments.

  • eye Specifies the position of the eye point.
  • center Specifies the position of the reference point.
  • up Specifies the direction of the up vector.

Ortho2D(left, right, bottom, up)

Define a 2D orthographic projection matrix

OpenGL Documentation: gluOrtho2D

  • left Specify the coordinates for the left vertical clipping planes.
  • right Specify the coordinates for the right vertical clipping planes.
  • bottom Specify the coordinates for the bottom horizontal clipping planes.
  • up Specify the coordinates for the up horizontal clipping planes.

Perspective(fovy, aspect, near, far)

Set up a perspective projection matrix

OpenGL Documentation: gluPerspective

  • fovy Specifies the field of view angle, in degrees, in the y direction.
  • aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
  • near Specifies the distance from the viewer to the near clipping plane (always positive).
  • far Specifies the distance from the viewer to the far clipping plane (always positive).

Project(...)

Map object coordinates to window coordinates

OpenGL Documentation: gluProject

  • ... Specify the object coordinates as either a table or unpacked values.

UnProject(...)

Map window coordinates to object coordinates

OpenGL Documentation: gluUnProject

  • ... Specify the window coordinates as either a table or unpacked values.

See Also

Name Description
Working with OpenGL Working with OpenGL
Lua in Max Lua in Max