Contents
Document contents :-
CallList
CallList:create(name)
This is a wrapper for GL calllists. This function creates a calllist with
the name specified and open it. Any rendering calls are place in the calllist until
CallList:endList() is called.
Parameters:
- name - Name string of the calllist to create.
Example:
CallList:create("object")
CallList:endList()
This ends a call list creation. This should be called
after you created a new list and have drawn your objects.
Example:
CallList:create("object")
-- draw stuff
CallList:endList()
CallList:draw(name)
This draws a call list created using create()
Parameters:
- name - Name string of the calllist to draw.
Example:
CallList:draw("object")
CallList:delete(name)
This deletes a call list created using create()
Example:
CallList:delete("object")
CallList:clear()
This empties the call list, deleting all items.
Doris
_glErrorCheck(msg)
Check the GL error status glGetError and
report any errors.
Parameters:
- msg - An optional message printed if an error occurs.
Example:
_glErrorCheck("after render")
Render
Render:sphere{params}
Create a gluSphere quadric object. Parameter passed is
a table containing optional parameters.
Parameters:
- radius - Radius of the sphere.
- slices - Number of segments going round the sphere.
- stacks - Number of stacks vertically in the sphere.
- style - Style to draw quadric with:
- point - Draw with point dots.
- line - Draw with lines.
- silhouette - Flat shade.
- fill - Draw filled polygons.
- texture - Add texture coordinates for texturing.
Example:
Render:sphere{ radius=3 }
Render:torus{params}
Create a gluDisk quadric object. Parameter passed is
a table containing optional parameters.
Parameters:
- inner - Inner radius of the torus.
- outer - Outer radius of the torus.
- slices - Number of segments going round the torus.
- loops - Number of loops vertically in the torus.
- style - Style to draw quadric with:
- point - Draw with point dots.
- line - Draw with lines.
- silhouette - Flat shade.
- fill - Draw filled polygons.
- texture - Add texture coordinates for texturing.
Example:
Render:torus{ inner=1,outer=3 }
Render:teapot{params}
Create a glutSolidTeapot quadric object. Parameter passed is
a table containing optional parameters.
Parameters:
- solid - Is the teapot wireframe or solid.
- size - Scale of the teapot.
- texture - Add texture coordinates for texturing.
Example:
Render:teapot{ size=5,solid=1 }
Window
Window
This is a wrapper for Doris window and GLUI code.
This is a collection of helper methods to allow window
creation from Luas nice table format.
Seperators
Seperators add spaces and lines between the widgets.
These can be lines or spaces, horizontally or vertically.
space = "h" | "-" | "v" | "|" inserts a space, and
line = "h" | "-" | "v" | "|" creates a line either
horizontally or vertically. You will have to pick the appropriate
one according to your widget layout. You cannot have a space and
a line.
Example:
{ space="h" } , { line="v" } or { line="|" }
Window:create{params}
Create a window for the application to use.
You must do this first to create a window that can be used by the rest
of the GUI.
Parameters:
t is a table describing the window. Relevent table fields to set are:- title - the window title.
- render - the render callback function. A default value is set for this. You
would not ordinarily override this.
Example:
winmain = Window:Create{ title="My Doris App" }
SubWindow{params}
Create a subwindow with the main window.
Subwindows are what the widgets go into. You must have first created a main
window.
Parameters:
A table containing subwindow parameters:- parent - main window must be specified.
- side - gives the location of the window: top, bottom, left or right.
Example:
sw=SubWindow{ parent=winmain, side="right" }
Checkbox{params}
Creates a Checkbox widget. Check boxes are boolean widgets
that you can tick on and off. The parameters are passed in a table.
eg. Checkbox{ parent=subwindow, text="Solid", value=sphere.solid }
Parameters:
- parent - widget must be specified.
- text - is the text displayed next to the Checkbox.
- value - gives the initial value of the Checkbox, ie. 0 for off, 1 for on.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Button{params}
Create a Button widget.
Buttons are widgets that create an event when you click on them.
Parameters:
A table containing Button parameters:- parent - widget must be specified.
- text - is the text displayed in the Button.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Button{ parent=subwin, text="Click me!" }
Radiobutton{params}
Create a Radiobutton widget.
This type of button goes in a Radiogroup and only one of the buttons in the
group may be on at once. The Radiogroup should be the widget interrogated to
find out which Radiobutton is currently selected.
Parameters:
A Table containing Radiobutton parameters:- parent - Radiogroup widget must be specified.
- text - the text displayed next to the Radiobutton.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
Example:
Radiobutton{ parent=radiogroup1, text="Red" }
Radiogroup{params}
Create a Radiogroup widget.
This is a container widget which holds a group of Radiobutton widgets.
Parameters:
A table containing Radiogroup parameters:- parent - widget must be specified.
- text - the text displayed in the border heading.
- value - sets which one of the Radiobuttons is on initially.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Radiogroup{ parent=subwin, text="Colours:", value=1 }
Text{params}
Create a simple text label.
This widget just displays some text.
Parameters:
At table containing Text parameters:- parent - parent widget of this Text.
- text - the text displayed.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
Example:
Text{ parent=subwin, text="Hello world" }
Edit{params}
Create a text and number editing widget.
The text in the widget can be edited by the user. The values held can either
be a string, an integer number or a float number.
Parameters:
A table containing Edit parameters:- parent - parent widget of this Edit.
- text - the Edit label, or title.
- value - the initial value displayed.
- type - the edit type, ie. "text", "int" or "float". Default is "text".
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Edit{ parent=subwin, value="Hello world", type=text }
Panel{params}
Create a panel widget container.
The is a simple container which can be used to organise widgets
into groups. Once a panel has been created other widgets can be
put into it.
Parameters:
A table containing Panel parameters:- parent - parent widget of this Panel.
- text - the text displayed in panel centre.
- type - the graphical appearence of the panel edge,
ie. "none", "embossed", or "raised". The default is "embossed".
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
Example:
Panel{ parent=subwin, text="Hello world", type="text" }
Spinner{params}
Create a value spinner.
The value in this widget can be edited several ways, ''directly'',
like an Edit widget, using ''up and down'' buttons and by ''dragging''
with the mouse.
Parameters:
A table containing Spinner parameters:- parent - parent widget of this Spinner.
- text - the text label to the spinner.
- value - is the initial value.
- type - the number type. ie. "int" or "float". Default is "int".
- limits - limits={min,max} specifies the range limits of the values allowed,
eg. limits={-10,100}
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Spinner{ parent=subwin, value=12.34, type="float", limits={0,20} }
Listbox{params}
Create a list of choices.
A drop down list or combi box.
Parameters:
A table containing Listbox parameters:- parent - widget of this Listbox.
- text - the Listbox title.
- items - a list of the items in the listbox,
eg. { items={"red","yellow","green"}
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Listbox{ parent=subwin, text="title", items={"a","b","c"} }
Rotator{params}
Create a rotation trackball widget.
This creates a spherical widget which can be used to rotate an object in your scene.
When you rotate the sphere in the widget, the object attached to the Rotator behaves
similarly. The widget is attached to a matrix which it manipulates.
Note: The matrix you attach to the widget must only be used by this widget,
ie. you cannot manipulate the matrix value as its value is set directly by GLUI.
Parameters:
A table containing Rotator parameters:- parent - parent widget of this Rotator.
- text - the Rotator title.
- value - is the Matrix to use (see note above).
- spin - the spin damping factor. 0 for no spin, 1 for no damping.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Rotator{ parent=subwin, text="Scene", value=scene.rotationMatrix }
Translator{params}
Create a translation widget.
This creates a pointer arrow widget which can be used to move objects. When
you click and drag the mouse over the widget, the movement is applied to the matrix
and any object influenced by the matrix.
Note: The matrix you attach to the widget must only be used by this widget,
ie. you cannot manipulate the matrix value as its value is set directly by GLUI.
Parameters:
A table containing Translator parameters:- parent - parent widget of this Translator.
- text - the Translator title.
- value - the Matrix to use (see note above).
- type - sets the constraints of the movement, ie. "xy", "x", "y" or "z". Default is "xy".
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
- update - Call back function called when value changes. See Window:Upate Callbacks.
Example:
Translator{ parent=subwin, text="Scene", type=z, value=scene.transMatrix }
Rollout{params}
Create a rollout container.
This widget is like a Panel except you can open and close it.
Parameters:
A table containing Rollout parameters:- parent - parent widget of this Rollout.
- text - the Rollout title.
- open - sets the initial state of the Rollout, open or closed. Its value
should be 0 or 1.
- line - "|" or "-". See Window:Separators.
- space - "|" or "-". See Window:Separators.
Example:
Rollout{ parent=sw, text="Scene", type=z, value=scene.transMatrix }