Lua logo

What is Doris?

Doris is a script driven OpenGL viewer. The script language used is Lua. It is a powerful, fast, portable language, great for embedding in applications. A binding is provided for Lua to OpenGL, GLUT and GLUI so that graphical scripts can be written. The GLUI widget library provides a nice set of OpenGL implemented widgets for use from Lua. The whole thing is designed to be portable and easy to use. See the References further down this page for more details and links.

Doris started as an experiment for binding code to Lua. I wanted a nice graphical tool to try some graphical experiments and wanted to write it in script rather than C/C++. It might be useful as graphical example viewer e.g. for learning OpenGL and 3D graphics. There are some example scripts in source code, some are shown below.


Click the pictures to see an enlarged view and the Lua source script that generated it.

Simple example script) Generating a hierarchy in OpenGL

Using lights Drawing patterns


Example script

The following is an example script in Lua. The screenshot is shown above. Lua has a very versatile table format which is used to specify the GUI. The GLUI widget library has a wrapper around it so that tables can be used to easily define widgets. OpenGL functions can be called directly.

-- Simple example

-- create a matrix
rotatemat = Matrix:new()

-- The callback function which renders our scene.
function renderScene()
   -- Clear the screen and depth buffer
   -- Tell the camera/eye what to look at
   gluLookAt(0,0,10, 0,0,0, 0,1,0)
   -- Draw the scene.

-- Create our window and specify a name and window rendering function
wmain = Window:create{
   title = "Doris: Simple example",
   render = renderScene -- specify the redraw function for this window

-- Put a sub window at the bottom of the screen
sw=SubWindow{ parent=wmain, side="bottom" }

-- Add an object rotator to the bottom of the screen that
-- manipulates the matrix we created.
         parent=sw, -- parent of this widget
         text="Rotate scene", -- text label for this widget
         value=rotatemat, -- matrix that rotator manipulates
         line="|", -- vertical spacing line drawn
         spin=0.99 -- allow the rotator to spin with little damping when released

Who was Doris?

Doris was my sisters hamster, which sadly has passed away to the big hamster wheel in the sky. I couldn't be bothered to think of an acronym :-) Warning: Do not stare at the dancing hamsters too long, they are completely hypnotic!!

Hamster powered Sourceforge logo Lua logo logo_jp1_htmlkit.gif (1K) Hamster powered

Copyright (c) Nick Trout 2002.