Doris

simple.lua

This is a very simple example which just creates a window and adds a rotator with which you can spin the scene around.

Screenshot

simple.lua screenshot

Source Code


-- Simple example
-- $Id: simple.lua,v 1.7 2002/06/24 07:06:31 trout Exp $

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

-- The callback function which renders our scene.
function renderScene()
  -- Clear the screen and depth buffer
  glClear(GL_DEPTH_BUFFER_BIT + GL_COLOR_BUFFER_BIT)
  
  -- Tell the camera/eye what to look at
  gluLookAt(0,0,10, 0,0,0, 0,1,0)
  glMatrixMode(GL_MODELVIEW)
  
  -- Draw the scene.
  glPushMatrix()
    glLoadMatrix(rotatemat)
    glutWireCube(5)
    Render:teapot{}
  glPopMatrix()
end

-- 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.
ro=Rotator{
        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
}



Back