Ygl Version 2.8 Description
Copyright (C) 1993/94 by Fred Hucht (fred@hal6000.Uni-Duisburg.DE)
Please see the LICENSE file for further details. You may not
distribute this project without this file (ReadMe.html) and the
LICENSE file included. Here you can read the
CHANGES history.
Description:
Ygl emulates SGI's GL routines under X11. It compiles fine under AIX
3.2, HP-UX 7.0/8.0/9.0, Linux with XFree, SunOS, ConvexOS and others,
but needs an ANSI-C compiler (gcc is ok). It was written for two
reasons:
- On our RS/6000 GT4 hardware, Ygl is up to twenty times faster than
GL (strange, isn't it?...)
- 2D graphics runs on non GL hardware and even on remote X-Servers.
Included are most of the two-dimensional graphics routines, the queue
device routines, some query routines, doublebuffering, RGB mode and
some window attribute routines (see below).
Since Version 2.8, all Ygl functions do have a
FORTRAN interface. The
FORTRAN versions of all functions have an underscore appended, so the
FORTRAN compiler must append a '_' to all function names.
f2c does this,
xlf
(under AIX 3.2) requires the option -qextname. See
smile_f77.f for an example program. Set
FortranBindings to 0 in Imakefile or change Makefile.std if you
don't want these bindings. FORTRAN bindings are not tested because I
have no programs.f to test. If you find bugs, feel free to report them
to me.
You can always download the latest version of Ygl from
ftp.thp.Uni-Duisburg.DE
(134.91.141.1), as
pub/source/X11/Ygl.tar.gz
Details:
Environment variables:
Six environment variables are referenced in the library to control
the behavior of Ygl:
- The environment variable YGL_PRIVATECOLORMAP or YGL_PCM can be
set to 1 to force Ygl to use a private colormap. While GL
always uses a private colormap, Ygl uses the global map by
default to avoid technicolor effects on
X-Servers not capable of more than one colormap at a time. Note
that you can only redefine the color of already drawn objects
when you use a private colormap.
- The environment variable YGL_FLUSHTIME or YGL_FT (default
value: 0.1) can be used to adjust the time in seconds between
flushes of the graphics pipeline. It can be set to 0 to disable
the automatic update via interval timer.
Setting YGL_FLUSHTIME to -1 will put the X-Server into
synchronous mode (see XSynchronize).
This mode seems to be veeeryyy slooow, but is good for debugging...
- The environment variable YGL_BACKINGSTORE or YGL_BS can be set
to 1 to enables BackingStore support for all Ygl windows.
With BackingStore, the X-Server remembers the contents of a
window when it gets obscured or iconified.
You must start your X-Server with the option "-bs" ("+bs" on some systems)
to use this feature.
- The environment variable YGL_SINGLEGC or YGL_GC can be set
to 1 to force Ygl to use a single graphics context for
colormap windows. Per default Ygl uses one GC for each color,
i.e. 256 GCs for a 8 bit colormap window, because this speeds
up drawing with many color changes by a factor of 2 or so on
many systems. Using a single GC may be faster if you use many
mapcolor calls as in colormap animation.
- The environment variables YGL_CMAPVISUAL or YGL_CV and
YGL_RGBVISUAL or YGL_RV control the selection of visuals for
cmapmode and RGBmode. Set these variables to the visual id of
the desired visual as returned by xdpyinfo, (both hex and decimal is ok).
Double buffering:
Ygl supports doublebuffering via the "Multi-Buffering" server
extension. The related routines are doublebuffer, swapbuffer and
singlebuffer.
Note for AIX < 3.2.5:
This extension is new in X11R5 and is included in the lpp
X11dev.src under AIX. To use doublebuffering you have to link the
"Multi-Buffering" extension into your X-Server (under AIX, see
/usr/lpp/X11/Xamples/README, "Linking the Sample Extensions into
the Server").
Note for AIX >= 3.2.5:
You don't need to recompile the X-Server anymore to use
doublebuffering under AIX 3.2.5 (AIXWindows 1.2.3). You simply have
to add the option "-x mbx" to the X-Servers command line on startup.
RGB mode:
Ygl can run in a per window RGB mode, if the X-Server has a TrueColor
or DirectColor visual. Ygl will always select the appropiate visual
for the desired mode, independent of the default visual, ie:
Colormap mode <-> PseudoColor, StaticColor,
GrayScale ,StaticGray,
TrueColor or DirectColor visual
RGB mode <-> TrueColor or DirectColor visual
Multiple Expose events (REDRAW) in qread:
Ygl ignores all Expose events that have e.xexpose.count != 0 (see
XExposeEvent,
(3X11) AND all Expose events when another Expose event for the same
window is in the Event queue. This procedure minimizes unnessesary
redraws. Nevertheless, a REDRAW event is generated when a window is
moved even when the contents of the window does not have to be
redrawn. This is to be compatible with SGI's GL, where no extra event
for window moves exist :-(
Automatic flushing of the graphics pipeline:
The process virtual interval timer (see
setitimer(3))
is used to flush the graphics pipeline every 0.1 seconds. This
interval is adjustable (see above). The system functions sleep() and
usleep() are covered by the library to flush the pipeline, too. This
had to be done because the GL hardware flushes the pipeline
automatically on every vertical retrace and has no command to
flush.
Note that sleep() and usleep() always return 0.
You can use "sleep(0)" to flush the graphics pipeline explicitly.
If you have problems with sleep() and usleep(), undefine COVERSLEEP in
header.h.
Supported routines:
Finally a list of supported GL routines is included. For a detailed
description of the routines see the GL manuals in the Info-Explorer
(under AIX) or click at the command below.
Window related routines:
minsize,
maxsize,
prefsize,
prefposition,
stepunit,
keepaspect,
reshapeviewport,
winopen,
winclose,
gconfig,
gexit,
winset,
winget,
getsize,
getorigin,
getXdpy,
getXwid,
getbutton,
getvaluator,
winmove,
winposition,
ginit,
winpop,
winpush,
swinopen,
winconstraints,
noport
Color related routines:
RGBmode,
RGBcolor,
cmode,
color,
mapcolor,
getplanes,
getmcolor,
getmcolors,
getcolor,
gRGBcolor,
c3s, c3i, c3f,
cpack
Device related routines:
qdevice,
unqdevice,
qreset,
qtest,
qread,
qenter,
tie
Notes:
- Currently supported devices are:
REDRAW, KEYBD, INPUTCHANGE, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE,
MOUSEX, MOUSEY, WINQUIT, and all individual keys as F1KEY, ESCKEY,
UPARROWKEY, and so on.
- qenter does only support the REDRAW device.
Misc routines:
loadXfont,
font,
strwidth,
getheight,
getdescender,
gversion,
singlebuffer,
doublebuffer,
swapbuffers,
frontbuffer,
backbuffer,
lrectread,
lrectwrite,
rectcopy,
readsource,
rectread,
rectwrite,
linewidth,
getlwidth,
getfont,
getfontencoding,
getcpos,
getdisplaymode,
getgdesc,
setbell,
ringbell
Drawing routines:
pnt2s, pnt2i, pnt2,
move2s, move2i, move2,
draw2s, draw2i, draw2,
rmv2s, rmv2i, rmv2,
rdr2s, rdr2i, rdr2,
arcs, arci, arc,
arcfs, arcfi, arcf,
circs, circi, circ,
circfs, circfi, circf,
rects, recti, rect,
rectfs, rectfi, rectf,
sboxs , sboxi, sbox,
sboxfs, sboxfi, sboxf,
pmv2s, pmv2i, pmv2,
pdr2s, pdr2i, pdr2,
rpdr2s, rpdr2i, rpdr2,
poly2s, poly2i, poly2,
polf2s, polf2i, polf2,
cmov2s, cmov2i, cmov2,
ortho2,
clear,
charstr,
pclos,
concave
Routines not in SGI's GL:
The following routines are added to standard GL:
- (GC*) getXgc()
return pointer to current graphics context
- Int32 crectread(Screencoord x1, Screencoord y1, Screencoord x2, Screencoord y2, Uint8 *data)
read screen data to unsigned char array 'data'
- void crectwrite(Screencoord x1, Screencoord y1, Screencoord x2, Screencoord y2, Uint8 *data)
write unsigned char array 'data' to screen
- void arcxs(Scoord x,Scoord y,Scoord rx,Scoord ry,Angle s,Angle e)
void arcxi(Icoord x,Icoord y,Icoord rx,Icoord ry,Angle s,Angle e)
void arcx(Coord x,Coord y,Coord rx,Coord ry,Angle s,Angle e)
draw ellipses
- void arcxfs(Scoord x,Scoord y,Scoord rx,Scoord ry,Angle s,Angle e)
void arcxfi(Icoord x,Icoord y,Icoord rx,Icoord ry,Angle s,Angle e)
void arcxf(Coord x,Coord y,Coord rx,Coord ry,Angle s,Angle e)
draw filled ellipses
- int gl2ppm(char *filename)
write out active Ygl window to portable pixmap file 'filename'. When
filename[0] == '|', use popen instead of fopen.
Acknowledgements:
The author would like to thank
Michael Staats (michael@thp.Uni-Duisburg.DE) and
Ralf Meyer (ralf@thp.Uni-Duisburg.DE) for some hints and tips.