User Manual, Version 1.3.0

LIBRARY FUNCTION DESCRIPTIONS
Sub-Program Name Description
Device Routines
vinit(device) Initialise device
vexit() Reset window/terminal (must be last routine called)
voutput(path) Redirect output from *next* vinit to file
vnewdev(device) Reinitialize to use new device without changing
vgetdev(device) Get name of current device
pushdev(device) push current device onto a stack
popdev(device) pop device from stack created by pushdev.
getdepth() Return number of bit planes (color planes)
Routines For Setting Up Windows
prefposition(x, y)Specify preferred position of window
prefsize(width, height)Specify preferred width and height of window
Clipping Routines
clipping(onoff)Turn clipping on or off
Color Routines
clear()Clears screen to current color
color(col) Set current color
mapcolor(indx, red, green, blue) Set color map index
Interactive Routines
getkey()Return ASCII ordinal of next key typed
checkkey()Returns zero if no key is pressed or ASCII ordinal
getstring(bcol, string)Read in a string, echoing it in current font
locator(xaddr, yaddr)Find out where cursor is
slocator(xaddr, yaddr)Find out where cursor is in screen coordinates
Flushing
vsetflush(yesno) Set global flushing status
vflush() Call device flush or syncronisation routine
Viewport Routines
viewport(left, right, bottom, top) Specify which part of screen to draw in
pushviewport()Save current viewport
popviewport()Retrieve last viewport
getviewport(left, right, bottom, top)Returns limits of current viewport in screen coordinates
Getting the aspect details
getaspect() Returns the ratio height over width of the display device.
getfactors(wfact, hfact) Returns width over min(width of device, height of device) and height over min(width of device, height of device).
getdisplaysize(w, h) Returns width and height of device in pixels
Attribute Stack Routines
pushattributes() Save the current attributes on the attribute stack.
popattributes() Restore attributes to what they were at last pushattributes().
Projection Routines
ortho(left, right, bottom, top, near, far) Define x,y,z clipping planes.
ortho2(left, right, bottom, top) Define x and y clipping planes.
perspective(fov, aspect, near, far) Specify perspective viewing pyramid
window(left, right, bot, top, near, far) Specify a perspective viewing pyramid
Matrix Stack Routines
pushmatrix() Save the current transformation matrix on the matrix stack.
popmatrix() Reinstall the last matrix pushed
Viewpoint Routines
polarview(dist, azim, inc, twist) Specify the viewer's position in polar coordinates
up(x, y, z) Specify the world up.
lookat(vx, vy, vz, px, py, pz, twist) Specify the viewer's position
Move Routines
move(x, y, z) Move current graphics position to (x, y, z)
rmove(deltax, deltay, deltaz) Relative move
move2(x, y) Move graphics position to point (x, y)
rmove2(deltax, deltay) Relative move in world units.
smove2(x, y) Move current graphics position in screen coordinates (-1.0 to 1.0).
rsmove2(deltax, deltay) Relative move in screen units (-1.0 to 1.0).
LineStyle Routines
linewidth() set line width in rasters
dashcode() set dash pattern length
linestyle() set the line dash pattern
Draw Routines
draw(x, y, z) Draw from current graphics position to (x, y, z)
rdraw(deltax, deltay, deltaz) Relative draw
draw2(x, y) Draw from current graphics position to point (x, y)
rdraw2(deltax,deltay) Relative draw
sdraw2(x, y) Draw in screen coordinates (-1.0 to 1.0).
rsdraw2(deltax, deltay) Relative draw in screen units (-1.0 to 1.0).
Arcs and Circles
circleprecision(nsegs) Set number of line segments in a circle. Default is 32.
arc(x, y, radius, startang, endang) Draw an arc in world units.
sector(x, y, radius, startang, endang) Draw a sector. Note: sectors are polygons.
circle(x, y, radius) Draw a circle. Note: circles are polygons.
Curve Routines
curvebasis(basis) Define a basis matrix for a curve.
curveprecision(nsegs) Define number of line segments used to draw a curve.
rcurve(geom) Draw a rational curve.
curve(geom) Draw a curve.
curven(n, geom) Draw n - 3 overlapping curve segments. Note: n must be at least 4.
Rectangles and General Polygon Routines
rect(x1, y1, x2, y2) Draw a rectangle.
polyfill(onoff) Set the polygon fill flag
polyhatch(onoff) Set the polygon hatch flag
hatchang(angle) Set the angle of the hatch lines.
hatchpitch(pitch) Set the distance between hatch lines.
poly2(n, points) Construct an (x, y) polygon from an array of points
poly(n, points) Construct a polygon from an array of points
makepoly() opens polygon constructed by a series of move-draws and closed by closepoly
closepoly() Terminates a polygon opened by makepoly.
backface(onoff) Turns on culling of backfacing polygons.
backfacedir(clockwise) Sets backfacing direction to clockwise or anti-clockwise
Text Routines
font(fontname) Set the current font
numchars() Return number of characters in the current SOFTWARE font.
textsize(width, height) Set maximum size of a character in the current SOFTWARE font.
textang(ang) Set the SOFTWARE text angle.
fixedwidth(onoff) Turns fixedwidth mode on or off for SOFTWARE fonts.
centertext(onoff) Turns centertext mode on or off for SOFTWARE fonts.
getcharsize(c, width, height) Get the width and height of a character.
getfontdec() Return size of maximum font descender
getfontsize(width, height) Get maximum width and height of a character in a font.
drawchar(c) Draw the character c and update current position.
drawstr(str) Draw the text in string at the current position.
strlength(str) Return the length of the string s
boxtext(x, y, l, h, s) Draw the SOFTWARE string s so that it fits in the imaginary box
boxfit(x, y, l, h, s) resize the SOFTWARE text size so it fits in a box
textjustify(val) general text justification (C only)
leftjustify() left justify text
rightjustify() right justify text
xcentertext() center text in the X direction
topjustify() top justify text
bottomjustify() bottom justify text
ycentertext() center text in the Y direction
textslant() Defines the obliqness of the fonts.
textweight() Defines the weight of the fonts.
Transformations Routines
translate(x, y, z) Set up a translation.
scale(x, y, z) Set up scaling factors in x, y, and z axis.
rotate(angle, axis) Set up a rotation in axis axis where axis is one of 'x','y', or 'z'.
Patch Routines
patchbasis(tbasis, ubasis) Define the t and u basis matrices of a patch.
patchprecision(tseg, useg) Set minimum number of line segments making up curves in a patch.
patchcurves(nt, nu) Set the number of curves making up a patch.
rpatch(gx, gy, gz, gw) Draws a rational patch in the current basis, according to the geometry matrices gx, gy, gz, and gw.
patch(gx, gy, gz) Draws a patch in the current basis, according to the geometry matrices gx, gy, and gz.
Point Routines
point(x, y, z) Draw a point at x, y, z
point2(x, y) Draw a point at x, y.
Object Routines
makeobj(n) Commence the object number n.
closeobj() Close the current object.
genobj() Returns a unique object identifier.
getopenobj() Return the number of the current object.
callobj(n) Draw object number n.
isobj(n) Returns non-zero if there is an object of number n.
delobj(n) Delete the object number n.
loadobj(n, filename) Load the object in the file filename as object number n.
saveobj(n, filename) Save object number n into file filename. Does NOT save objects called inside object n.
Double Buffering
backbuffer() Draw in the backbuffer. Returns -1 if the device is not up to it.
frontbuffer() Draw in the front buffer. This will always work.
swapbuffers() Swap the front and back buffers.
Position Routines
getgp(x, y, z) Gets the current graphics position
getgp2(x, y) Gets the current graphics position
sgetgp2(x, y) Gets the current screen graphics position in screen coords (-1 to 1)