VOGL is a library of C routines which try to allow a programmer to write programs which can be moved to machines which have the Silicon Graphics GL library on them. It is based entirely on the VOGLE graphics library, and as a result can handle circles, curves, arcs, patches, and polygons in a device independent fashion. Simple hidden line removal is also available via polygon backfacing. Access to hardware text and double buffering of drawings depends on the driver. There is also a FORTRAN interface but as it goes through the C routines FORTRAN users are warned that arrays are in row-column order in C. Both the long FORTRAN names and the shortened six character names are supported. People interested in using software text should see the hershey library, HERSHEY(3) .
Some routines are only available in VOGL. If you include them in programs it is advisable to put #ifdef VOGL ... #endif around them. The constant VOGL is defined whenever a VOGL header file is included.
It should be noted that there are a number of routines that take the type Angle for some of their parameters. All angles specified this way are actually Integer Tenths Of Degrees. (Don’t ask!)
There are two include files provided with vogl: vogl.h and vodevice.h. The file vogl.h has the type definitions and function interfaces, ideally it is included where you would include gl.h on an SGI. The file vodevice.h has the devices in it, and it is included where you would include device.h on an SGI. The following is a brief summary of the VOGL subroutines.
For X11 and Sunview based applications, it is posible for VOGL to use a window that is supplied by that application’s toolkit. Under these circumstances, the toolkit is is responsible for handling of all input events, and VOGL simply draws into the supplied window. These calls are only available from C. Also see the directories examples/xt, examples/xview and examples/sunview.
For X based toolkits the following two calls may be used:
vo_xt_window(display, xwin, width, height) Display *display; Window xwin; int width, height;This routine should be called before calling "ginit()".
vo_xt_win_size(width, height) int width, height;
vo_sunview_canvas_size(width, height) int width, height;
Fortran: subroutine vinit(device, len) character *(*) device integer len C: vinit(device); char *device; Note 1 :- Current available devices are: tek - tektronix 4010 and compatibles hpgl - HP Graphics language and compatibles dxy - roland DXY plotter language postscript - postscript devices ppostscript - postscript devices (portrait mode) sun - Sun workstations running sunview X11 - X windows (SUN’s Openwindows etc etc) decX11 - the decstation (old) window manager This is only included in case you need it. apollo - Apollo workstations NeXT - NeXTStep hercules - IBM PC hercules graphics card cga - IBM PC cga graphics card ega - IBM PC ega graphics card vga - IBM PC vga graphics card sigma - IBM PC sigma graphics card. Sun, X11, decX11, apollo, hercules, cga and ega support double buffering. Note 2 :- If device is a NULL or a null string the value of the environment variable "VDEVICE" is taken as the device type to be opened. Note 3 :- after init it is wise to explicitly clear the screen. e.g.: in C color(BLACK); clear(); or in Fortran call color(BLACK) call clear
Fortran: subroutine ginit C: ginit()
Fortran: subroutine winopen(title, len) character*(*) title integer len C: winopen(title) char *title;
Fortran: subroutine gexit C: gexit()
Fortran: subroutine voutput(path, len) character*(*) path integer len C: voutput(path) char *path;
Fortran: subroutine vnewdev(device, len) character *(*) device integer len C: vnewdev(device) char *device;getplanes() Returns the number of bit planes (or color planes) for a particular device. The number of colors displayable by the device is then 2**(nplanes-1)
Fortran: integer function getplanes() C: long getplanes()
- Within a callobj() call. - Within curves and patches. - Within bgn*/end* calls. - When double buffering (the flush is only done withing swapbuffers).There are two user routines (which are NOT GL compatible) that can be used to control flushing.
Fortran: subroutine vsetflush(yesno) logical yesno C: void vsetflush(yesno) int yesno;
Fortran: subroutine vflush C: void vflush();
Fortran: subroutine prefposition(x1, y1, x2, y2) integer x1, y1, x2, y2 C: prefposition(x1, y1, x2, y2) long x1, y1, x2, y2
Fortran: subroutine prefsize(width, height) integer width, height C: prefsize(width, height) long width, height;
Fortran: subroutine reshap C: reshapeviewport()
Fortran: subroutine clear C: clear()
black = 0 red = 1 green = 2 yellow = 3 blue = 4 magenta = 5 cyan = 6 white = 7. These are included in vogl.h as: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN and WHITE. When using fortran these are included in fvogl.h as BLACK, RED, GREEN, YELLOW, BLUE, MAGENT, CYAN and WHITE.
Fortran: subroutine color(col) integer col C: color(col) Colorindex col;
Fortran: subroutine colorf(col) real col C: colorf(col) float col;
Fortran: subroutine mapcolor(indx, red, green, blue) integer indx, red, green, blue C: mapcolor(indx, red, green, blue) Colorindex indx; short red, green, blue;
Fortran: subroutine defbasis(id, mat) integer id real mat(4, 4) C: defbasis(id, mat) short id; Matrix mat;
Also note that in Fortran the corresponding constants are truncated to PYM_LI, PYM_FI, PYM_PO and PYM_HO respectivly. These appear in fvogl.h.
Fortran: subroutine polymode(mode) integer mode C: polymode(mode) long mode;
Fortran: subroutine qdevice(dev) integer dev C: qdevice(dev) Device dev;
Fortran: subroutine qdevice(dev) integer dev C: qdevice(dev) Device dev;
Fortran: integer function qread(data) integer*2 data C: long qread(data) short *data;
Fortran: logical function isqueued(dev) integer dev C: Boolean isqueued(dev) short *dev;
Fortran: logical function qtest C: Boolean qtest()
Fortran: subroutine qreset C: qreset()
Fortran: logical function getbutton(dev) integer dev C: Boolean getbutton(dev) Device dev;
Fortran: integer function getvaluator(dev) integer dev C: long getvaluator(dev) Device dev;
Fortran: subroutine viewport(left, right, bottom, top) integer left, right, bottom, top C: viewport(left, right, bottom, top) Screencoord left, right, bottom, top;
Fortran: subroutine pushviewport C: pushviewport()
Fortran: subroutine popviewport C: popviewport()
Fortran: subroutine getviewport(left, right, bottom, top) integer*2 left, right, bottom, top C: getviewport(left, right, bottom, top) Screencoord *left, *right, *bottom, *top;
The attribute stack contains details such as current color, current line style and width, and the current font number. If you need to prevent object calls form changing these, use pushattributes before the call and popattributes after.
Fortran: subroutine pushattributes C: pushattributes()
Fortran: subroutine popattributes C: popattributes()
All the projection routines define a new transformation matrix, and consequently the world units. Parallel projections are defined by ortho or ortho2. Perspective projections can be defined by perspective and window. Note the types Angle, etc, are defined in vogl.h. Remember angles are in tenths of degrees.
Fortran: subroutine ortho(left, right, bottom, top, near_d, far_d) real left, right, bottom, top, near_d, far_d C: ortho(left, right, bottom, top, near_d, far_d) Coord left, right, bottom, top, near_d, far_d;
Fortran: subroutine ortho2(left, right, bottom, top) real left, right, bottom, top C: ortho2(left, right, bottom, top) float left, right, bottom, top;
Fortran: subroutine perspective(fov, aspect, near, far) integer fov real aspect, near, far C: perspective(fov, aspect, near, far) Angle fov; float aspect; Coord near, far;
Fortran: subroutine pushmatrix C: pushmatrix()
Fortran: subroutine popmatrix C: popmatrix()
Viewpoint routines alter the current tranformation matrix.
Fortran: subroutine polarview(dist, azim, inc, twist) real dist integer azim, inc, twist C: polarview(dist, azim, inc, twist) Coord dist; Angle azim, inc, twist;
Fortran: subroutine lookat(vx, vy, vz, px, py, pz, twist) real vx, vy, vz, px, py, pz integer twist C: lookat(vx, vy, vz, px, py, pz, twist) float vx, vy, vz, px, py, pz; Angle twist;
There are variations on all these routines that end in ’s’ and also end in ’i’. In the case of the ’s’ variations they take arguments of type Scoord in C and integer*2 in FORTRAN. In the case of the ’i’ variations they take arguments of type Icoord in C and integer in FORTRAN.
Fortran: subroutine move(x, y, z) real x, y, z C: move(x, y, z) Coord x, y, z;
Fortran: subroutine rmv(deltax, deltay, deltaz) real deltax, deltay, deltaz C: rmv(deltax, deltay, deltaz) Coord deltax, deltay, deltaz;
Fortran: subroutine move2(x, y) real x, y C: move2(x, y) Coord x, y;
Fortran: subroutine rmv2(deltax, deltay) real deltax, deltay C: rmv2(deltax, deltay) Coord deltax, deltay;
These routines set the line style and line width if the current device is capable of doing so.
Fortran: subroutine deflin(n, style) integer n integer style C: deflinestyle(n, style) short n; Linestyle style;
Fortran: subroutine setlin(n) integer n C: setlinestyle(n) short n;
Fortran: subroutine linewi(n) integer n C: linewidth(n) short n;
There are variations on all these routines that end in ’s’ and also end in ’i’. In the case of the ’s’ variations they take arguments of type Scoord in C and integer*2 in FORTRAN. In the case of the ’i’ variations they take arguments of type Icoord in C and integer in FORTRAN.
Fortran: subroutine draw(x, y, z) real x, y, z C: draw(x, y, z) Coord x, y, z;
Fortran: subroutine rdr(deltax, deltay, deltaz) real deltax, deltay, deltaz C: rdr(deltax, deltay, deltaz) Coord deltax, deltay, deltaz;
Fortran: subroutine draw2(x, y) real x, y C: draw2(x, y) Coord x, y;
Fortran: subroutine rdr2(deltax, deltay) real deltax, deltay C: rdr2(deltax, deltay) Coord deltax, deltay;
There are calls which we term ’vertex calls’ which simply specify a point in 4D, 3D or 2D. These calls take an array which specifies the coordinates of the point. The interpretation of these points is described below.
v4d(v)
Specify a vertex(point)
in 4D using double precision numbers.
Fortran: subroutine v4d(v) real *8 v(4) C: v4d(v) double v[4];v4f(v) Specify a vertex(point) in 4D using single precision floating point numbers.
Fortran: subroutine v4f(v) real v(4) C: v4f(v) float v[4];v4i(v) Specify a vertex(point) in 4D using integer numbers
Fortran: subroutine v4i(v) integer v(4) C: v4i(v) long v[4];v4s(v) Specify a vertex(point) in 4D using short integer numbers
Fortran: subroutine v4s(v) integer *2 v(4) C: v4s(v) short v[4];
There are also equivalent calls for 3D points (v3d, v3f, v3i, v3s) and 2D points (v2d, v2f, v2i, v2s). The only difference is the number of elements that each vertex needs to be specified. It should also be noted the the different data types (ie. double, float, long and short) are merely different ways of representing the same basic coordinate data (calling v3s with v[] = {100,200,200} is the same as calling v3f with v[] = {100.0, 200.0, 200.0}).
The way these points are interpreted depends on what mode has be set up
with one of the calls bgnpoint, bgnline, bgnclosedline or bgnpolygon. The
bgnpoint call specifies that the next series of vertex calls are specifying
a chain of points (dots) to be drawn. A bgnpoint is terminated with a endpoint
call.
Fortran: subroutine bgnpoint C: bgnpoint() Fortran: subroutine endpoint C: endpoint()
The bgnline call specifies that the next series of vertex calls are specifying
the points on a polyline. A bgnline is terminated with a
endline call.
Fortran: subroutine bgnline C: bgnline() Fortran: subroutine endline C: endline()
The bgnclosedline call is similar to the bgnline except that when endclosedline
is called the first point given (ie. the one first after the bgnclosedline
call) is joined to the last point given (ie. the one just before the endclosedline
call).
Fortran: subroutine bgncloseline C: bgnclosedline() Fortran: subroutine endclosedline C: endclosedline()
The bgnpolygon call specifies that the next series of vertex calls are defining a polygon. When endpolygon is called, the polygon is closed and filled (or drawn as an outline depending on the mode that has been set with the polymode call if this call has been compilied into the library.
Fortran: subroutine bgnpolygon C: bgnpolygon() Fortran: subroutine endpolygon C: endpolygon()
There are variations on all these routines that end in ’s’ and also end in ’i’. In the case of the ’s’ variations they take arguments of type Scoord in C and integer*2 in FORTRAN. In the case of the ’i’ variations they take arguments of type Icoord in C and integer in FORTRAN.
Fortran: subroutine circleprecision(nsegs) integer nsegs C: circleprecision(nsegs) int nsegs;
Fortran: subroutine arc(x, y, radius, startang, endang) real x, y, radius; integer startang, endang; C: arc(x, y, radius, startang, endang) Coord x, y, radius; Angle startang, endang;
Fortran: subroutine arcf(x, y, radius, startang, endang) real x, y, radius; integer startang, endang; C: arcf(x, y, radius, startang, endang) Coord x, y, radius; Angle startang, endang;
Fortran: subroutine circ(x, y, radius) real x, y, radius C: circ(x, y, radius) Coord x, y, radius;
Fortran: subroutine circf(x, y, radius) real x, y, radius C: circf(x, y, radius) Coord x, y, radius;
Fortran: subroutine curvebasis(id) integer id C: curvebasis(id) short id;
Fortran: subroutine curveprecision(nsegs) integer nsegs C: curveprecision(nsegs) short nsegs;
Fortran: subroutine rcrv(geom) real geom(4,4) C: rcrv(geom) Coord geom[4][4];
Fortran: subroutine rcrvn(n, geom) integer n real geom(4,n) C: rcrvn(n, geom) long n; Coord geom[][4];
Fortran: subroutine crv(geom) real geom(3,4) C: crv(geom) Coord geom[4][3];
Fortran: subroutine crvn(n, geom) integer n real geom(3,n) C: crvn(n, geom) long n; Coord geom[][3];
Fortran: subroutine curveit(n) integer n C: curveit(n) short n;
See also Vertex calls above. The way in which filled polygons (including circles and arcs) are treated depends on the mode that has been set with the polymode call.
There are variations on all these routines that end in ’s’ and also end in ’i’. In the case of the ’s’ variations they take arguments of type Scoord in C and integer*2 in FORTRAN. In the case of the ’i’ variations they take arguments of type Icoord in C and integer in FORTRAN.
Fortran: subroutine rect(x1, y1, x2, y2) real x1, y1, x1, y2 C: rect(x1, y1, x2, y2) Coord x1, y1, x2, y2;
Fortran: subroutine rectf(x1, y1, x2, y2) real x1, y1, x1, y2 C: rectf(x1, y1, x2, y2) Coord x1, y1, x2, y2;
Fortran: subroutine poly2(n, points) integer n real points(2, n) C: poly2(n, points) long n; Coord points[][2];
Fortran: subroutine polf2(n, points) integer n real points(2, n) C: polf2(n, points) long n; Coord points[][2];
Fortran: subroutine poly(n, points) integer n real points(3, n) C: poly(n, points) long n; float points[][3];
Fortran: subroutine polf(n, points) integer n real points(3, n) C: polf(n, points) long n; Coord points[][3];
Fortran: subroutine backface(onoff) logical onoff C: backface(onoff) Boolean onoff;
Fortran: subroutine frontface(clockwise) logical onoff C: frontface(clockwise) Boolean onoff;
vogl.smallfont: <font name> vogl.largefont: <font name>
Fortran: subroutine font(fontid) integer fontid; C: font(fontid) short fontid;
Fortran: subroutine cmov(x, y, z) real x, y, z; C: cmov(x, y, z) Coord x, y, z;
Fortran: subroutine cmov2(x, y) real x, y; C: cmov2(x, y) Coord x, y;
Fortran: integer function getheight C: long getheight()
Fortran: integer function getwidth C: long getwidth()
Fortran: integer function strwidth(s, n) character *(*) s integer n; C: long strwidth(s) char *s;
Fortran: subroutine charst(str, len) character*(*) str integer len C: charstr(str) char *str;
All transformations are cumulative, so if you rotate something and then do a translate you are translating relative to the rotated axes. If you need to preserve the current transformation matrix use pushmatrix(), do the drawing, and then call popmatrix() to get back where you were before.
Fortran: subroutine translate(x, y, z) real x, y, z C: translate(x, y, z) Coord x, y, z;
Fortran: subroutine scale(x, y, z) real x, y, z C: scale(x, y, z) Coord x, y, z;
Fortran: subroutine rot(angle, axis) real angle character axis C: rot(angle, axis) float angle; char axis;
Fortran: subroutine rotate(angle, axis) integer angle character axis C: rotate(angle, axis) Angle angle; char axis;
Fortran: subroutine patchbasis(tid, uid) integer tid, uid C: patchbasis(tid, ubid) long tid, uid
Fortran: subroutine patchprecision(tseg, useg) integer tseg, useg C: patchprecision(tseg, useg) long tseg, useg;
Fortran: subroutine patchcurves(nt, nu) integer nt, nu C: patchcurves(nt, nu) long nt, nu;
Fortran: subroutine rpatch(gx, gy, gz, gw) real gx(4,4), gy(4,4), gz(4,4), gw(4,4) C: rpatch(gx, gy, gz, gw) Matrix gx, gy, gz, gw;
Fortran: subroutine patch(gx, gy, gz) real gx(4,4), gy(4,4), gz(4,4) C: patch(gx, gy, gz) Matrix gx, gy, gz;
There are variations on all these routines that end in ’s’ and also end in ’i’. In the case of the ’s’ variations they take arguments of type Scoord in C and integer*2 in FORTRAN. In the case of the ’i’ variations they take arguments of type Icoord in C and integer in FORTRAN.
Fortran: subroutine pnt(x, y, z) real x, y, z C: pnt(x, y, z) Coord x, y, z;
Fortran: subroutine pnt2(x, y) real x, y C: pnt2(x, y) Coord x, y;
Objects are graphical entities created by the drawing routines called between makeobj and closeobj. Objects may be called from within other objects. When an object is created most of the calculations required by the drawing routines called within it are done up to where the calculations involve the current transformation matrix. So if you need to draw the same thing several times on the screen but in different places it is faster to use objects than to call the appropriate drawing routines each time.
Fortran: subroutine makeobj(n) integer n C: makeobj(n) Object n;
Fortran: subroutine closeobj() C: closeobj()
Fortran: integer function genobj() C: Object genobj()
Fortran: integer function getopenobj() C: Object getopenobj()
Fortran: subroutine callobj(n) integer n C: callobj(n) Object n;
Fortran: logical function isobj(n) integer n C: Boolean isobj(n) Object n;
Fortran: subroutine delobj(n) integer n C: delobj(n) Object n;
Fortran: subroutine gconfig C: gconfig()
Fortran: subroutine doublebuffer C: doublebuffer()
Fortran: subroutine singlebuffer C: singlebuffer()
Fortran: subroutine backbuffer(yesno) logical yesno; C: backbuffer(yesno) Boolean yesno;
Fortran: subroutine frontbuffer(yesno) logical yesno; C: frontbuffer(yesno) Boolean yesno;
Fortran: subroutine swapbuffers C: swapbuffers()
Fortran: subroutine getgpos(x, y, z, w) real x, y, z C: getgpos(x, y, z, w) Coord *x, *y, *z, *w;
Fortran: subroutine getcpo(ix, iy) integer ix, iy C: getcpos(ix, iy) Scoord *ix, *iy;
Double buffering isn’t supported on all devices.
The yobbarays may be turned on or they may be turned off.