| 1 |
|
| 2 |
This is a subset of: |
| 3 |
|
| 4 |
The GL library from v2.2 of Brian Paul's Mesa 3-D graphics library |
| 5 |
|
| 6 |
This is GNU software. |
| 7 |
--Michael Holst, 091796 |
| 8 |
|
| 9 |
------------------------------------------------------------------------------ |
| 10 |
|
| 11 |
Mesa 2.2 |
| 12 |
|
| 13 |
Copyright (C) 1995-1997 Brian Paul |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
Disclaimer |
| 18 |
========== |
| 19 |
|
| 20 |
Mesa is a 3-D graphics library with an API which is very similar to that |
| 21 |
of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax |
| 22 |
or state machine, it is being used with authorization from Silicon Graphics, |
| 23 |
Inc. However, the author makes no claim that Mesa is in any way a |
| 24 |
compatible replacement for OpenGL or associated with Silicon Graphics, Inc. |
| 25 |
Those who want a licensed implementation of OpenGL should contact a licensed |
| 26 |
vendor. This software is distributed under the terms of the GNU Library |
| 27 |
General Public License, see the LICENSE file for details. |
| 28 |
|
| 29 |
* OpenGL(R) is a registered trademark of Silicon Graphics, Inc. |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
Author |
| 34 |
====== |
| 35 |
|
| 36 |
Brian Paul |
| 37 |
Avid Technology |
| 38 |
6400 EnterPrise Lane, Suite 201 |
| 39 |
Madison, WI 53719 |
| 40 |
|
| 41 |
[email protected] |
| 42 |
|
| 43 |
Formerly employed at the Space Science and Engineering Center at the |
| 44 |
University of Wisconsin - Madison. |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
Introduction |
| 49 |
============ |
| 50 |
|
| 51 |
While Mesa uses the OpenGL API and mimics its semantics, it is |
| 52 |
important to understand that Mesa is not a real implementation of OpenGL |
| 53 |
since it is not licensed and has not been tested by the OpenGL conformance |
| 54 |
tests. That said, Mesa is still a viable alternative to OpenGL. |
| 55 |
|
| 56 |
Since version 2.0 Mesa implements the OpenGL 1.1 API specification. |
| 57 |
Only a few features are not yet implemented: |
| 58 |
|
| 59 |
trimmed NURBS |
| 60 |
line and polygon antialiasing |
| 61 |
glGetPolygonStipple function |
| 62 |
glGetTexImage |
| 63 |
|
| 64 |
|
| 65 |
The primary design goal of this library has been correctness. Common |
| 66 |
code paths are optimized for speed. If you find that a particular |
| 67 |
rendering operation is slow let me know about it. It may be a simple |
| 68 |
matter to optimize the operation in question. |
| 69 |
|
| 70 |
I've been working on this library in my spare time since August, 1993. |
| 71 |
The core library was originally written on an Amiga using the DCC compiler. |
| 72 |
Later, development was moved to an SGI workstation. Current development |
| 73 |
is done on SGI and PC/Linux systems. |
| 74 |
|
| 75 |
Mesa works on most Unix workstations with ANSI C and X11. There are also |
| 76 |
drivers for Amiga, Microsoft Windows, Macintosh, MS DOS, NeXT, and BeOS |
| 77 |
systems. Look below for more information. |
| 78 |
|
| 79 |
Since the OpenGL API is used, OpenGL documentation can serve as the |
| 80 |
documentation for Mesa's core functions. Here are a few sources: |
| 81 |
|
| 82 |
WWW Center: http://www.sgi.com/Technology/openGL/ |
| 83 |
Man pages: http://www.digital.com:80/pub/doc/opengl/ |
| 84 |
Spec doc: http://www.sgi.com/Technology/openGL/glspec/glspec.html |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
Getting the software |
| 89 |
==================== |
| 90 |
|
| 91 |
The primary Mesa ftp site is iris.ssec.wisc.edu in the pub/Mesa directory. |
| 92 |
Mesa is also mirrored on sunsite in the directory pub/packages/development |
| 93 |
/graphics/mesa. |
| 94 |
|
| 95 |
|
| 96 |
The archive file Mesa-2.2.tar.Z can be unpacked with: |
| 97 |
zcat Mesa-2.2.tar.Z | tar xf - |
| 98 |
|
| 99 |
The archive file Mesa-2.2.tar.gz can be unpacked with: |
| 100 |
gzcat Mesa-2.2.tar.gz | tar xf - |
| 101 |
|
| 102 |
The archive file Mesa-2.2.zip can be unpacked with: |
| 103 |
unzip Mesa-2.2.zip |
| 104 |
|
| 105 |
|
| 106 |
After you unpacking you should have the following files in the Mesa-2.2 |
| 107 |
directory: |
| 108 |
|
| 109 |
README - this file |
| 110 |
README.AMIWIN - instructions for using Mesa on Amigas with AmiWin (X11) |
| 111 |
README.GLUT - instructions for using Mesa with GLUT |
| 112 |
README.OS2 - instructions for using Mesa with OS/2 and XFree86 |
| 113 |
README.DOS - instructions for using Mesa with MS-DOS |
| 114 |
README.VMS - instructions for using Mesa with VMS |
| 115 |
LICENSE - the GNU library license |
| 116 |
IAFA-PACKAGE - description file |
| 117 |
VERSIONS - version history |
| 118 |
Makefile - top-level Makefile |
| 119 |
Make-config - system configurations used by the Makefiles |
| 120 |
Imakefile - for OS/2 |
| 121 |
mklib.* - shell scripts for making shared libraries for some systems |
| 122 |
include/ - client include files |
| 123 |
lib/ - client libraries, created during installation |
| 124 |
src/ - source code for core library |
| 125 |
src-glu/ - source code for utility library |
| 126 |
src-tk/ - source code for tk library |
| 127 |
src-aux/ - source code for aux library |
| 128 |
demos/ - demo programs |
| 129 |
samples/ - sample OpenGL programs from SGI |
| 130 |
book/ - example programs from the OpenGL Programming Guide |
| 131 |
util/ - handly utility functions |
| 132 |
widgets-mesa/ - Mesa widgets for Xt/Motif |
| 133 |
widgets-sgi/ - SGI OpenGL widgets for Xt/Motif |
| 134 |
windows/ - Microsoft Windows driver stuff, from Mesa 1.2.x |
| 135 |
NeXT/ - NeXT demo programs |
| 136 |
BeOS/ - BeOS demo programs |
| 137 |
mondello/ - Cirrus Logic Mondello 3-D accelerator code |
| 138 |
*mms* - makefiles for VMS |
| 139 |
OpenStep/ - OpenStep files |
| 140 |
mesa3dfx/ - David Bucciarelli's 3Dfx code |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
Installation for Unix/X11 |
| 146 |
========================= |
| 147 |
|
| 148 |
To compile the library, first type 'make' alone to see the list of system |
| 149 |
configurations currently supported. If you see your configuration on the |
| 150 |
list, type 'make <config>'. Most popular Unix/X workstations are currently |
| 151 |
supported. |
| 152 |
|
| 153 |
The top-level makefile will execute the makefiles in a number of sub- |
| 154 |
directories. When finished, there should be executables in the "demos/", |
| 155 |
"samples/", and "book/" directories for you to try out. If you only want |
| 156 |
to compile the contents of one subdirectory you can 'cd' to that directory |
| 157 |
and type 'make <config>' there. For example, to just compile the main |
| 158 |
Mesa library: cd src ; make <config> |
| 159 |
|
| 160 |
If your system configuration is not listed by 'make', you'll have to modify |
| 161 |
the top-level Makefile and Make-config files. There are instructions in |
| 162 |
each file. |
| 163 |
|
| 164 |
If you have compilation problems you should try to fix them and return the |
| 165 |
patches to the author. |
| 166 |
|
| 167 |
|
| 168 |
Header and library files: |
| 169 |
After you've compiled Mesa and tried the demos I recommend the following |
| 170 |
procedure for "installing" Mesa. |
| 171 |
|
| 172 |
Copy the Mesa include/GL directory to /usr/local/include: |
| 173 |
cp -r include/GL /usr/local/include |
| 174 |
|
| 175 |
Copy the Mesa library files to /usr/local/lib: |
| 176 |
cp lib/* /usr/local/lib |
| 177 |
|
| 178 |
Create a few symbolic links so that compiling OpenGL applications is easy: |
| 179 |
cd /usr/local/lib |
| 180 |
IF USING STATIC (lib*.a) FILES THEN |
| 181 |
ln -s libMesaGL.a libGL.a |
| 182 |
ln -s libMesaGLU.a libGLU.a |
| 183 |
ELSE |
| 184 |
ln -s libMesaGL.so libGL.so |
| 185 |
ln -s libMesaGLU.so libGLU.so |
| 186 |
ENDIF |
| 187 |
|
| 188 |
|
| 189 |
Xt/Motif widgets: |
| 190 |
If you want to use Mesa or OpenGL in your Xt/Motif program you can build |
| 191 |
the widgets found in either the widgets-mesa or widgets-sgi directories. |
| 192 |
The former were written for Mesa and the later are the original SGI |
| 193 |
widgets. Look in those directories for more information. |
| 194 |
|
| 195 |
|
| 196 |
Notes: |
| 197 |
HP users: a Mesa user reports that the HP-UX 10.01 C compiler has |
| 198 |
a bug which effects glReadPixels. A patch for the compiler (PHSS_5743) is |
| 199 |
available. Otherwise be sure your compiler is version 10.13 or later. |
| 200 |
|
| 201 |
QNX users: if you have problems running the demos try setting the |
| 202 |
stack size to 200K or larger with -N200K, for example. |
| 203 |
|
| 204 |
SunOS 5.x users: The X shared memory extension may not work |
| 205 |
correctly. If Mesa prints an error message to the effect of "Shared memory |
| 206 |
error" then you'll have to append the following three lines to the end of |
| 207 |
your /etc/system file then reboot: |
| 208 |
set shmsys:shminfo_shmmax = 0x2000000 |
| 209 |
set shmsys:shminfo_shmmni = 0x1000 |
| 210 |
set shmsys:shminfo_shmseg = 0x100 |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
Installation for Amigas |
| 215 |
======================= |
| 216 |
|
| 217 |
See http://www.efd.lth.se/~d94sz/amesa for the latest version of the Amiga |
| 218 |
driver. |
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
Installation for Microsoft Windows |
| 223 |
================================== |
| 224 |
|
| 225 |
See the windows/README file for more information. |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
Installation for Macintosh |
| 230 |
========================== |
| 231 |
|
| 232 |
From ftp://iris.ssec.wisc.edu/pub/Mesa/contrib download these files: |
| 233 |
mesa0.31b.sit.hqx |
| 234 |
GLUT4Mac.sit.hqx |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
Installation for NeXT |
| 239 |
===================== |
| 240 |
|
| 241 |
Simply typing "make next" should compile Mesa and a number of NeXT demo |
| 242 |
programs found in the NeXT/ directory. The NeXT driver is implemented |
| 243 |
through Mesa's Off-Screen rendering interface. |
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
Installation for BeOS |
| 248 |
===================== |
| 249 |
|
| 250 |
Simply typing "make beos" should compile Mesa and a number of BeOS demo |
| 251 |
programs found in the BeOS/ directory. The BeOS driver is implemented |
| 252 |
through Mesa's Off-Screen rendering interface. |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
Installation for OS/2 |
| 257 |
===================== |
| 258 |
|
| 259 |
*** Mesa 2.x does not currently work on OS/2 *** |
| 260 |
|
| 261 |
See the README.OS2 file for details. |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
Installation for VMS |
| 266 |
==================== |
| 267 |
|
| 268 |
See the README.VMS file for more information. |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
Installation for MS-DOS |
| 273 |
======================= |
| 274 |
|
| 275 |
See the README.DOS file for more information. |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
Installation for OpenStep |
| 280 |
========================= |
| 281 |
|
| 282 |
See the OpenStep/README file for more information. |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
Using the library |
| 287 |
================= |
| 288 |
|
| 289 |
Configuration options: |
| 290 |
The file src/config.h has many parameters which you can adjust such |
| 291 |
as maximum number of lights, clipping planes, maximum texture size, |
| 292 |
etc. In particular, you may want to change DEPTH_BITS from 16 to 32 |
| 293 |
if a 16-bit depth buffer isn't precise enough for your application. |
| 294 |
|
| 295 |
|
| 296 |
Shared libraries: |
| 297 |
If you compile shared libraries you may have to set an environment |
| 298 |
variable to specify where the Mesa libraries are located. On Linux and |
| 299 |
Sun systems for example, set the LD_LIBRARY_PATH variable to include |
| 300 |
/your-dir/Mesa-2.2/lib. Otherwise, when you try to run a demo it |
| 301 |
may fail with a message saying that one or more libraries couldn't be |
| 302 |
found. |
| 303 |
|
| 304 |
|
| 305 |
Remote display of OpenGL/GLX programs: |
| 306 |
As of version 1.2.3, Mesa's header files use the same GLenum and GLUenum |
| 307 |
values as SGI's (and most/all other vendor's) OpenGL headers. This means |
| 308 |
you can freely mix object files compiled with OpenGL or Mesa headers. |
| 309 |
In fact, on systems with dynamic runtime linkers it's possible to dynam- |
| 310 |
ically link with Mesa or OpenGL shared libraries at runtime, without |
| 311 |
recompiling or relinking anything! |
| 312 |
|
| 313 |
Using IRIX 5.x as an example, you can run SGI's OpenGL demos with the |
| 314 |
Mesa shared libraries as follows. Let's assume you're installing Mesa |
| 315 |
in /usr/local/Mesa and using the C-shell: |
| 316 |
% cd /usr/local/Mesa |
| 317 |
% make irix5-dso |
| 318 |
% cd lib |
| 319 |
% ln -s libMesaGL.so libGL.so |
| 320 |
% setenv _RLD_LIST "/usr/local/Mesa/lib/libGL.so:DEFAULT" |
| 321 |
% /usr/demos/bin/ideas_ogl // this is a test |
| 322 |
|
| 323 |
You can now run OpenGL executables on almost any X display! There may |
| 324 |
be some problems from the fact that Mesa supports many X visual types |
| 325 |
that an OpenGL client may not expect (grayscale for example). In this |
| 326 |
case the application may abort, print error messages, or just behave |
| 327 |
strangely. You may have to experiment with the MESA_RGB_VISUAL envi- |
| 328 |
ronment variable. |
| 329 |
|
| 330 |
|
| 331 |
Toolkits (X11 only): |
| 332 |
Mesa includes the glaux and gltk libraries from SGI. Their only real |
| 333 |
use is for writing simple demo programs. It is highly recommended that |
| 334 |
you do _not_ use these libraries for your own programs. There are |
| 335 |
several alternatives: |
| 336 |
|
| 337 |
1. GLUT (OpenGL Utility Toolkit) was written by Mark Kilgard of SGI |
| 338 |
as a replacement for glaux and gltk. It provides a simple, portable, |
| 339 |
window-system independent interface allowing you to write OpenGL |
| 340 |
applications quickly and easily. GLUT isn't included with Mesa but |
| 341 |
you'll find instructions on how to get and build GLUT in the file |
| 342 |
README.GLUT. The second edition of the OpenGL Programming Guide, |
| 343 |
published by Addison Wesley uses GLUT instead of the glaux library. |
| 344 |
|
| 345 |
2. Use an Xt/Motif widget. Look in the widgets-old/ or widgets-sgi |
| 346 |
directories for more info. |
| 347 |
|
| 348 |
3. If you use Tcl/Tk you should consider Togl. See |
| 349 |
http://www.ssec.wisc.edu/~brianp/Togl.html for more information. |
| 350 |
|
| 351 |
4. Use the GLX (simulated since Mesa doesn't implement the GLX proto- |
| 352 |
col) functions. These functions look like, and try to act like, the |
| 353 |
real GLX functions used by OpenGL in conjunction with the X window |
| 354 |
system. |
| 355 |
|
| 356 |
|
| 357 |
Performance tips: |
| 358 |
1. Turn off smooth shading when you don't need it (glShadeModel) |
| 359 |
2. Turn off depth buffering when you don't need it. |
| 360 |
3. Turn off dithering when not needed. |
| 361 |
4. Use double buffering as it's often faster than single buffering |
| 362 |
5. Compile in the X Shared Memory extension option if it's supported |
| 363 |
on your system by adding -DSHM to CFLAGS and -lXext to XLIBS for |
| 364 |
your system in the Make-config file. |
| 365 |
6. Recompile Mesa with more optimization if possible. |
| 366 |
7. Try to maximize the amount of drawing done between glBegin/glEnd pairs. |
| 367 |
8. Use the MESA_BACK_BUFFER variable to find best performance in double |
| 368 |
buffered mode. (X users only) |
| 369 |
9. Optimized polygon rasterizers are employed when: |
| 370 |
rendering into back buffer which is an XImage |
| 371 |
RGB mode, not grayscale, not monochrome |
| 372 |
depth buffering is GL_LESS, or disabled |
| 373 |
flat or smooth shading |
| 374 |
dithered or non-dithered |
| 375 |
no other rasterization operations enabled (blending, stencil, etc) |
| 376 |
10. Optimized line drawing is employed when: |
| 377 |
rendering into back buffer which is an XImage |
| 378 |
RGB mode, not grayscale, not monochrome |
| 379 |
depth buffering is GL_LESS or disabled |
| 380 |
flat shading |
| 381 |
dithered or non-dithered |
| 382 |
no other rasterization operations enabled (blending, stencil, etc) |
| 383 |
11. Textured polygons are fastest when: |
| 384 |
using a 3-component (RGB), 2-D texture |
| 385 |
minification and magnification filters are GL_NEAREST |
| 386 |
texture coordinate wrap modes for S and T are GL_REPEAT |
| 387 |
GL_DECAL environment mode |
| 388 |
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ) |
| 389 |
depth buffering is GL_LESS or disabled |
| 390 |
12. Lighting is fastest when: |
| 391 |
Two-sided lighting is disabled |
| 392 |
GL_LIGHT_MODEL_LOCAL_VIEWER is false |
| 393 |
GL_COLOR_MATERIAL is disabled |
| 394 |
No spot lights are used (all GL_SPOT_CUTOFFs are 180.0) |
| 395 |
No local lights are used (all position W's are 0.0) |
| 396 |
All material and light coefficients are >= zero |
| 397 |
13. XFree86 users: if you want to use 24-bit color try starting your |
| 398 |
X server in 32-bit per pixel mode for better performance. That is, |
| 399 |
start your X server with |
| 400 |
startx -- -bpp 32 |
| 401 |
instead of |
| 402 |
startx -- -bpp 24 |
| 403 |
|
| 404 |
|
| 405 |
Debugging: |
| 406 |
Normally Mesa records but does not notify the user of errors. It is up |
| 407 |
to the application to call glGetError to check for errors. Mesa supports |
| 408 |
an environment variable, MESA_DEBUG, to help with debugging. If MESA_DEBUG |
| 409 |
is defined, a message will be printed to stdout whenever an error occurs. |
| 410 |
|
| 411 |
More extensive error checking is done when Mesa is compiled with the |
| 412 |
DEBUG symbol defined. You'll have to edit the Make-config file and |
| 413 |
add -DDEBUG to the CFLAGS line for your system configuration. You may |
| 414 |
also want to replace any optimization flags with the -g flag so you can |
| 415 |
use your debugger. After you've edited Make-config type 'make clean' |
| 416 |
before recompiling. |
| 417 |
|
| 418 |
In your debugger you can set a breakpoint in gl_error() to trap Mesa |
| 419 |
errors. |
| 420 |
|
| 421 |
There is a display list printing/debugging facility. See the end of |
| 422 |
src/dlist.c for details. |
| 423 |
|
| 424 |
|
| 425 |
X Display Modes: |
| 426 |
Mesa supports rendering in most X visual types and depths. When a |
| 427 |
TrueColor or DirectColor visual isn't available dithering is used in RGB |
| 428 |
mode. |
| 429 |
|
| 430 |
The glXChooseVisual function tries its best to pick an appropriate visual |
| 431 |
for the given attribute list. However, if this doesn't suit your needs |
| 432 |
you can force Mesa to use any X visual you want (any supported by your |
| 433 |
X server that is) by setting the MESA_RGB_VISUAL and MESA_CI_VISUAL |
| 434 |
environment variables. When an RGB visual is requested, glXChooseVisual |
| 435 |
will first look if the MESA_RGB_VISUAL variable is defined. If so, it |
| 436 |
will try to use the specified visual. Similarly, when a color index |
| 437 |
visual is requested, glXChooseVisual will look for the MESA_CI_VISUAL |
| 438 |
variable. |
| 439 |
|
| 440 |
The format of accepted values is: <visual-class> <depth> |
| 441 |
Here are some examples: |
| 442 |
|
| 443 |
using the C-shell: |
| 444 |
% setenv MESA_RGB_VISUAL "TrueColor 8" // 8-bit TrueColor |
| 445 |
% setenv MESA_CI_VISUAL "PseudoColor 12" // 12-bit PseudoColor |
| 446 |
% setenv MESA_RGB_VISUAL "PseudoColor 8" // 8-bit PseudoColor |
| 447 |
|
| 448 |
using the KornShell: |
| 449 |
$ export MESA_RGB_VISUAL="TrueColor 8" |
| 450 |
$ export MESA_CI_VISUAL="PseudoColor 12" |
| 451 |
$ export MESA_RGB_VISUAL="PseudoColor 8" |
| 452 |
|
| 453 |
|
| 454 |
Double buffering (X11 only): |
| 455 |
Mesa can use either an X Pixmap or XImage as the backbuffer when in |
| 456 |
double buffer mode. Using GLX, the default is to use an XImage. The |
| 457 |
MESA_BACK_BUFFER environment variable can override this. The valid |
| 458 |
values for MESA_BACK_BUFFER are: Pixmap and XImage (only the first |
| 459 |
letter is checked, case doesn't matter). |
| 460 |
|
| 461 |
A pixmap is faster when drawing simple lines and polygons while an |
| 462 |
XImage is faster when Mesa has to do pixel-by-pixel rendering. If you |
| 463 |
need depth buffering the XImage will almost surely be faster. Exper- |
| 464 |
iment with the MESA_BACK_BUFFER variable to see which is faster for |
| 465 |
your application. |
| 466 |
|
| 467 |
|
| 468 |
Colormaps (X11 only): |
| 469 |
When using Mesa directly or with GLX, it's up to the application writer |
| 470 |
to create a window with an appropriate colormap. The aux, tk, and GLUT |
| 471 |
toolkits try to minimize colormap "flashing" by sharing colormaps when |
| 472 |
possible. Specifically, if the visual and depth of the window matches |
| 473 |
that of the root window, the root window's colormap will be shared by |
| 474 |
the Mesa window. Otherwise, a new, private colormap will be allocated. |
| 475 |
|
| 476 |
When sharing the root colormap, Mesa may be unable to allocate the colors |
| 477 |
it needs, resulting in poor color quality. This can happen when a |
| 478 |
large number of colorcells in the root colormap are already allocated. |
| 479 |
To prevent colormap sharing in aux, tk and GLUT, define the environment |
| 480 |
variable MESA_PRIVATE_CMAP. The value isn't significant. |
| 481 |
|
| 482 |
|
| 483 |
Fortran bindings: |
| 484 |
Fortan bindings are no longer included with Mesa. William F. Mitchell |
| 485 |
([email protected]) has developed a new set of Mesa/OpenGL and |
| 486 |
GLUT bindings for Fortran. See http://math.nist.gov/f90gl for more |
| 487 |
information. |
| 488 |
|
| 489 |
|
| 490 |
Gamma correction (X11 only): |
| 491 |
To compensate for the nonlinear relationship between pixel values |
| 492 |
and displayed intensities, there is a gamma correction feature in |
| 493 |
Mesa. Some systems, such as Silicon Graphics, support gamma |
| 494 |
correction in hardware (man gamma) so you won't need to use Mesa's |
| 495 |
gamma facility. Other systems, however, may need gamma adjustment |
| 496 |
to produce images which look correct. If in the past you thought |
| 497 |
Mesa's images were too dim, read on. |
| 498 |
|
| 499 |
Gamma correction is controlled with the MESA_GAMMA environment |
| 500 |
variable. Its value is of the form "Gr Gg Gb" or just "G" where |
| 501 |
Gr is the red gamma value, Gg is the green gamma value, Gb is the |
| 502 |
blue gamma value and G is one gamma value to use for all three |
| 503 |
channels. Each value is a positive real number typically in the |
| 504 |
range 1.0 to 2.5. The defaults are all 1.0, effectively disabling |
| 505 |
gamma correction. Examples using csh: |
| 506 |
|
| 507 |
% setenv MESA_GAMMA "2.3 2.2 2.4" // separate R,G,B values |
| 508 |
% setenv MESA_GAMMA "2.0" // same gamma for R,G,B |
| 509 |
|
| 510 |
The demos/gamma.c program may help you to determine reasonable gamma |
| 511 |
value for your display. With correct gamma values, the color intensities |
| 512 |
displayed in the top row (drawn by dithering) should nearly match those |
| 513 |
in the bottom row (drawn as grays). |
| 514 |
|
| 515 |
Alex De Bruyn reports that gamma values of 1.6, 1.6 and 1.9 work well |
| 516 |
on HP displays using the HP-ColorRecovery technology. |
| 517 |
|
| 518 |
Mesa implements gamma correction with a lookup table which translates |
| 519 |
a "linear" pixel value to a gamma-corrected pixel value. There is a |
| 520 |
small performance penalty. Gamma correction only works in RGB mode. |
| 521 |
Also be aware that pixel values read back from the frame buffer will |
| 522 |
not be "un-corrected" so glReadPixels may not return the same data |
| 523 |
drawn with glDrawPixels. |
| 524 |
|
| 525 |
For more information about gamma correction see: |
| 526 |
http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html |
| 527 |
|
| 528 |
|
| 529 |
Off-screen rendering: |
| 530 |
Mesa 1.2.4 introduced off-screen rendering, a facility for generating |
| 531 |
3-D imagery without having to open a window on your display. Mesa's |
| 532 |
simple off-screen rendering interface is completely operating system |
| 533 |
and window system independent so programs which use off-screen rendering |
| 534 |
should be very portable. This new feature effectively enables you to |
| 535 |
use Mesa as an off-line, batch-oriented renderer. |
| 536 |
|
| 537 |
The "OSMesa" API provides 3 functions for making off-screen renderings: |
| 538 |
OSMesaCreateContext(), OSMesaMakeCurrent(), and OSMesaDestroyContext(). |
| 539 |
See the Mesa/include/GL/osmesa.h header for more information. See the |
| 540 |
demos/osdemo.c file for an example program. There is no facility for |
| 541 |
writing images to files. |
| 542 |
|
| 543 |
If you want to generate large images (larger than 1280x1024) you'll |
| 544 |
have to edit the src/config.h file to change MAX_WIDTH and MAX_HEIGHT |
| 545 |
then recompile Mesa. Image size should only be limited by available |
| 546 |
memory. |
| 547 |
|
| 548 |
|
| 549 |
Profiling: |
| 550 |
Mesa 1.2.6 introduced a simple profiling facility. It counts and |
| 551 |
measures the time spent in a number of important rendering operations |
| 552 |
and prints the information in a report before your program exits. |
| 553 |
|
| 554 |
By default, profiling is disabled. To enable it, add -DPROFILE to |
| 555 |
the appropriate CFLAGS entry in the Make-config file, then recompile |
| 556 |
Mesa. In general, you should only enable profiling during program |
| 557 |
development to gain insight into Mesa's performance. Mesa runs a bit |
| 558 |
slower when profiling is enabled because it requires frequent polling |
| 559 |
of the system clock. |
| 560 |
|
| 561 |
The profiling report will be printed when glXDestroyContext is called |
| 562 |
_if_ the MESA_PROFILE environment variable is set. You must be sure |
| 563 |
glXDestroyContext is called before exiting to get the profile report. |
| 564 |
The report will be printed to stdout and includes: |
| 565 |
|
| 566 |
glBegin/glEnd - number of glBegin/glEnd pairs called, total time, |
| 567 |
and rate in pairs/second. |
| 568 |
vertexes transformed - number of vertices transformed, lit, clip- |
| 569 |
tested, fogged, and mapped to window coordinates, total time, |
| 570 |
and rate in vertexes/second. |
| 571 |
points rasterized - number of points drawn, time, and rate. |
| 572 |
lines rasterized - number of lines drawn, time, and rate. |
| 573 |
polygons rasterized - number of polygons drawn, time and rate. |
| 574 |
overhead - time between glBegin/glEnd not accounted for by vertexes, |
| 575 |
points, lines, and polygons. This is time spent executing |
| 576 |
glVertex, glNormal, glColor, etc, clipping, primitive assembly, |
| 577 |
and user code between glBegin/glEnd. |
| 578 |
glClear - number of glClears executed, total time and clears/second. |
| 579 |
SwapBuffers - number of swaps executed, total time and swaps/second. |
| 580 |
|
| 581 |
Note that the real point, line, and polygon rates should be computed by |
| 582 |
adding in the vertex transformation and overhead time factors. |
| 583 |
|
| 584 |
|
| 585 |
Linux SVGA driver: |
| 586 |
Mesa 1.2.6 has a preliminary Linux SVGA driver for Mesa. It's based |
| 587 |
on the SVGA library included with Linux. The driver isn't finished |
| 588 |
yet. I'm not too familiar with SVGA graphics so I could use some help |
| 589 |
finishing it. Contact Brian if you want to help. |
| 590 |
|
| 591 |
To enable the SVGA driver, edit the Make-config file and add -DSVGA to |
| 592 |
the CFLAGS for Linux and add -lvga to the LIBS variable. There are |
| 593 |
several test programs (vtest.c, vgears.c, vindex.c) in the demos |
| 594 |
directory. See the include/GL/svgamesa.h and src/svgamesa.c files for |
| 595 |
more information about the driver. |
| 596 |
|
| 597 |
|
| 598 |
Extensions: |
| 599 |
The following OpenGL extensions are currently implemented: |
| 600 |
|
| 601 |
GL_EXT_blend_color - allows blending with a constant color |
| 602 |
GL_EXT_blend_minmax - blend min/max operator |
| 603 |
GL_EXT_blend_logic_op - allows glLogicOp to work in RGBA mode |
| 604 |
GL_EXT_blend_subtract - blend subtraction operator |
| 605 |
GL_EXT_vertex_array - vertex array extension |
| 606 |
GLX_EXT_visual_info - GLX visual and transparent pixel extension |
| 607 |
|
| 608 |
For detailed information about the extensions see: |
| 609 |
ftp://sgigate.sgi.com/pub/opengl/extensions/ |
| 610 |
|
| 611 |
There are four Mesa-specific GL/GLX extensions at this time. |
| 612 |
|
| 613 |
GLX_MESA_pixmap_colormap |
| 614 |
|
| 615 |
This extension adds the GLX function: |
| 616 |
|
| 617 |
GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, |
| 618 |
Pixmap pixmap, Colormap cmap ) |
| 619 |
|
| 620 |
It is an alternative to the standard glXCreateGLXPixmap() function. |
| 621 |
Since Mesa supports RGB rendering into any X visual, not just True- |
| 622 |
Color or DirectColor, Mesa needs colormap information to convert RGB |
| 623 |
values into pixel values. An X window carries this information but a |
| 624 |
pixmap does not. This function associates a colormap to a GLX pixmap. |
| 625 |
See the demos/glxpixmap.c file for an example of how to use this |
| 626 |
extension. |
| 627 |
|
| 628 |
GLX_MESA_release_buffers |
| 629 |
|
| 630 |
Mesa associates a set of ancillary (depth, accumulation, stencil and |
| 631 |
alpha) buffers with each X window it draws into. These ancillary |
| 632 |
buffers are allocated for each X window the first time the X window |
| 633 |
is passed to glXMakeCurrent(). Mesa, however, can't detect when an |
| 634 |
X window has been destroyed in order to free the ancillary buffers. |
| 635 |
|
| 636 |
The best it can do is to check for recently destroyed windows whenever |
| 637 |
the client calls the glXCreateContext() or glXDestroyContext() |
| 638 |
functions. This may not be sufficient in all situations though. |
| 639 |
|
| 640 |
The GLX_MESA_release_buffers extension allows a client to explicitly |
| 641 |
deallocate the ancillary buffers by calling glxReleaseBuffersMESA() |
| 642 |
just before an X window is destroyed. For example: |
| 643 |
|
| 644 |
#ifdef GLX_MESA_release_buffers |
| 645 |
glXReleaseBuffersMESA( dpy, window ); |
| 646 |
#endif |
| 647 |
XDestroyWindow( dpy, window ); |
| 648 |
|
| 649 |
This extension is new in Mesa 2.0. |
| 650 |
|
| 651 |
GL_MESA_window_pos |
| 652 |
|
| 653 |
This extension adds the glWindowPos*MESA() functions. These functions |
| 654 |
are convenient alternatives to glRasterPos*() because they set the |
| 655 |
current raster position to a specific window coordinate, bypassing the |
| 656 |
usual modelview, projection and viewport transformations. This is |
| 657 |
especially useful for setting the position for glDrawPixels() or |
| 658 |
glBitmap() to a specific window coordinate. |
| 659 |
|
| 660 |
X and Y parameters (positive and negative) are directly mapped to |
| 661 |
window coordinates. Z is a depth value clamped to the range [0,1]. |
| 662 |
W is directly mapped. The current raster position valid flag is |
| 663 |
always set to true. The current raster distance is set to zero. |
| 664 |
The current raster color and texture coordinate are updated in the |
| 665 |
same manner as glRasterPos(). In selection mode a hit record is |
| 666 |
always generated. |
| 667 |
|
| 668 |
Programs using OpenGL, not Mesa, may also use the glWindowPos*MESA() |
| 669 |
functions by including winpos.h from the src directory and by |
| 670 |
compiling and linking with the winpos.c file from the src directory. |
| 671 |
|
| 672 |
GL_MESA_resize_buffers |
| 673 |
|
| 674 |
This extension adds the glResizeBuffersMESA() function. When this |
| 675 |
function is called, Mesa checks if the color buffer (window) has |
| 676 |
been resized. If it has, Mesa reallocates the ancillary (depth, |
| 677 |
stencil, accum) buffers. |
| 678 |
|
| 679 |
Normally, Mesa checks for window size changes whenever glViewport() |
| 680 |
is called. In some applications it may not be appropriate to call |
| 681 |
glViewport() when the window is resized. Such applications should |
| 682 |
call glResizeBuffersMESA() instead so the ancillary buffers are |
| 683 |
correctly updated. |
| 684 |
|
| 685 |
This extension is new in version 2.2. |
| 686 |
|
| 687 |
|
| 688 |
Version 2.x features: |
| 689 |
Version 2.x of Mesa implements the OpenGL 1.1 API. The following |
| 690 |
functions are new in Mesa 2.x: |
| 691 |
|
| 692 |
Texture mapping: |
| 693 |
glAreTexturesResident |
| 694 |
glBindTexture |
| 695 |
glCopyTexImage1D |
| 696 |
glCopyTexImage2D |
| 697 |
glCopyTexSubImage1D |
| 698 |
glCopyTexSubImage2D |
| 699 |
glDeleteTextures |
| 700 |
glGenTextures |
| 701 |
glIsTexture |
| 702 |
glPrioritizeTextures |
| 703 |
glTexSubImage1D |
| 704 |
glTexSubImage2D |
| 705 |
|
| 706 |
Vertex Arrays: |
| 707 |
glArrayElement |
| 708 |
glColorPointer |
| 709 |
glDrawElements |
| 710 |
glEdgeFlagPointer |
| 711 |
glIndexPointer |
| 712 |
glInterleavedArrays |
| 713 |
glNormalPointer |
| 714 |
glTexCoordPointer |
| 715 |
glVertexPointer |
| 716 |
|
| 717 |
Client state management: |
| 718 |
glDisableClientState |
| 719 |
glEnableClientState |
| 720 |
glPopClientAttrib |
| 721 |
glPushClientAttrib |
| 722 |
|
| 723 |
Misc: |
| 724 |
glGetPointer |
| 725 |
glIndexub |
| 726 |
glIndexubv |
| 727 |
glPolygonOffset |
| 728 |
|
| 729 |
|
| 730 |
Summary of environment variables: |
| 731 |
MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only) |
| 732 |
MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only) |
| 733 |
MESA_BACKBUFFER - specifies how to implement the back color buffer (X only) |
| 734 |
MESA_DEBUG - if defined, error messages are printed to stderr |
| 735 |
MESA_PRIVATE_CMAP - force aux/tk libraries to use private colormaps (X only) |
| 736 |
MESA_GAMMA - gamma correction coefficients (X only) |
| 737 |
MESA_PROFILE - enable reporting of performance measurements |
| 738 |
MESA_XSYNC - enable synchronous X behavior (for debugging only) |
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
Mailing List |
| 743 |
============ |
| 744 |
|
| 745 |
There is a Mesa mailing list. Its purpose is to let Mesa users exchange |
| 746 |
any ideas, questions, and/or problems they have. To subscribe, send the |
| 747 |
following message to the address [email protected] |
| 748 |
|
| 749 |
add [email protected] mesa |
| 750 |
|
| 751 |
For example: |
| 752 |
|
| 753 |
add [email protected] mesa |
| 754 |
|
| 755 |
You will receive a welcome message from the list server when you have been |
| 756 |
added to the list. |
| 757 |
|
| 758 |
To unsubscribe from the list send the following message to |
| 759 |
[email protected] |
| 760 |
|
| 761 |
del [email protected] mesa |
| 762 |
|
| 763 |
Thanks to Pedro Vazquez ([email protected]) for setting up and |
| 764 |
maintaing the list. |
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
WWW Page |
| 769 |
======== |
| 770 |
|
| 771 |
There is a Mesa WWW page: http://www.ssec.wisc.edu/~brianp/Mesa.html |
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
Contributed code |
| 776 |
================ |
| 777 |
|
| 778 |
There is a contrib/ subdirectory on the Mesa ftp site which contains |
| 779 |
contributions from Mesa users. See the README file in that directory for |
| 780 |
more information. |
| 781 |
|
| 782 |
Anyone is welcome to contribute code to the Mesa project, provided you |
| 783 |
agree to the GNU license. |
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
Reporting Bugs |
| 788 |
============== |
| 789 |
|
| 790 |
If you think you've found a bug in Mesa first check if a newer version of |
| 791 |
Mesa is available. Next, check ftp://iris.ssec.wisc.edu/pub/Mesa to see |
| 792 |
if a patch for your bug is there. Otherwise, report the problem. |
| 793 |
|
| 794 |
Since many people have contributed code to Mesa it's important that you |
| 795 |
report a bug to the right person: |
| 796 |
|
| 797 |
Area Contact |
| 798 |
---------------------- ------------------------------------------- |
| 799 |
GLU polygon tessellator Bogdan Sikorski [email protected] |
| 800 |
GLU NURBS Bogdan Sikorski [email protected] |
| 801 |
Evaluators Bernd Barsuhn [email protected] |
| 802 |
Xt/Motif widgets Thorsten Ohl [email protected] |
| 803 |
and Jeroen van der Zijp [email protected] |
| 804 |
Fortran bindings William Mitchell [email protected] |
| 805 |
Amiga driver Stefan Zivkovic [email protected] |
| 806 |
Amiwin driver Victor Ng-Thow-Hing [email protected] |
| 807 |
Macintosh driver Miklos Fazekas [email protected] |
| 808 |
NeXT driver Pascal Thibaudeau [email protected] |
| 809 |
OS/2 driver Darren Abbott [email protected] |
| 810 |
VMS support Jouk Jansen [email protected] |
| 811 |
Windows 95/NT driver Li Wei [email protected] |
| 812 |
MS-DOS driver Charlie Wallace [email protected] |
| 813 |
BeOS driver Tinic Uro [email protected] |
| 814 |
GLX encoder/decoder Steven Parker [email protected] |
| 815 |
3Dfx driver David Bucciarelli [email protected] |
| 816 |
Mailing list help Pedro Vazquez [email protected] |
| 817 |
|
| 818 |
EVERYTHING ELSE--> Brian Paul [email protected] |
| 819 |
|
| 820 |
Feel free to cc Brian on messages sent to anyone listed above. None of |
| 821 |
the people on this list are under any obligation to respond to bug reports. |
| 822 |
However, they have been pretty helpful so far. |
| 823 |
|
| 824 |
When you report a bug please give as much information as possible including |
| 825 |
your hardware/software environment, which version of Mesa you're using, how |
| 826 |
to reproduce the problem, and if possible, a test program. |
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
Known Bugs |
| 831 |
========== |
| 832 |
|
| 833 |
1. Evaluator automatic normal vectors are miscalculated under certain |
| 834 |
conditions. |
| 835 |
|
| 836 |
2. glCopyPixels gives undefined results when source and destination regions |
| 837 |
overlap and pixel zoom!=1.0. |
| 838 |
|
| 839 |
3. Mesa doesn't work too well on Crays. The problem is that Crays do not |
| 840 |
have the exact C data type sizes which Mesa's X driver relies on. Better |
| 841 |
Cray support may or may not be seen in the future. |
| 842 |
|
| 843 |
4. gluCylinder, and probably other GLU quadrics, don't generate texture |
| 844 |
coordinates when drawing in point or line mode. |
| 845 |
|
| 846 |
5. The texture mapping lambda calculation doesn't seem to be 100% |
| 847 |
correct. This is only significant when the texture minification and |
| 848 |
magnification filters are different. |
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
Future Plans |
| 853 |
============ |
| 854 |
|
| 855 |
1. Display list optimization: scan for duplicate vertices and normals in |
| 856 |
order to reduce number of transformations needed. |
| 857 |
|
| 858 |
2. Implement a "generational" depth buffer which only has to be cleared |
| 859 |
once every 'n' frames. |
| 860 |
|
| 861 |
3. Integrate Mesa into the XFree86 X server. |
| 862 |
|
| 863 |
4. Support 3-D graphics hardware. |
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
Why is it the library called Mesa? |
| 868 |
================================== |
| 869 |
|
| 870 |
Why not? More obvious names were considered but had to be rejected: |
| 871 |
FreeGL (too similar to the trademarked name OpenGL), Free3D (too similar |
| 872 |
to DEC's Open3D). Also, I'm tired of acronyms. |
| 873 |
|
| 874 |
[I've recently discovered that at least two other software products use the |
| 875 |
name Mesa. A name change may be necessary in the future. Suggestions are |
| 876 |
welcome!] |
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
Contributors |
| 881 |
============ |
| 882 |
|
| 883 |
Many people have contributed to Mesa. I really appreciate the help! |
| 884 |
Among the contributors are: |
| 885 |
|
| 886 |
Erich Stefan Boleyn - for the glRotate code and testing early Mesa |
| 887 |
Joe Kiniry, Kendall Bennett - for opinions and discussion |
| 888 |
Marc Buffat - for the gluProject and gluUnproject functions |
| 889 |
Bernd Barsuhn, Volker Weiss - for the new implementation of evaluators |
| 890 |
Philip Brown - for the initial GLX, GLUT implementation |
| 891 |
Thorsten Ohl - for glXUseXFont() and glBitmap bug fixes |
| 892 |
Thomas Malik - for new invert_matrix and other xform.c code |
| 893 |
Michael Pichler - for X colormap code and numerous bug reports/fixes |
| 894 |
Thorsten Ohl, Jeroen van der Zijp - for the Xt/Motif widgets |
| 895 |
Bob Mercier - for the new 8-bit RGB dithering code |
| 896 |
Pedro Vazquez - for establishing the Mesa mailing list |
| 897 |
Bogdan Sikorski - for the GLU polygon tessellation code and NURBS |
| 898 |
Linas Vepstas - for his extrusion and swept surface library |
| 899 |
Frederic Devernay - for improved X shared memory support |
| 900 |
Asif Khan - for bringing _many_ subtle bugs to my attention |
| 901 |
Mark Peterson - for the MS Windows driver for Mesa |
| 902 |
Gene Lett and Kerris Renkin - for diagnosing several rasterization problems |
| 903 |
Alex De Bruyn - for HP Color Recovery display support |
| 904 |
Miklos Fazekas - for the Macintosh driver |
| 905 |
Frederic Devernay - for many Sun configs and lots of useful feedback |
| 906 |
Victor Ng-Thow-Hing - for the Amiga AmiWin port |
| 907 |
Bill Triggs - improved texture mapping features |
| 908 |
Martin Bernhard - added texture coordinate generation to GLU quadric functions |
| 909 |
Pascal Thibaudeau - NeXT support |
| 910 |
Jean-Luc Daems, Jacques Leroy - numerous optimization in Mesa 1.2.7 |
| 911 |
Joerg Hessdoerfer - 16-bit TrueColor optimizations in Mesa 1.2.7 |
| 912 |
Stefan Zivkovic - for the Amiga driver |
| 913 |
Peter McDermott - for the Cirrus Logic Mondello driver |
| 914 |
Constantin Filin - for mipmapping/texture mapping code |
| 915 |
Darren Abbott - for the OS/2 XFree86 port |
| 916 |
Hal Brand - for X line and polygon stippling code |
| 917 |
Eric Berdahl - for doing much of the internal overhaul work of Mesa for 2.0 |
| 918 |
Frank Ortega - for bug fixes and many helpful comments |
| 919 |
Mats Lofkvist - for finding a number of bugs in Mesa 2.0 |
| 920 |
Charlie Wallace - for the MS-DOS driver |
| 921 |
Li Wei - for updated Windows 95/NT driver |
| 922 |
Pete French - for the OpenStep driver |
| 923 |
Tinic Uro - for the BeOS driver |
| 924 |
Daniel Barrero - for the 3-D texture mapping extension |
| 925 |
Randy Frank - for many bug reports/fixes and code contributions |
| 926 |
|
| 927 |
|
| 928 |
This file last revised: March 13, 1997 |