If setting GL_PACK_INVERT_MESA results in a GL error, log it.
[mesa.git] / docs / faq.html
1 <html>
2
3 <head><title>Mesa FAQ</title></head>
4
5 <link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7 <BODY>
8
9
10 <center>
11 <h1>Mesa Frequently Asked Questions</h1>
12 Last updated: 17 November 2004
13 </center>
14
15 <br>
16 <br>
17 <h2>Index</h2>
18 <a href="#part1">1. High-level Questions and Answers</a>
19 <br>
20 <a href="#part2">2. Compilation and Installation Problems</a>
21 <br>
22 <a href="#part3">3. Runtime / Rendering Problems</a>
23 <br>
24 <a href="#part4">4. Developer Questions</a>
25 <br>
26 <br>
27 <br>
28
29
30
31 <a name="part1">
32 </a><h1><a name="part1">1. High-level Questions and Answers</a></h1>
33
34 <h2><a name="part1">1.1 What is Mesa?</a></h2>
35 <p>
36 <a name="part1">Mesa is an open-source implementation of the OpenGL specification.
37 OpenGL is a programming library for writing interactive 3D applications.
38 See the </a><a href="http://www.opengl.org/">OpenGL website</a> for more
39 information.
40 </p>
41 <p>
42 Mesa 5.x supports the OpenGL 1.4 specification.
43 </p>
44
45
46 <h2>1.2 Does Mesa support/use graphics hardware?</h2>
47 <p>
48 Yes. Specifically, Mesa serves as the OpenGL core for the open-source
49 XFree86/DRI OpenGL drivers. See the <a href="http://dri.sf.net/">DRI
50 website</a> for more information.
51 </p>
52 <p>
53 There have been other hardware drivers for Mesa over the years (such as
54 the 3Dfx Glide/Voodoo driver, an old S3 driver, etc) but the DRI drivers
55 are the modern ones.
56 </p>
57
58 <h2>1.3 What purpose does Mesa serve today?</h2>
59 <p>
60 Hardware-accelerated OpenGL implementations are available for most popular
61 operating systems today.
62 Still, Mesa serves at least these purposes:
63 </p>
64 <ul>
65 <li>Mesa is used as the core of the open-source XFree86/DRI hardware drivers.
66 </li>
67 <li>Mesa is quite portable and allows OpenGL to be used on systems
68 that have no other OpenGL solution.
69 </li>
70 <li>Software rendering with Mesa serves as a reference for validating the
71 hardware drivers.
72 </li>
73 <li>A software implementation of OpenGL is useful for experimentation,
74 such as testing new rendering techniques.
75 </li>
76 <li>Mesa can render images with deep color channels: 16-bit integer
77 and 32-bit floating point color channels are supported.
78 This capability is only now appearing in hardware.
79 </li>
80 <li>Mesa's internal limits (max lights, clip planes, texture size, etc) can be
81 changed for special needs (hardware limits are hard to overcome).
82 </li>
83 </ul>
84
85
86 <h2>1.4 What's the difference between"Stand-Alone" Mesa and the DRI drivers?</h2>
87 <p>
88 <em>Stand-alone Mesa</em> is the original incarnation of Mesa.
89 On systems running the X Window System, it does all its rendering through
90 the Xlib API.
91 <ul>
92 <li>The GLX API is supported, but it's really just an emulation of the
93 real thing.
94 <li>The GLX wire protocol is not supported and there's no OpenGL extension
95 loaded by the X server.
96 <li>There is no hardware acceleration.
97 <li>The OpenGL library, libGL.so, contains everything (the programming API,
98 the GLX functions and all the rendering code).
99 </ul>
100 </p>
101 <p>
102 Alternately, Mesa acts as the core for a number of OpenGL hardware drivers
103 within the DRI (Direct Rendering Infrastructure):
104 <ul>
105 <li>The libGL.so library provides the GL and GLX API functions, a GLX
106 protocol encoder, and a device driver loader.
107 <li>The device driver modules (such as r200_dri.so) contain a built-in
108 copy of the core Mesa code.
109 <li>The X server loads the GLX module.
110 The GLX module decodes incoming GLX protocol and dispatches the commands
111 to a rendering module.
112 For the DRI, this module is basically a software Mesa renderer.
113 </ul>
114
115
116
117 <h2>1.5 How do I upgrade my DRI installation to use a new Mesa release?</h2>
118 <p>
119 You don't! A copy of the Mesa source code lives inside the XFree86/DRI source
120 tree and gets compiled into the individual DRI driver modules.
121 If you try to install Mesa over an XFree86/DRI installation, you'll lose
122 hardware rendering (because stand-alone Mesa's libGL.so is different than
123 the XFree86 libGL.so).
124 </p>
125 <p>
126 The DRI developers will incorporate the latest release of Mesa into the
127 DRI drivers when the time is right.
128 </p>
129 <p>
130 To upgrade, either look for a new release of <a href="http://www.xfree86.org"
131 target="_parent">XFree86</a> or visit the
132 <a href="http://dri.sf.net" target="_parent">DRI website</a> to see
133 if there's newer drivers.
134 </p>
135
136
137 <h2>1.6 Are there other open-source implementations of OpenGL?</h2>
138 <p>
139 Yes, SGI's <a href="http://oss.sgi.com/projects/ogl-sample/index.html"
140 target="_parent">
141 OpenGL Sample Implemenation (SI)</a> is available.
142 The SI was written during the time that OpenGL was originally designed.
143 Unfortunately, development of the SI has stagnated.
144 Mesa is much more up to date with modern features and extensions.
145 </p>
146
147 <p>
148 <a href="http://ogl-es.sourceforge.net" target="_parent">Vincent</a> is
149 an open-source implementation of OpenGL ES for mobile devices.
150
151 <p>
152 <a href="http://www.dsbox.com/minigl.html" target="_parent">miniGL</a>
153 is a subset of OpenGL for PalmOS devices.
154
155 <p>
156 <a href="http://fabrice.bellard.free.fr/TinyGL/"
157 target="_parent">TinyGL</a> is a subset of OpenGL.
158 </p>
159
160 <p>
161 <a href="http://softgl.studierstube.org/" target="_parent">SoftGL</a>
162 is an OpenGL subset for mobile devices.
163 </p>
164
165 <p>
166 <a href="http://chromium.sourceforge.net/" target="_parent">Chromium</a>
167 isn't a conventional OpenGL implementation (it's layered upon OpenGL),
168 but it does export the OpenGL API. It allows tiled rendering, sort-last
169 rendering, etc.
170 </p>
171
172 <p>
173 There may be other open OpenGL implementations, but Mesa is the most
174 popular and feature-complete.
175 </p>
176
177
178
179 <br>
180 <br>
181
182
183 <a name="part2">
184 </a><h1><a name="part2">2. Compilation and Installation Problems</a></h1>
185
186
187 <h2><a name="part2">2.1 What's the easiest way to install Mesa?</a></h2>
188 <p>
189 <a name="part2">If you're using a Linux-based system, your distro CD most likely already
190 has Mesa packages (like RPM or DEB) which you can easily install.
191 </a></p>
192
193
194 <h2><a name="part2">2.2 Running <code>configure; make</code> doesn't Work</a></h2>
195 <p>
196 Mesa no longer supports GNU autoconf/automake. Why?
197 <ul>
198 <li>It seemed to seldom work on anything but Linux
199 <li>The config files were hard to maintain and hard to understand
200 <li>libtool caused a lot of grief
201 </ul>
202
203 <p>
204 Now, Mesa again uses a conventional Makefile system (as it did originally).
205 Basically, each Makefile in the tree includes one of the configuration
206 files from the config/ directory.
207 The config files specify all the variables for a variety of popular systems.
208 </p>
209
210
211 <h2><a name="part2">2.3 I get undefined symbols such as bgnpolygon, v3f, etc...</a></h2>
212 <p>
213 <a name="part2">You're application is written in IRIS GL, not OpenGL.
214 IRIS GL was the predecessor to OpenGL and is a different thing (almost)
215 entirely.
216 Mesa's not the solution.
217 </a></p>
218
219
220 <h2><a name="part2">2.4 Where is the GLUT library?</a></h2>
221 <p>
222 <a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaDemos-x.y.z.tar.gz file.
223 If you don't already have GLUT installed, you should grab the MesaDemos
224 package and unpack it before compiling Mesa.
225 </a></p>
226
227
228
229 <h2><a name="part2">2.5 What's the proper place for the libraries and headers?</a></h2>
230 <p>
231 <a name="part2">On Linux-based systems you'll want to follow the
232 </a><a href="http://oss.sgi.com/projects/ogl-sample/ABI/index.html"
233 target="_parent">Linux ABI</a> standard.
234 Basically you'll want the following:
235 </p>
236 <ul>
237 <li>/usr/include/GL/gl.h - the main OpenGL header
238 </li><li>/usr/include/GL/glu.h - the OpenGL GLU (utility) header
239 </li><li>/usr/include/GL/glx.h - the OpenGL GLX header
240 </li><li>/usr/include/GL/glext.h - the OpenGL extensions header
241 </li><li>/usr/include/GL/glxext.h - the OpenGL GLX extensions header
242 </li><li>/usr/include/GL/osmesa.h - the Mesa off-screen rendering header
243 </li><li>/usr/lib/libGL.so - a symlink to libGL.so.1
244 </li><li>/usr/lib/libGL.so.1 - a symlink to libGL.so.1.xyz
245 </li><li>/usr/lib/libGL.so.xyz - the actual OpenGL/Mesa library. xyz denotes the
246 Mesa version number.
247 </li><li>/usr/lib/libGLU.so - a symlink to libGLU.so.1
248 </li><li>/usr/lib/libGLU.so.1 - a symlink to libGLU.so.1.3.xyz
249 </li><li>/usr/lib/libGLU.so.xyz - the OpenGL Utility library. xyz denotes the Mesa
250 version number.
251 </li></ul>
252 <p>
253 After installing XFree86 and the DRI drivers, some of these files
254 may be symlinks into the /usr/X11R6/ tree.
255 </p>
256 <p>
257 The old-style Makefile system doesn't install the Mesa libraries; it's
258 up to you to copy them (and the headers) to the right place.
259 </p>
260 <p>
261 The GLUT header and library should go in the same directories.
262 </p>
263 <br>
264 <br>
265
266
267 <a name="part3">
268 </a><h1><a name="part3">3. Runtime / Rendering Problems</a></h1>
269
270 <h2><a name="part3">3.1 Rendering is slow / why isn't my graphics hardware being used?</a></h2>
271 <p>
272 <a name="part3">Stand-alone Mesa (downloaded as MesaLib-x.y.z.tar.gz) doesn't have any
273 support for hardware acceleration (with the exception of the 3DFX Voodoo
274 driver).
275 </a></p>
276 <p>
277 <a name="part3">What you really want is a DRI or NVIDIA (or another vendor's OpenGL) driver
278 for your particular hardware.
279 </a></p>
280 <p>
281 <a name="part3">You can run the <code>glxinfo</code> program to learn about your OpenGL
282 library.
283 Look for the GL_VENDOR and GL_RENDERER values.
284 That will identify who's OpenGL library you're using and what sort of
285 hardware it has detected.
286 </a></p>
287 <p>
288 <a name="part3">If your DRI-based driver isn't working, go to the
289 </a><a href="http://dri.sf.net/" target="_parent">DRI website</a> for trouble-shooting information.
290 </p>
291
292
293 <h2>3.2 I'm seeing errors in depth (Z) buffering. Why?</h2>
294 <p>
295 Make sure the ratio of the far to near clipping planes isn't too great.
296 Look
297 <a href="http://www.sgi.com/software/opengl/advanced97/notes/node18.html"
298 target="_parent">
299 here</a> for details.
300 </p>
301 <p>
302 Mesa uses a 16-bit depth buffer by default which is smaller and faster
303 to clear than a 32-bit buffer but not as accurate.
304 If you need a deeper you can modify the parameters to
305 <code> glXChooseVisual</code> in your code.
306 </p>
307
308
309 <h2>3.3 Why Isn't depth buffering working at all?</h2>
310 <p>
311 Be sure you're requesting a depth buffered-visual. If you set the MESA_DEBUG
312 environment variable it will warn you about trying to enable depth testing
313 when you don't have a depth buffer.
314 </p>
315 <p>Specifically, make sure <code>glutInitDisplayMode</code> is being called
316 with <code>GLUT_DEPTH</code> or <code>glXChooseVisual</code> is being
317 called with a non-zero value for GLX_DEPTH_SIZE.
318 </p>
319 <p>This discussion applies to stencil buffers, accumulation buffers and
320 alpha channels too.
321 </p>
322
323
324 <h2>3.4 Why does glGetString() always return NULL?</h2>
325 <p>
326 Be sure you have an active/current OpenGL rendering context before
327 calling glGetString.
328 </p>
329
330
331 <h2>3.5 GL_POINTS and GL_LINES don't touch the right pixels</h2>
332 <p>
333 If you're trying to draw a filled region by using GL_POINTS or GL_LINES
334 and seeing holes or gaps it's because of a float-to-int rounding problem.
335 But this is not a bug.
336 See Appendix H of the OpenGL Programming Guide - "OpenGL Correctness Tips".
337 Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
338 will fix the problem.
339 </p>
340
341 <br>
342 <br>
343
344
345 <a name="part4">
346 </a><h1><a name="part4">4. Developer Questions</a></h1>
347
348 <h2><a name="part4">4.1 How can I contribute?</a></h2>
349 <p>
350 <a name="part4">First, join the Mesa3d-dev mailing list. That's where Mesa development
351 is discussed.
352 </a></p>
353 <p>
354 <a name="part4">The </a><a href="http://www.opengl.org/developers/documentation/specs.html" target="_parent">
355 OpenGL Specification</a> is the bible for OpenGL implemention work.
356 You should read it.
357 </p>
358 <p>Most of the Mesa development work involves implementing new OpenGL
359 extensions, writing hardware drivers (for the DRI), and code optimization.
360 </p>
361
362 <h2>4.2 How do I write a new device driver?</h2>
363 <p>
364 Unfortunately, writing a device driver isn't easy.
365 It requires detailed understanding of OpenGL, the Mesa code, and your
366 target hardware/operating system.
367 3D graphics are not simple.
368 </p>
369 <p>
370 The best way to get started is to use an existing driver as your starting
371 point.
372 For a software driver, the X11 and OSMesa drivers are good examples.
373 For a hardware driver, the Radeon and R200 DRI drivers are good examples.
374 </p>
375 <p>The DRI website has more information about writing hardware drivers.
376 The process isn't well document because the Mesa driver interface changes
377 over time, and we seldome have spare time for writing documentation.
378 That being said, many people have managed to figure out the process.
379 </p>
380 <p>
381 Joining the appropriate mailing lists and asking questions (and searching
382 the archives) is a good way to get information.
383 </p>
384
385
386 <h2>4.3 Why isn't GL_EXT_texture_compression_s3tc implemented in Mesa and/or the DRI drivers?</h2>
387 <p>
388 The <a href="http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt" target="_parent">specification for the extension</a>
389 indicates that there are intellectual property (IP) and/or patent issues
390 to be dealt with.
391 </p>
392 <p>We've been unsucessful in getting a response from S3 (or whoever owns
393 the IP nowadays) to indicate whether or not an open source project can
394 implement the extension (specifically the compression/decompression
395 algorithms).
396 </p>
397 <p>
398 Until we can get official permission to do so, this extension will not
399 be implemented in Mesa.
400 </p>
401
402
403 </body>
404 </html>