VOGLE is a library of C routines for doing line drawings and polygon fills in 2 and 3 Dimensions. It handles circles, curves, arcs, patches, polygons, and software text 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. A SUN Pascal interface has also been provided. The following is a brief summary of the VOGLE subroutines.
There are two include files provided with vogle: vogle.h and Vogle.h. The lowercase vogle.h is the C header file which most vogle C programs would include. The uppercase Vogle.h is the SUN Pascal header file which contains the forward/external declarations for Pascal. This header file should be included just after the program statement of a Pascal program.
The following is a brief summary of the VOGLE subroutines.For X11 and Sunview based applications, it is posible for VOGLE 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 three 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 "vinit()".
vo_xt_win_size(width, height) int width, height;
vo_xt_set_win(display, xwin, width, height) Display *display; Drawable xwin; int width, height;
Display * vo_xt_get_display()
Window vo_xt_get_window()
GC vo_xt_get_GC()
vo_sunview_canvas_size(width, height) int width, height;
Fortran: subroutine vinit(device) character *(*) device C: vinit(device); char *device; Pascal: procedure Vinit(device: string_t) Note 1 :- Current available devices are: tek - tektronix 4010 and compatibles hpgl - HP Graphics language and compatibles hpgt - HP Graphics Terminals and compatibles dxy - roland DXY plotter language postscript - mono postscript devices ppostscript - mono postscript devices (portrait mode) cps - colour postscript devices pcps - colour postscript devices (portrait mode) sun - Sun workstations running sunview X11 - X windows (SUN's OPenwindows etc etc) next - NeXTStep and other NeXT platforms decX11 - the decstation window manager (basically obsolete). apollo - Apollo workstations (basically obsolete). 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. mswin - IBM PC Microsoft Windows. os2pm - IBM PC OS/2 Presentation Manager grx - the contributed GRX graphics library that is available with DJGPP (GNU for PCs). Sun, X11, apollo, grx, mswin, os2pm, next, 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 or in Pascal Color(BLACK); Clear;
Fortran: subroutine vexit C: vexit() Pascal: procedure Vexit;
Fortran: subroutine voutput(path) character*(*) path C: voutput(path) char *path; Pascal: procedure Voutput(path: string_t)
Fortran: subroutine vnewdev(device) character *(*) device C: vnewdev(device) char *device; Pascal: VnewDev(device: string_t)
Fortran: subroutine vgetdev(device) character *(*) device C: char * vgetdev(device) char *device; Pascal: procedure VgetDev(var device: string_t)
Fortran: subroutine pushdev(device) character *(*) device C: pushdev(device) char *device; Pascal: PushDev(device: string_t)
Fortran: subroutine popdev() C: popdev() Pascal: PopDev
Fortran: integer function getdepth() C: int getdepth() Pascal: function GetDepth(): integer;
Fortran: subroutine prefposition(x, y) integer x, y C: prefposition(x, y) int x, y; Pascal: procedure PrefPosition(x, y: integer)
Fortran: subroutine prefsize(width, height) integer width, height C: prefsize(width, height) int width, height; Pascal: procedure PrefSize(width, height: integer)
Fortran: subroutine clear C: clear() Pascal: procedure Clear
black = 0 red = 1 green = 2 yellow = 3 blue = 4 magenta = 5 cyan = 6 white = 7.
Fortran: subroutine color(col) integer col C: color(col) int col; Pascal: procedure Color
Fortran: subroutine mapcolor(indx, red, green, blue) integer indx, red, green, blue C: mapcolor(indx, red, green, blue) int indx, red, green, blue; Pascal: procedure MapColor(indx, red, green, blue: integer)
Fortran: subroutine clipping(onoff) logical onoff C: clipping(onoff) int onoff; Pascal: procedure Clipping(onoff: boolean)
Fortran: integer function getkey C: int getkey() Pascal: function GetKey(): integer;
Fortran: integer function checkkey() C: int checkey() Pascal: function CheckKey(): integer;
Fortran: integer function getstring(bcol, string) integer bcol character *(*) string C: int getstring(bcol, string) int bcol; char *string; Pascal: function GetString(bcol: integer; var string: string_t): integer;
Fortran: integer function locator(xaddr, yaddr) real xaddr, yaddr C: int locator(xaddr, yaddr) float *xaddr, *yaddr; Pascal: function Locator(var xaddr, yaddr: real): integer;
Fortran: integer function slocator(xaddr, yaddr) real xaddr, yaddr C: int slocator(xaddr, yaddr) float *xaddr, *yaddr; Pascal: function Slocator(var xaddr, yaddr: real): integer;
- Within a callobj() call. - Within curves and patches. - Within Hershey software text. - When double buffering (the flush is only done within swapbuffers).There are two user routines that can be used to control flushing.
Fortran: subroutine vsetflush(yesno) logical yesno C: void vsetflush(yesno) int yesno; Pascal: procedure VsetFlush(yesno: boolean);
Fortran: subroutine vflush C: void vflush(); Pascal: procedure Vflush;
Fortran: subroutine viewport(left, right, bottom, top) real left, right, bottom, top C: viewport(left, right, bottom, top) float left, right, bottom, top; Pascal: procedure ViewPort(left, right, bottom, top: real);
Fortran: subroutine pushviewport C: pushviewport() Pascal: procedure PushViewPort;
Fortran: subroutine popviewport C: popviewport() Pascal: procedure PopViewPort;
Fortran: subroutine getviewport(left, right, bottom, top) real left, right, bottom, top C: getviewport(left, right, bottom, top) float *left, *right, *bottom, *top; Pascal: procedure GetViewPort(var left, right, bottom, top: real)
Often the screen is not perfectly square and it would be nice to use the extra space without having to turn clipping off. The following routines are provided to get the values needed to adjust the calls to viewport, etc as needed.
Fortran: real function getaspect() C: float getaspect() Pascal: function GetAspect(): real;
Fortran: subroutine getfactors(w, h) real w, h C: getfactors(w, h) float *w, *h; Pascal: procedure GetFactors(var w, h: real)
Fortran: subroutine getdisplaysize(w, h) real w, h C: getdisplaysize(w, h) float *w, *h; Pascal: procedure GetDisplaySize(var w, h: real)
Fortran: subroutine expandviewport C: expandviewport() Pascal: procedure ExpandViewport
Fortran: subroutine unexpandviewport C: unexpandviewport() Pascal: procedure UnExpandViewport
The attribute stack contains the following details:
current color index
filling/hatching status
hatch pitch and angle
Linestyle and linestyle status
Doublebuffer status
Text rotation
Text size
Text justification
Text fixedwidth status
Text status (hardware or software)
Text font.
If you need to prevent object calls form changing these, use
pushattributes
before the call and
popattributes
after.
Fortran: subroutine pushattributes C: pushattributes() Pascal: procedure PushAttributes;
Fortran: subroutine popattributes C: popattributes() Pascal: procedure 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.
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) float left, right, bottom, top, near_d, far_d; Pascal: procedure Ortho(left, right, bottom, top, near_d, far_d: real)
Fortran: subroutine ortho2(left, right, bottom, top) real left, right, bottom, top C: ortho2(left, right, bottom, top) float left, right, bottom, top; Pascal: procedure Ortho2(left, right, bottom, top: real)
Fortran: subroutine perspective(fov, aspect, near, far) real fov, aspect, near, far C: perspective(fov, aspect, near, far) float fov, aspect, near, far; Pascal: procedure Perspective(fov, aspect, near, far: real)
Fortran: subroutine pushmatrix C: pushmatrix() Pascal: procedure PushMatrix
Fortran: subroutine popmatrix C: popmatrix() Pascal: procedure PopMatrix
Viewpoint routines alter the current tranformation matrix.
Fortran: subroutine polarview(dist, azim, inc, twist) real dist, azim, inc, twist C: polarview(dist, azim, inc, twist) float dist, azim, inc, twist; Pascal: procedure PolarView(dist, azim, inc, twist: real)
Fortran: subroutine up(x, y, z) real x, y, z C: up(x, y, z) float x, y, z; Pascal: procedure Up(x, y, z: real)
Fortran: subroutine lookat(vx, vy, vz, px, py, pz, twist) real vx, vy, vz, px, py, pz, twist C: lookat(vx, vy, vz, px, py, pz, twist) float vx, vy, vz, px, py, pz, twist; Pascal: procedure LookAt(vx, vy, vz, px, py, pz, twist: real)
Fortran: subroutine move(x, y, z) real x, y, z C: move(x, y, z) float x, y, z; Pascal: procedure Move(x, y, z: real)
Fortran: subroutine rmove(deltax, deltay, deltaz) real deltax, deltay, deltaz C: rmove(deltax,deltay) float deltax, deltay, deltaz; Pascal: procedure Rmove(deltax, deltay, deltaz: real)
Fortran: subroutine move2(x, y) real x, y C: move2(x, y) float x, y; Pascal: procedure Move2(x, y: real)
Fortran: subroutine rmove2(deltax, deltay) real deltax, deltay C: rmove2(deltax, deltay) float deltax, deltay; Pascal: procedure Rmove2(deltax, deltay: real)
Fortran: subroutine smove2(x, y) real x, y C: smove2(x, y) float x, y; Pascal: procedure Smove2(x, y: real)
Fortran: subroutine rsmove2(deltax, deltay) real deltax, deltay C: rsmove2(deltax, deltay) float deltax, deltay; Pascal: procedure Rsmove2(deltax, deltay: real)
Linestyles are specified by giving a nominal length of a single dash and a character string consisting of 1's and 0's (zeros) that specify when to draw a dash and when not to draw a dash. Linestyles will follow curves and "go around" corners. If a linestyle is set or reset, the accumulated information as to where on a curve (or line) a dash is to be draw is also reset.
For example, with a nominal view of -1 to 1, setting the dash length to 0.5, and the linestyle to '11010' would draw a line(or curve) with a 1.0 unit solid part, followed by a 0.5 unit blank part followed by a 0.5 unit solid part followed by a 0.5 unit blank part. The linestyle would then repeat itself. The dash sizes are affected by the current viewport/transformation scaling factors, meaning that in perspective, the dashes look smaller the farther away they are.
Fortran: subroutine setdash(dashlen) real dashlen C: setdash(dashlen) float dashlen; Pascal: procedure SetDash(dashlen: real)
Fortran: subroutine linestyle(style) character *(*) style C: linesyle(style) char *style; Pascal: procedure LineStyle(style: string_t)
Fortran: subroutine draw(x, y, z) real x, y, z C: draw(x, y, z) float x, y, z; Pascal: procedure Draw(x, y, z: real)
Fortran: subroutine rdraw(deltax, deltay, deltaz) real deltax, deltay, deltaz C: rdraw(deltax, deltay, deltaz) float deltax, deltay, deltaz; Pascal: procedure Rdraw(deltax, deltay, deltaz: real)
Fortran: subroutine draw2(x, y) real x, y C: draw2(x, y) float x, y; Pascal: procedure Draw2(x, y: real)
Fortran: subroutine rdraw2(deltax, deltay) real deltax, deltay C: rdraw2(deltax, deltay) float deltax, deltay; Pascal: procedure Rdraw2(deltax, deltay: real)
Fortran: subroutine sdraw2(x, y) real x, y C: sdraw2(x, y) float x, y; Pascal: procedure Sdraw2(x, y: real)
Fortran: subroutine rsdraw2(deltax, deltay) real deltax, deltay C: rsdraw2(deltax, deltay) float deltax, deltay; Pascal: procedure Rsdraw2(deltax, deltay: real)
Fortran: subroutine circleprecision(nsegs) integer nsegs C: circleprecision(nsegs) int nsegs; Pascal: procedure CirclePrecision(nsegs: integer)
Fortran: subroutine arc(x, y, radius, startang, endang) real x, y, radius; real startang, endang; C: arc(x, y, radius, startang, endang) float x, y, radius; float startang, endang; Pascal: procedure Arc(x, y, radius, startang, endang: real)
Fortran: subroutine sector(x, y, radius, startang, endang) real x, y, radius; real startang, endang; C: sector(x, y, radius, startang, endang) float x, y, radius; float startang, endang; Pascal: procedure Sector(x, y, radius, startang, endang: real)
x and y real coordinates in user units. Fortran: subroutine circle(x, y, radius) real x, y, radius C: circle(x, y, radius) float x, y, radius; Pascal: procedure Circle(x, y, radius: real)
Fortran: subroutine curvebasis(basis) real basis(4,4) C: curvebasis(basis) float basis[4][4]; Pascal: procedure CurveBasis(basis: Matrix44_t)
Fortran: subroutine curveprecision(nsegs) integer nsegs C: curveprecision(nsegs) int nsegs; Pascal: procedure CurvePrecision(nsegs: integer)
Fortran: subroutine rcurve(geom) real geom(4,4) C: rcurve(geom) float geom[4][4]; Pascal: procedure Rcurve(geom: Matrix44_t)
Fortran: subroutine curve(geom) real geom(3,4) C: curve(geom) float geom[4][3]; Pascal: procedure Curve(geom: Matrix43_t)
Fortran: subroutine curven(n, geom) integer n real geom(3,n) C: curven(n, geom) int n; float geom[][3]; Pascal: procedure Curven(n: integer; geom: GeomMat_t)
Fortran: subroutine rect(x1, y1, x2, y2) real x1, y1, x1, y2 C: rect(x1, y1, x2, y2) float x1, y1, x2, y2; Pascal: procedure Rect(x1, y1, x2, y2: real)
Fortran: subroutine polyfill(onoff) logical onoff C: polyfill(onoff) int onoff; Pascal: procedure PolyFill(onoff: boolean)
Fortran: subroutine polyhatch(onoff) logical onoff C: polyhatch(onoff) int onoff; Pascal: procedure PolyHatch(onoff: boolean)
Fortran: subroutine hatchang(angle) real angle C: hatchang(angle) float angle; Pascal: procedure HatchAng(angle: real)
Fortran: subroutine hatchpitch(pitch) real pitch C: hatchpitch(pitch) float pitch; Pascal: procedure HatchPitch(pitch: real)
Fortran: subroutine poly2(n, points) integer n real points(2, n) C: poly2(n, points) int n; float points[][2]; Pascal: procedure Poly2(n: integer; points: Poly2_array_t)
Fortran: subroutine poly(n, points) integer n real points(3, n) C: poly(n, points) int n; float points[][3]; Pascal: procedure Poly(n: integer; points: Poly3_array_t)
Fortran: subroutine makepoly C: makepoly() Pascal: procedure MakePoly
Fortran: subroutine closepoly C: closepoly() Pascal: procedure ClosePoly
Fortran: subroutine backface(onoff) integer onoff C: backface(onoff) int onoff; Pascal: procedure BackFace(onoff: boolean)
Fortran: subroutine backfacedir(clockwise) integer clockwise C: backfacedir(clockwise) int clockwise; Pascal: procedure BackFaceDir(clockwise: boolean)
VOGLE supports hardware and software fonts. The software fonts are based on the character set digitized by Dr Allen V. Hershey while working at the U. S. National Bureau of Standards. Exactly what hardware fonts are supported depends on the device, but it is guaranteed that the names "large" and "small" will result in something readable. For X11 displays the default large and small fonts used by the program can be overridden by placing the following defaults in the ~/.Xdefaults file:
vogle.smallfont: <font name> vogle.largefont: <font name>It is noted here that text is always assumed to be drawn parallel to the (x, y) plane, using whatever the current z coordinate is. The following software fonts are supported:
astrology cursive cyrillic futura.l futura.m gothic.eng gothic.ger gothic.ita greek markers math.low math.upp meteorology music script symbolic times.g times.i times.ib times.r times.rb japaneseA markers font "markers" is also provided for doing markers - you need to have centertext on for this to give sensible results - with the markers starting at 'A' and 'a'.
If the environment variable "VFONTLIB" is set VOGLE looks for the software fonts in the directory given by this value.
Fortran: subroutine font(fontname) character*(*) fontname C: font(fontname) char *fontname Pascal: procedure Font(fontname: string_t)
Fortran: integer function numchars C: int numchars() Pascal: function NumChars: integer;
Fortran: subroutine textsize(width, height) real width, height C: textsize(width, height) float width, height; Pascal: procedure TextSize(width, height: real)
Fortran: subroutine textang(ang) real ang C: textang(ang) float ang; Pascal: procedure TexTang(ang: real)
Fortran: subroutine fixedwidth(onoff) logical onoff C: fixedwidth(onoff) int onoff; Pascal: procedure FixedWidth(onoff: boolean)
Fortran: subroutine centertext(onoff) logical onoff C: centertext(onoff) int onoff; Pascal: procedure CenterText(onoff: boolean)
Fortran: subroutine textjustify(val) integer val C: textjustify(val) unsigned val; Pascal: procedure CenterText(val: integer)
Fortran: subroutine leftjustify C: leftjustify() Pascal: procedure LeftJustify
Fortran: subroutine rightjustify C: rightjustify() Pascal: procedure RightJustify
Fortran: subroutine xcentertext C: xcentertext() Pascal: procedure XcenterText
Fortran: subroutine topjustify C: topjustify() Pascal: procedure TopJustify
Fortran: subroutine bottomjustify C: bottomjustify() Pascal: procedure BottomJustify
Fortran: subroutine ycentertext C: ycentertext() Pascal: procedure YcenterText
Fortran: subroutine getcharsize(c, width, height) character*1 c real width, height C: getcharsize(c, width, height) char c; float *width, *height; Pascal: procedure GetCharSize(c: char; var width, height: real)
Fortran: subroutine getfontsize(width, height) real width, height C: getfontsize(width, height) float *width, *height; Pascal: procedure GetFontSize(var width, height: real)
Fortran: subroutine drawchar(c) character c C: drawchar(str) char c; Pascal: procedure DrawChar(c: char)
Fortran: subroutine drawstr(str) character*(*) str C: drawstr(str) char *str; Pascal: procedure DrawStr(str: string_t)
Fortran: real function strlength(str) character*(*) str C: float strlength(str) char *str; Pascal: function StrLength(str: string_t): real;
Fortran: subroutine boxtext(x, y, l, h, s) real x, y, l, h character*(*) C: boxtext(x, y, l, h, s) float x, y, l, h; char *s; Pascal: procedure BoxText(x, y, l, h: real; s: string_t)
Fortran: subroutine boxfit(l, h, nchars) real l, h integer nchars C: boxfit(l, h, nchars) float l, h int nchars Pascal: procedure BoxFit(l, h: real; nchars: integer)
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) float x, y, z; Pascal: procedure Translate(x, y, z: real)
Fortran: subroutine scale(x, y, z) real x, y, z C: scale(x, y, z) float x, y, z; Pascal: procedure Scale(x, y, z: real)
Fortran: subroutine rotate(angle, axis) real angle character axis C: rotate(angle, axis) float angle; char axis; Pascal: procedure Rotate(angle: real; axis: char)
Fortran: subroutine patchbasis(tbasis, ubasis) real tbasis(4, 4), ubasis(4, 4) C: patchbasis(tbasis, ubasis) float tbasis[4][4], ubasis[4][4]; Pascal: procedure PatchBasis(tbasis, ubasis: Matrix44_t)
Fortran: subroutine patchprecision(tseg, useg) integer tseg, useg C: patchprecision(tseg, useg) int tseg, useg; Pascal: procedure PatchPrecision(tseg, useg: integer)
Fortran: subroutine patchcurves(nt, nu) integer nt, nu C: patchcurves(nt, nu) int nt, nu; Pascal: procedure PatchCurves(nt, nu: integer)
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) float gx[4][4], gy[4][4], gz[4][4], gw[4][4]; Pascal: procedure Rpatch(gx, gy, gz, gw: Matrix44_t)
Fortran: subroutine patch(gx, gy, gz) real gx(4,4), gy(4,4), gz(4,4) C: patch(gx, gy, gz) float gx[4][4], gy[4][4], gz[4][4]; Pascal: procedure Patch(gx, gy, gz: Matrix44_t)
Fortran: subroutine point(x, y, z) real x, y, z C: point(x, y, z) real x, y, z; Pascal: procedure Point(x, y, z: real)
Fortran: subroutine point2(x, y) real x, y C: point2(x, y) float x, y; Pascal: procedure Point2(x, y: real)
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. Objects also have the advantage of being saveable to a file, from where they can be reloaded for later reuse. Routines which draw or move in screen coordinates, or change device, cannot be included in objects.
Fortran: subroutine makeobj(n) integer n C: makeobj(n) int n; Pascal: procedure MakeObj(n: integer)
Fortran: subroutine closeobj() C: closeobj() Pascal: procedure CloseObj
Fortran: integer function genobj() C: int genobj() Pascal: function GenObj: integer
Fortran: integer function getopenobj() C: int getopenobj() Pascal: function GetOpenObj: integer
Fortran: subroutine callobj(n) integer n C: callobj(n) int n; Pascal: procedure CallObj(n: integer)
Fortran: logical function isobj(n) integer n C: int isobj(n) int n; Pascal: function IsObj(n: integer): boolean;
Fortran: subroutine delobj(n) integer n C: delobj(n) Object n; Pascal: procedure DelObj(n: integer);
Fortran: subroutine loadobj(n, filename) integer n character*(*) filename C: loadobj(n, filename) int n; char *filename; Pascal: procedure LoadObj(n: integer; filename: string_t)
Fortran: saveobj(n, filename) integer n character*(*) filename C: saveobj(n, filename) int n; char *filename; Pascal: procedure SaveObj(n: integer; filename: string_t)
Fortran: integer function backbuffer C: backbuffer() Pascal: function BackBuffer:integer
Fortran: subroutine frontbuffer C: frontbuffer() Pascal: procedure FrontBuffer
Fortran: subroutine swapbuffers C: swapbuffers() Pascal: procedure SwapBuffers
Fortran: subroutine getgp(x, y, z) real x, y, z C: getgp(x, y, z) float *x, *y, *z; Pascal: procedure GetGp(var x, y, z: real)
Fortran: subroutine getgpt(x, y, z, w) real x, y, z, w C: getgpt(x, y, z, w) float *x, *y, *z, *w; Pascal: procedure GetGpT(var x, y, z, w: real)
Fortran: subroutine getgp2(x, y) real x, y C: getgp2(x, y) float *x, *y; Pascal: procedure GetGp2(var x, y: real)
Fortran: subroutine sgetgp2(x, y) real x, y C: sgetgp2(x, y) float *x, *y; Pascal: procedure SgetGp2(var x, y: real)
We had to make up the font names based on some books of type faces.
Polygon hatching will give unexpected results unless the polygon is initially defined in the X-Y plane.
Double buffering isn't supported on all devices.
We don't recommend the use of the smove/sdraw routines.
The yobbarays may be turned on or they may be turned off.