faq.html revision 848b8605
1848b8605Smrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2848b8605Smrg<html lang="en">
3848b8605Smrg<head>
4848b8605Smrg  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5848b8605Smrg  <title>Mesa FAQ</title>
6848b8605Smrg  <link rel="stylesheet" type="text/css" href="mesa.css">
7848b8605Smrg</head>
8848b8605Smrg<body>
9848b8605Smrg
10848b8605Smrg<div class="header">
11848b8605Smrg  <h1>The Mesa 3D Graphics Library</h1>
12848b8605Smrg</div>
13848b8605Smrg
14848b8605Smrg<iframe src="contents.html"></iframe>
15848b8605Smrg<div class="content">
16848b8605Smrg
17848b8605Smrg<center>
18848b8605Smrg<h1>Mesa Frequently Asked Questions</h1>
19848b8605SmrgLast updated: 9 October 2012
20848b8605Smrg</center>
21848b8605Smrg
22848b8605Smrg<br>
23848b8605Smrg<br>
24848b8605Smrg<h2>Index</h2>
25848b8605Smrg<a href="#part1">1. High-level Questions and Answers</a>
26848b8605Smrg<br>
27848b8605Smrg<a href="#part2">2. Compilation and Installation Problems</a>
28848b8605Smrg<br>
29848b8605Smrg<a href="#part3">3. Runtime / Rendering Problems</a>
30848b8605Smrg<br>
31848b8605Smrg<a href="#part4">4. Developer Questions</a>
32848b8605Smrg<br>
33848b8605Smrg<br>
34848b8605Smrg<br>
35848b8605Smrg
36848b8605Smrg
37848b8605Smrg
38848b8605Smrg<h1 id="part1">1. High-level Questions and Answers</h1>
39848b8605Smrg
40848b8605Smrg<h2>1.1 What is Mesa?</h2>
41848b8605Smrg<p>
42848b8605SmrgMesa is an open-source implementation of the OpenGL specification.
43848b8605SmrgOpenGL is a programming library for writing interactive 3D applications.
44848b8605SmrgSee the <a href="http://www.opengl.org/">OpenGL website</a> for more
45848b8605Smrginformation.
46848b8605Smrg</p>
47848b8605Smrg<p>
48848b8605SmrgMesa 9.x supports the OpenGL 3.1 specification.
49848b8605Smrg</p>
50848b8605Smrg
51848b8605Smrg
52848b8605Smrg<h2>1.2 Does Mesa support/use graphics hardware?</h2>
53848b8605Smrg<p>
54848b8605SmrgYes.  Specifically, Mesa serves as the OpenGL core for the open-source DRI
55848b8605Smrgdrivers for X.org.
56848b8605Smrg</p>
57848b8605Smrg<ul>
58848b8605Smrg  <li>See the <a href="http://dri.freedesktop.org/">DRI website</a>
59848b8605Smrg  for more information.</li>
60848b8605Smrg  <li>See <a href="http://intellinuxgraphics.org">intellinuxgraphics.org</a>
61848b8605Smrg  for more information about Intel drivers.</li>
62848b8605Smrg  <li>See <a href="http://nouveau.freedesktop.org">nouveau.freedesktop.org</a>
63848b8605Smrg  for more information about Nouveau drivers.</li>
64848b8605Smrg  <li>See <a href="http://www.x.org/wiki/RadeonFeature">www.x.org/wiki/RadeonFeature</a>
65848b8605Smrg  for more information about Radeon drivers.</li>
66848b8605Smrg</ul>
67848b8605Smrg
68848b8605Smrg<h2>1.3 What purpose does Mesa serve today?</h2>
69848b8605Smrg<p>
70848b8605SmrgHardware-accelerated OpenGL implementations are available for most popular
71848b8605Smrgoperating systems today.
72848b8605SmrgStill, Mesa serves at least these purposes:
73848b8605Smrg</p>
74848b8605Smrg<ul>
75848b8605Smrg<li>Mesa is used as the core of the open-source X.org DRI
76848b8605Smrg    hardware drivers.
77848b8605Smrg</li>
78848b8605Smrg<li>Mesa is quite portable and allows OpenGL to be used on systems
79848b8605Smrg    that have no other OpenGL solution.
80848b8605Smrg</li>
81848b8605Smrg<li>Software rendering with Mesa serves as a reference for validating the
82848b8605Smrg    hardware drivers.
83848b8605Smrg</li>
84848b8605Smrg<li>A software implementation of OpenGL is useful for experimentation,
85848b8605Smrg    such as testing new rendering techniques.
86848b8605Smrg</li>
87848b8605Smrg<li>Mesa can render images with deep color channels: 16-bit integer
88848b8605Smrg    and 32-bit floating point color channels are supported.
89848b8605Smrg    This capability is only now appearing in hardware.
90848b8605Smrg</li>
91848b8605Smrg<li>Mesa's internal limits (max lights, clip planes, texture size, etc) can be
92848b8605Smrg    changed for special needs (hardware limits are hard to overcome).
93848b8605Smrg</li>
94848b8605Smrg</ul>
95848b8605Smrg
96848b8605Smrg
97848b8605Smrg<h2>1.4 What's the difference between "Stand-Alone" Mesa and the DRI drivers?</h2>
98848b8605Smrg<p>
99848b8605Smrg<em>Stand-alone Mesa</em> is the original incarnation of Mesa.
100848b8605SmrgOn systems running the X Window System it does all its rendering through
101848b8605Smrgthe Xlib API:
102848b8605Smrg</p>
103848b8605Smrg<ul>
104848b8605Smrg<li>The GLX API is supported, but it's really just an emulation of the
105848b8605Smrg     real thing.
106848b8605Smrg<li>The GLX wire protocol is not supported and there's no OpenGL extension
107848b8605Smrg    loaded by the X server.
108848b8605Smrg<li>There is no hardware acceleration.
109848b8605Smrg<li>The OpenGL library, libGL.so, contains everything (the programming API,
110848b8605Smrg    the GLX functions and all the rendering code).
111848b8605Smrg</ul>
112848b8605Smrg<p>
113848b8605SmrgAlternately, Mesa acts as the core for a number of OpenGL hardware drivers
114848b8605Smrgwithin the DRI (Direct Rendering Infrastructure):
115848b8605Smrg<ul>
116848b8605Smrg<li>The libGL.so library provides the GL and GLX API functions, a GLX
117848b8605Smrg    protocol encoder, and a device driver loader.
118848b8605Smrg<li>The device driver modules (such as r200_dri.so) contain a built-in
119848b8605Smrg    copy of the core Mesa code.
120848b8605Smrg<li>The X server loads the GLX module.
121848b8605Smrg    The GLX module decodes incoming GLX protocol and dispatches the commands
122848b8605Smrg    to a rendering module.
123848b8605Smrg    For the DRI, this module is basically a software Mesa renderer.
124848b8605Smrg</ul>
125848b8605Smrg
126848b8605Smrg
127848b8605Smrg
128848b8605Smrg<h2>1.5 How do I upgrade my DRI installation to use a new Mesa release?</h2>
129848b8605Smrg<p>
130848b8605SmrgThis wasn't easy in the past.
131848b8605SmrgNow, the DRI drivers are included in the Mesa tree and can be compiled
132848b8605Smrgseparately from the X server.
133848b8605SmrgJust follow the Mesa <a href="install.html">compilation instructions</a>.
134848b8605Smrg</p>
135848b8605Smrg
136848b8605Smrg
137848b8605Smrg<h2>1.6 Are there other open-source implementations of OpenGL?</h2>
138848b8605Smrg<p>
139848b8605SmrgYes, SGI's <a href="http://oss.sgi.com/projects/ogl-sample/index.html">
140848b8605SmrgOpenGL Sample Implementation (SI)</a> is available.
141848b8605SmrgThe SI was written during the time that OpenGL was originally designed.
142848b8605SmrgUnfortunately, development of the SI has stagnated.
143848b8605SmrgMesa is much more up to date with modern features and extensions.
144848b8605Smrg</p>
145848b8605Smrg
146848b8605Smrg<p>
147848b8605Smrg<a href="http://sourceforge.net/projects/ogl-es/">Vincent</a> is
148848b8605Smrgan open-source implementation of OpenGL ES for mobile devices.
149848b8605Smrg
150848b8605Smrg<p>
151848b8605Smrg<a href="http://www.dsbox.com/minigl.html">miniGL</a>
152848b8605Smrgis a subset of OpenGL for PalmOS devices.
153848b8605Smrg
154848b8605Smrg<p>
155848b8605Smrg<a href="http://bellard.org/TinyGL/">TinyGL</a>
156848b8605Smrgis a subset of OpenGL.
157848b8605Smrg</p>
158848b8605Smrg
159848b8605Smrg<p>
160848b8605Smrg<a href="http://sourceforge.net/projects/softgl/">SoftGL</a>
161848b8605Smrgis an OpenGL subset for mobile devices.
162848b8605Smrg</p>
163848b8605Smrg
164848b8605Smrg<p>
165848b8605Smrg<a href="http://chromium.sourceforge.net/">Chromium</a>
166848b8605Smrgisn't a conventional OpenGL implementation (it's layered upon OpenGL),
167848b8605Smrgbut it does export the OpenGL API.  It allows tiled rendering, sort-last
168848b8605Smrgrendering, etc.
169848b8605Smrg</p>
170848b8605Smrg
171848b8605Smrg<p>
172848b8605Smrg<a href="http://www.ticalc.org/archives/files/fileinfo/361/36173.html">ClosedGL</a>
173848b8605Smrgis an OpenGL subset library for TI graphing calculators.
174848b8605Smrg</p>
175848b8605Smrg
176848b8605Smrg<p>
177848b8605SmrgThere may be other open OpenGL implementations, but Mesa is the most
178848b8605Smrgpopular and feature-complete.
179848b8605Smrg</p>
180848b8605Smrg
181848b8605Smrg
182848b8605Smrg
183848b8605Smrg<br>
184848b8605Smrg<br>
185848b8605Smrg
186848b8605Smrg
187848b8605Smrg<h1 id="part2">2. Compilation and Installation Problems</h1>
188848b8605Smrg
189848b8605Smrg
190848b8605Smrg<h2>2.1 What's the easiest way to install Mesa?</h2>
191848b8605Smrg<p>
192848b8605SmrgIf you're using a Linux-based system, your distro CD most likely already
193848b8605Smrghas Mesa packages (like RPM or DEB) which you can easily install.
194848b8605Smrg</p>
195848b8605Smrg
196848b8605Smrg
197848b8605Smrg<h2>2.2 I get undefined symbols such as bgnpolygon, v3f, etc...</h2>
198848b8605Smrg<p>
199848b8605SmrgYou're application is written in IRIS GL, not OpenGL.
200848b8605SmrgIRIS GL was the predecessor to OpenGL and is a different thing (almost)
201848b8605Smrgentirely.
202848b8605SmrgMesa's not the solution.
203848b8605Smrg</p>
204848b8605Smrg
205848b8605Smrg
206848b8605Smrg<h2>2.3 Where is the GLUT library?</h2>
207848b8605Smrg<p>
208848b8605SmrgGLUT (OpenGL Utility Toolkit) is no longer in the separate MesaGLUT-x.y.z.tar.gz file.
209848b8605SmrgIf you don't already have GLUT installed, you should grab 
210848b8605Smrg<a href="http://freeglut.sourceforge.net/">freeglut</a>.
211848b8605Smrg</p>
212848b8605Smrg
213848b8605Smrg
214848b8605Smrg<h2>2.4 Where is the GLw library?</h2>
215848b8605Smrg<p>
216848b8605SmrgGLw (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.
217848b8605Smrg</p>
218848b8605Smrg
219848b8605Smrg
220848b8605Smrg<h2>2.5 What's the proper place for the libraries and headers?</h2>
221848b8605Smrg<p>
222848b8605SmrgOn Linux-based systems you'll want to follow the
223848b8605Smrg<a href="http://oss.sgi.com/projects/ogl-sample/ABI/index.html">Linux ABI</a> standard.
224848b8605SmrgBasically you'll want the following:
225848b8605Smrg</p>
226848b8605Smrg<ul>
227848b8605Smrg<li>/usr/include/GL/gl.h - the main OpenGL header
228848b8605Smrg</li><li>/usr/include/GL/glu.h - the OpenGL GLU (utility) header
229848b8605Smrg</li><li>/usr/include/GL/glx.h - the OpenGL GLX header
230848b8605Smrg</li><li>/usr/include/GL/glext.h - the OpenGL extensions header
231848b8605Smrg</li><li>/usr/include/GL/glxext.h - the OpenGL GLX extensions header
232848b8605Smrg</li><li>/usr/include/GL/osmesa.h - the Mesa off-screen rendering header
233848b8605Smrg</li><li>/usr/lib/libGL.so - a symlink to libGL.so.1
234848b8605Smrg</li><li>/usr/lib/libGL.so.1 - a symlink to libGL.so.1.xyz
235848b8605Smrg</li><li>/usr/lib/libGL.so.xyz - the actual OpenGL/Mesa library.  xyz denotes the
236848b8605SmrgMesa version number.
237848b8605Smrg</li></ul>
238848b8605Smrg<p>
239848b8605SmrgWhen configuring Mesa, there are three autoconf options that affect the install
240848b8605Smrglocation that you should take care with: <code>--prefix</code>,
241848b8605Smrg<code>--libdir</code>, and <code>--with-dri-driverdir</code>. To install Mesa
242848b8605Smrginto the system location where it will be available for all programs to use, set
243848b8605Smrg<code>--prefix=/usr</code>. Set <code>--libdir</code> to where your Linux
244848b8605Smrgdistribution installs system libraries, usually either <code>/usr/lib</code> or
245848b8605Smrg<code>/usr/lib64</code>. Set <code>--with-dri-driverdir</code> to the directory
246848b8605Smrgwhere your Linux distribution installs DRI drivers. To find your system's DRI
247848b8605Smrgdriver directory, try executing <code>find /usr -type d -name dri</code>. For
248848b8605Smrgexample, if the <code>find</code> command listed <code>/usr/lib64/dri</code>,
249848b8605Smrgthen set <code>--with-dri-driverdir=/usr/lib64/dri</code>.
250848b8605Smrg</p>
251848b8605Smrg<p>
252848b8605SmrgAfter determining the correct values for the install location, configure Mesa
253848b8605Smrgwith <code>./configure --prefix=/usr --libdir=xxx --with-dri-driverdir=xxx</code>
254848b8605Smrgand then install with <code>sudo make install</code>.
255848b8605Smrg</p>
256848b8605Smrg<br>
257848b8605Smrg<br>
258848b8605Smrg
259848b8605Smrg
260848b8605Smrg<h1 id="part3">3. Runtime / Rendering Problems</h1>
261848b8605Smrg
262848b8605Smrg<h2>3.1 Rendering is slow / why isn't my graphics hardware being used?</h2>
263848b8605Smrg<p>
264848b8605SmrgIf Mesa can't use its hardware accelerated drivers it falls back on one of its software renderers.
265848b8605Smrg(eg. classic swrast, softpipe or llvmpipe)
266848b8605Smrg</p>
267848b8605Smrg<p>
268848b8605SmrgYou can run the <code>glxinfo</code> program to learn about your OpenGL
269848b8605Smrglibrary.
270848b8605SmrgLook for the <code>OpenGL vendor</code> and <code>OpenGL renderer</code> values.
271848b8605SmrgThat will identify who's OpenGL library with which driver you're using and what sort of
272848b8605Smrghardware it has detected.
273848b8605Smrg</p>
274848b8605Smrg<p>
275848b8605SmrgIf you're using a hardware accelerated driver you want <code>direct rendering: Yes</code>.
276848b8605Smrg</p>
277848b8605Smrg<p>
278848b8605SmrgIf your DRI-based driver isn't working, go to the
279848b8605Smrg<a href="http://dri.freedesktop.org/">DRI website</a> for trouble-shooting information.
280848b8605Smrg</p>
281848b8605Smrg
282848b8605Smrg
283848b8605Smrg<h2>3.2 I'm seeing errors in depth (Z) buffering.  Why?</h2>
284848b8605Smrg<p>
285848b8605SmrgMake sure the ratio of the far to near clipping planes isn't too great.
286848b8605SmrgLook
287848b8605Smrg<a href="http://www.opengl.org/resources/faq/technical/depthbuffer.htm#0040">here</a>
288848b8605Smrgfor details.
289848b8605Smrg</p>
290848b8605Smrg<p>
291848b8605SmrgMesa uses a 16-bit depth buffer by default which is smaller and faster
292848b8605Smrgto clear than a 32-bit buffer but not as accurate.
293848b8605SmrgIf you need a deeper you can modify the parameters to
294848b8605Smrg<code> glXChooseVisual</code> in your code.
295848b8605Smrg</p>
296848b8605Smrg
297848b8605Smrg
298848b8605Smrg<h2>3.3 Why Isn't depth buffering working at all?</h2>
299848b8605Smrg<p>
300848b8605SmrgBe sure you're requesting a depth buffered-visual.  If you set the MESA_DEBUG
301848b8605Smrgenvironment variable it will warn you about trying to enable depth testing
302848b8605Smrgwhen you don't have a depth buffer.
303848b8605Smrg</p>
304848b8605Smrg<p>Specifically, make sure <code>glutInitDisplayMode</code> is being called
305848b8605Smrgwith <code>GLUT_DEPTH</code> or <code>glXChooseVisual</code> is being
306848b8605Smrgcalled with a non-zero value for GLX_DEPTH_SIZE.
307848b8605Smrg</p>
308848b8605Smrg<p>This discussion applies to stencil buffers, accumulation buffers and
309848b8605Smrgalpha channels too.
310848b8605Smrg</p>
311848b8605Smrg
312848b8605Smrg
313848b8605Smrg<h2>3.4 Why does glGetString() always return NULL?</h2>
314848b8605Smrg<p>
315848b8605SmrgBe sure you have an active/current OpenGL rendering context before
316848b8605Smrgcalling glGetString.
317848b8605Smrg</p>
318848b8605Smrg
319848b8605Smrg
320848b8605Smrg<h2>3.5 GL_POINTS and GL_LINES don't touch the right pixels</h2>
321848b8605Smrg<p>
322848b8605SmrgIf you're trying to draw a filled region by using GL_POINTS or GL_LINES
323848b8605Smrgand seeing holes or gaps it's because of a float-to-int rounding problem.
324848b8605SmrgBut this is not a bug.
325848b8605SmrgSee Appendix H of the OpenGL Programming Guide - "OpenGL Correctness Tips".
326848b8605SmrgBasically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
327848b8605Smrgwill fix the problem.
328848b8605Smrg</p>
329848b8605Smrg
330848b8605Smrg<h2>3.6 How can I change the maximum framebuffer size in Mesa's
331848b8605Smrg<tt>swrast</tt> backend?</h2>
332848b8605Smrg<p>
333848b8605SmrgThese can be overridden by using the <tt>--with-max-width</tt> and
334848b8605Smrg<tt>--with-max-height</tt> options.  The two need not be equal.
335848b8605Smrg</p><p>
336848b8605SmrgDo note that Mesa uses these values to size some internal buffers,
337848b8605Smrgso increasing these sizes will cause Mesa to require additional
338848b8605Smrgmemory.  Furthermore, increasing these limits beyond <tt>4096</tt>
339848b8605Smrgmay introduce rasterization artifacts; see the leading comments in
340848b8605Smrg<tt>src/mesa/swrast/s_tritemp.h</tt>.
341848b8605Smrg</p>
342848b8605Smrg
343848b8605Smrg<br>
344848b8605Smrg<br>
345848b8605Smrg
346848b8605Smrg
347848b8605Smrg<h1 id="part4">4. Developer Questions</h1>
348848b8605Smrg
349848b8605Smrg<h2>4.1 How can I contribute?</h2>
350848b8605Smrg<p>
351848b8605SmrgFirst, join the <a href="lists.html">mesa-dev mailing list</a>.
352848b8605SmrgThat's where Mesa development is discussed.
353848b8605Smrg</p>
354848b8605Smrg<p>
355848b8605SmrgThe <a href="http://www.opengl.org/documentation">
356848b8605SmrgOpenGL Specification</a> is the bible for OpenGL implementation work.
357848b8605SmrgYou should read it.
358848b8605Smrg</p>
359848b8605Smrg<p>Most of the Mesa development work involves implementing new OpenGL
360848b8605Smrgextensions, writing hardware drivers (for the DRI), and code optimization.
361848b8605Smrg</p>
362848b8605Smrg
363848b8605Smrg<h2>4.2 How do I write a new device driver?</h2>
364848b8605Smrg<p>
365848b8605SmrgUnfortunately, writing a device driver isn't easy.
366848b8605SmrgIt requires detailed understanding of OpenGL, the Mesa code, and your
367848b8605Smrgtarget hardware/operating system.
368848b8605Smrg3D graphics are not simple.
369848b8605Smrg</p>
370848b8605Smrg<p>
371848b8605SmrgThe best way to get started is to use an existing driver as your starting
372848b8605Smrgpoint.
373848b8605SmrgFor a classic hardware driver, the i965 driver is a good example.
374848b8605SmrgFor a Gallium3D hardware driver, the r300g, r600g and the i915g are good examples.
375848b8605Smrg</p>
376848b8605Smrg<p>The DRI website has more information about writing hardware drivers.
377848b8605SmrgThe process isn't well document because the Mesa driver interface changes
378848b8605Smrgover time, and we seldom have spare time for writing documentation.
379848b8605SmrgThat being said, many people have managed to figure out the process.
380848b8605Smrg</p>
381848b8605Smrg<p>
382848b8605SmrgJoining the appropriate mailing lists and asking questions (and searching
383848b8605Smrgthe archives) is a good way to get information.
384848b8605Smrg</p>
385848b8605Smrg
386848b8605Smrg
387848b8605Smrg<h2>4.3 Why isn't GL_EXT_texture_compression_s3tc implemented in Mesa?</h2>
388848b8605Smrg<p>
389848b8605SmrgThe <a href="http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt">specification for the extension</a>
390848b8605Smrgindicates that there are intellectual property (IP) and/or patent issues
391848b8605Smrgto be dealt with.
392848b8605Smrg</p>
393848b8605Smrg<p>We've been unsuccessful in getting a response from S3 (or whoever owns
394848b8605Smrgthe IP nowadays) to indicate whether or not an open source project can
395848b8605Smrgimplement the extension (specifically the compression/decompression
396848b8605Smrgalgorithms).
397848b8605Smrg</p>
398848b8605Smrg<p>
399848b8605SmrgIn the mean time, a 3rd party <a href="http://dri.freedesktop.org/wiki/S3TC">
400848b8605Smrgplug-in library</a> is available.
401848b8605Smrg</p>
402848b8605Smrg
403848b8605Smrg</div>
404848b8605Smrg</body>
405848b8605Smrg</html>
406