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