Brian Paul | e58a10a | 1998-02-14 17:45:13 +0000 | [diff] [blame^] | 1 | |
| 2 | Mesa 3.0 Unix/X11 Information |
| 3 | |
| 4 | |
| 5 | |
| 6 | Installation |
| 7 | ============ |
| 8 | |
| 9 | To compile the library, first type 'make' alone to see the list of system |
| 10 | configurations currently supported. If you see your configuration on the |
| 11 | list, type 'make <config>'. Most popular Unix/X workstations are currently |
| 12 | supported. |
| 13 | |
| 14 | The top-level makefile will execute the makefiles in a number of sub- |
| 15 | directories. When finished, the Mesa libraries will be in the Mesa-2.6/lib/ |
| 16 | directory. A few GLUT demos in the demos/ directory should be ready to run. |
| 17 | |
| 18 | If you also downloaded and unpacked the demos there should be executables |
| 19 | in the "xdemos/", "samples/", and "book/" directories for you to try out. |
| 20 | If you only want to compile the contents of one subdirectory you can 'cd' |
| 21 | to that directory and type 'make <config>' there. |
| 22 | |
| 23 | If your system configuration is not listed by 'make', you'll have to modify |
| 24 | the top-level Makefile and Make-config files. There are instructions in |
| 25 | each file. |
| 26 | |
| 27 | If you have compilation problems you should try to fix them and return the |
| 28 | patches to the author. |
| 29 | |
| 30 | |
| 31 | Header and library files: |
| 32 | After you've compiled Mesa and tried the demos I recommend the following |
| 33 | procedure for "installing" Mesa. |
| 34 | |
| 35 | Copy the Mesa include/GL directory to /usr/local/include: |
| 36 | cp -r include/GL /usr/local/include |
| 37 | |
| 38 | Copy the Mesa library files to /usr/local/lib: |
| 39 | cp lib/* /usr/local/lib |
| 40 | |
| 41 | (actually, use "cp -d" on Linux to preserve symbolic links) |
| 42 | |
| 43 | Create a few symbolic links so that compiling OpenGL applications is easy: |
| 44 | cd /usr/local/lib |
| 45 | IF USING STATIC (lib*.a) FILES THEN |
| 46 | ln -s libMesaGL.a libGL.a |
| 47 | ln -s libMesaGLU.a libGLU.a |
| 48 | ELSE |
| 49 | ln -s libMesaGL.so libGL.so |
| 50 | ln -s libMesaGLU.so libGLU.so |
| 51 | ENDIF |
| 52 | |
| 53 | |
| 54 | Xt/Motif widgets: |
| 55 | If you want to use Mesa or OpenGL in your Xt/Motif program you can build |
| 56 | the widgets found in either the widgets-mesa or widgets-sgi directories. |
| 57 | The former were written for Mesa and the later are the original SGI |
| 58 | widgets. Look in those directories for more information. |
| 59 | |
| 60 | |
| 61 | Notes: |
| 62 | HP users: a Mesa user reports that the HP-UX 10.01 C compiler has |
| 63 | a bug which effects glReadPixels. A patch for the compiler (PHSS_5743) is |
| 64 | available. Otherwise be sure your compiler is version 10.13 or later. |
| 65 | |
| 66 | QNX users: if you have problems running the demos try setting the |
| 67 | stack size to 200K or larger with -N200K, for example. |
| 68 | |
| 69 | SunOS 5.x users: The X shared memory extension may not work |
| 70 | correctly. If Mesa prints an error message to the effect of "Shared memory |
| 71 | error" then you'll have to append the following three lines to the end of |
| 72 | your /etc/system file then reboot: |
| 73 | set shmsys:shminfo_shmmax = 0x2000000 |
| 74 | set shmsys:shminfo_shmmni = 0x1000 |
| 75 | set shmsys:shminfo_shmseg = 0x100 |
| 76 | |
| 77 | |
| 78 | |
| 79 | Using the library |
| 80 | ================= |
| 81 | |
| 82 | Configuration options: |
| 83 | The file src/config.h has many parameters which you can adjust such |
| 84 | as maximum number of lights, clipping planes, maximum texture size, |
| 85 | etc. In particular, you may want to change DEPTH_BITS from 16 to 32 |
| 86 | if a 16-bit depth buffer isn't precise enough for your application. |
| 87 | |
| 88 | |
| 89 | Shared libraries: |
| 90 | If you compile shared libraries you may have to set an environment |
| 91 | variable to specify where the Mesa libraries are located. On Linux and |
| 92 | Sun systems for example, set the LD_LIBRARY_PATH variable to include |
| 93 | /your-dir/Mesa-2.6/lib. Otherwise, when you try to run a demo it |
| 94 | may fail with a message saying that one or more libraries couldn't be |
| 95 | found. |
| 96 | |
| 97 | |
| 98 | Remote display of OpenGL/GLX programs: |
| 99 | As of version 1.2.3, Mesa's header files use the same GLenum and GLUenum |
| 100 | values as SGI's (and most/all other vendor's) OpenGL headers. This means |
| 101 | you can freely mix object files compiled with OpenGL or Mesa headers. |
| 102 | In fact, on systems with dynamic runtime linkers it's possible to dynam- |
| 103 | ically link with Mesa or OpenGL shared libraries at runtime, without |
| 104 | recompiling or relinking anything! |
| 105 | |
| 106 | Using IRIX 5.x as an example, you can run SGI's OpenGL demos with the |
| 107 | Mesa shared libraries as follows. Let's assume you're installing Mesa |
| 108 | in /usr/local/Mesa and using the C-shell: |
| 109 | % cd /usr/local/Mesa |
| 110 | % make irix5-dso |
| 111 | % cd lib |
| 112 | % ln -s libMesaGL.so libGL.so |
| 113 | % setenv _RLD_LIST "/usr/local/Mesa/lib/libGL.so:DEFAULT" |
| 114 | % /usr/demos/bin/ideas_ogl // this is a test |
| 115 | |
| 116 | You can now run OpenGL executables on almost any X display! There may |
| 117 | be some problems from the fact that Mesa supports many X visual types |
| 118 | that an OpenGL client may not expect (grayscale for example). In this |
| 119 | case the application may abort, print error messages, or just behave |
| 120 | strangely. You may have to experiment with the MESA_RGB_VISUAL envi- |
| 121 | ronment variable. |
| 122 | |
| 123 | |
| 124 | Xt/Motif Widgets: |
| 125 | Two versions of the Xt/Motif OpenGL drawing area widgets are included: |
| 126 | |
| 127 | widgets-sgi/ SGI's stock widgets |
| 128 | widgets-mesa/ Mesa-tuned widgets |
| 129 | |
| 130 | Look in those directories for details |
| 131 | |
| 132 | |
| 133 | Togl: |
| 134 | Togl is an OpenGL/Mesa widget for Tcl/Tk. |
| 135 | See http://www.ssec.wisc.edu/~brianp/Togl.html for more information. |
| 136 | |
| 137 | |
| 138 | |
| 139 | X Display Modes: |
| 140 | Mesa supports RGB(A) rendering into almost any X visual type and depth. |
| 141 | |
| 142 | The glXChooseVisual function tries its best to pick an appropriate visual |
| 143 | for the given attribute list. However, if this doesn't suit your needs |
| 144 | you can force Mesa to use any X visual you want (any supported by your |
| 145 | X server that is) by setting the MESA_RGB_VISUAL and MESA_CI_VISUAL |
| 146 | environment variables. When an RGB visual is requested, glXChooseVisual |
| 147 | will first look if the MESA_RGB_VISUAL variable is defined. If so, it |
| 148 | will try to use the specified visual. Similarly, when a color index |
| 149 | visual is requested, glXChooseVisual will look for the MESA_CI_VISUAL |
| 150 | variable. |
| 151 | |
| 152 | The format of accepted values is: <visual-class> <depth> |
| 153 | Here are some examples: |
| 154 | |
| 155 | using the C-shell: |
| 156 | % setenv MESA_RGB_VISUAL "TrueColor 8" // 8-bit TrueColor |
| 157 | % setenv MESA_CI_VISUAL "PseudoColor 12" // 12-bit PseudoColor |
| 158 | % setenv MESA_RGB_VISUAL "PseudoColor 8" // 8-bit PseudoColor |
| 159 | |
| 160 | using the KornShell: |
| 161 | $ export MESA_RGB_VISUAL="TrueColor 8" |
| 162 | $ export MESA_CI_VISUAL="PseudoColor 12" |
| 163 | $ export MESA_RGB_VISUAL="PseudoColor 8" |
| 164 | |
| 165 | |
| 166 | Double buffering (X11 only): |
| 167 | Mesa can use either an X Pixmap or XImage as the backbuffer when in |
| 168 | double buffer mode. Using GLX, the default is to use an XImage. The |
| 169 | MESA_BACK_BUFFER environment variable can override this. The valid |
| 170 | values for MESA_BACK_BUFFER are: Pixmap and XImage (only the first |
| 171 | letter is checked, case doesn't matter). |
| 172 | |
| 173 | A pixmap is faster when drawing simple lines and polygons while an |
| 174 | XImage is faster when Mesa has to do pixel-by-pixel rendering. If you |
| 175 | need depth buffering the XImage will almost surely be faster. Exper- |
| 176 | iment with the MESA_BACK_BUFFER variable to see which is faster for |
| 177 | your application. |
| 178 | |
| 179 | |
| 180 | Colormaps (X11 only): |
| 181 | When using Mesa directly or with GLX, it's up to the application writer |
| 182 | to create a window with an appropriate colormap. The aux, tk, and GLUT |
| 183 | toolkits try to minimize colormap "flashing" by sharing colormaps when |
| 184 | possible. Specifically, if the visual and depth of the window matches |
| 185 | that of the root window, the root window's colormap will be shared by |
| 186 | the Mesa window. Otherwise, a new, private colormap will be allocated. |
| 187 | |
| 188 | When sharing the root colormap, Mesa may be unable to allocate the colors |
| 189 | it needs, resulting in poor color quality. This can happen when a |
| 190 | large number of colorcells in the root colormap are already allocated. |
| 191 | To prevent colormap sharing in aux, tk and GLUT, define the environment |
| 192 | variable MESA_PRIVATE_CMAP. The value isn't significant. |
| 193 | |
| 194 | |
| 195 | Gamma correction (X11 only): |
| 196 | To compensate for the nonlinear relationship between pixel values |
| 197 | and displayed intensities, there is a gamma correction feature in |
| 198 | Mesa. Some systems, such as Silicon Graphics, support gamma |
| 199 | correction in hardware (man gamma) so you won't need to use Mesa's |
| 200 | gamma facility. Other systems, however, may need gamma adjustment |
| 201 | to produce images which look correct. If in the past you thought |
| 202 | Mesa's images were too dim, read on. |
| 203 | |
| 204 | Gamma correction is controlled with the MESA_GAMMA environment |
| 205 | variable. Its value is of the form "Gr Gg Gb" or just "G" where |
| 206 | Gr is the red gamma value, Gg is the green gamma value, Gb is the |
| 207 | blue gamma value and G is one gamma value to use for all three |
| 208 | channels. Each value is a positive real number typically in the |
| 209 | range 1.0 to 2.5. The defaults are all 1.0, effectively disabling |
| 210 | gamma correction. Examples using csh: |
| 211 | |
| 212 | % setenv MESA_GAMMA "2.3 2.2 2.4" // separate R,G,B values |
| 213 | % setenv MESA_GAMMA "2.0" // same gamma for R,G,B |
| 214 | |
| 215 | The demos/gamma.c program may help you to determine reasonable gamma |
| 216 | value for your display. With correct gamma values, the color intensities |
| 217 | displayed in the top row (drawn by dithering) should nearly match those |
| 218 | in the bottom row (drawn as grays). |
| 219 | |
| 220 | Alex De Bruyn reports that gamma values of 1.6, 1.6 and 1.9 work well |
| 221 | on HP displays using the HP-ColorRecovery technology. |
| 222 | |
| 223 | Mesa implements gamma correction with a lookup table which translates |
| 224 | a "linear" pixel value to a gamma-corrected pixel value. There is a |
| 225 | small performance penalty. Gamma correction only works in RGB mode. |
| 226 | Also be aware that pixel values read back from the frame buffer will |
| 227 | not be "un-corrected" so glReadPixels may not return the same data |
| 228 | drawn with glDrawPixels. |
| 229 | |
| 230 | For more information about gamma correction see: |
| 231 | http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html |
| 232 | |
| 233 | |
| 234 | |
| 235 | Extensions: |
| 236 | The following OpenGL GLX extensions are currently implemented: |
| 237 | |
| 238 | GLX_EXT_visual_info - GLX visual and transparent pixel extension |
| 239 | |
| 240 | For detailed information about the extensions see www.opengl.org |
| 241 | |
| 242 | There are four Mesa-specific GL/GLX extensions at this time. |
| 243 | |
| 244 | GLX_MESA_pixmap_colormap |
| 245 | |
| 246 | This extension adds the GLX function: |
| 247 | |
| 248 | GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, |
| 249 | Pixmap pixmap, Colormap cmap ) |
| 250 | |
| 251 | It is an alternative to the standard glXCreateGLXPixmap() function. |
| 252 | Since Mesa supports RGB rendering into any X visual, not just True- |
| 253 | Color or DirectColor, Mesa needs colormap information to convert RGB |
| 254 | values into pixel values. An X window carries this information but a |
| 255 | pixmap does not. This function associates a colormap to a GLX pixmap. |
| 256 | See the xdemos/glxpixmap.c file for an example of how to use this |
| 257 | extension. |
| 258 | |
| 259 | GLX_MESA_release_buffers |
| 260 | |
| 261 | Mesa associates a set of ancillary (depth, accumulation, stencil and |
| 262 | alpha) buffers with each X window it draws into. These ancillary |
| 263 | buffers are allocated for each X window the first time the X window |
| 264 | is passed to glXMakeCurrent(). Mesa, however, can't detect when an |
| 265 | X window has been destroyed in order to free the ancillary buffers. |
| 266 | |
| 267 | The best it can do is to check for recently destroyed windows whenever |
| 268 | the client calls the glXCreateContext() or glXDestroyContext() |
| 269 | functions. This may not be sufficient in all situations though. |
| 270 | |
| 271 | The GLX_MESA_release_buffers extension allows a client to explicitly |
| 272 | deallocate the ancillary buffers by calling glxReleaseBuffersMESA() |
| 273 | just before an X window is destroyed. For example: |
| 274 | |
| 275 | #ifdef GLX_MESA_release_buffers |
| 276 | glXReleaseBuffersMESA( dpy, window ); |
| 277 | #endif |
| 278 | XDestroyWindow( dpy, window ); |
| 279 | |
| 280 | This extension is new in Mesa 2.0. |
| 281 | |
| 282 | GLX_MESA_copy_sub_buffer |
| 283 | |
| 284 | This extension adds the glXCopySubBufferMESA() function. It works |
| 285 | like glXSwapBuffers() but only copies a sub-region of the window |
| 286 | instead of the whole window. |
| 287 | |
| 288 | This extension is new in Mesa version 2.6 |
| 289 | |
| 290 | |
| 291 | |
| 292 | Summary of X-related environment variables: |
| 293 | MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only) |
| 294 | MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only) |
| 295 | MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only) |
| 296 | MESA_PRIVATE_CMAP - force aux/tk libraries to use private colormaps (X only) |
| 297 | MESA_GAMMA - gamma correction coefficients (X only) |
| 298 | |
| 299 | |
| 300 | ---------------------------------------------------------------------- |
| 301 | $Id: README.X11,v 3.0 1998/02/14 17:45:13 brianp Exp $ |