Home

Awesome

MoonGLUT: Lua bindings for FreeGLUT

*** This project is discontinued, superseded by MoonGLFW. ***


MoonGLUT is a Lua binding library for FreeGLUT.

It runs on GNU/Linux and on Windows (MSYS2/MinGW) and requires Lua (>=5.3) and FreeGLUT (>=3.0.0).

Authored by: Stefano Trettel

Lua logo

License

MIT/X11 license (same as Lua). See LICENSE.

Documentation

See the Reference Manual.

Getting and installing

Setup the build environment as described here, then:

$ git clone https://github.com/stetre/moonglut
$ cd moonglut
moonglut$ make
moonglut$ make install # or 'sudo make install' (Ubuntu)

Example

-- Script: hello.lua

glut = require("moonglut")

glut.init(arg)
glut.init_context(3, 3, "core")
glut.init_display_mode("rgb", "double", "depth")

glut.init_window_size(400, 300)
glut.init_window_position(200, 200)
glut.create_window("Hello world!");

glut.display_func(function() 
   print ("rendering function")
end)

glut.main_loop()

The script can be executed at the shell prompt with the standard Lua interpreter:

$ lua hello.lua

Other examples can be found in the examples/ directory contained in the release package.

See also