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