1 Frequently Asked Questions
2 ==========================
4 Last updated: 19 September 2018
6 1. High-level Questions and Answers
7 -----------------------------------
12 Mesa is an open-source implementation of the OpenGL specification.
13 OpenGL is a programming library for writing interactive 3D applications.
14 See the `OpenGL website <https://www.opengl.org/>`__ for more
17 Mesa 9.x supports the OpenGL 3.1 specification.
19 1.2 Does Mesa support/use graphics hardware?
20 --------------------------------------------
22 Yes. Specifically, Mesa serves as the OpenGL core for the open-source
23 DRI drivers for X.org.
25 - See the `DRI website <https://dri.freedesktop.org/>`__ for more
27 - See `01.org <https://01.org/linuxgraphics>`__ for more information
29 - See `nouveau.freedesktop.org <https://nouveau.freedesktop.org>`__ for
30 more information about Nouveau drivers.
32 `www.x.org/wiki/RadeonFeature <https://www.x.org/wiki/RadeonFeature>`__
33 for more information about Radeon drivers.
35 1.3 What purpose does Mesa serve today?
36 ---------------------------------------
38 Hardware-accelerated OpenGL implementations are available for most
39 popular operating systems today. Still, Mesa serves at least these
42 - Mesa is used as the core of the open-source X.org DRI hardware
44 - Mesa is quite portable and allows OpenGL to be used on systems that
45 have no other OpenGL solution.
46 - Software rendering with Mesa serves as a reference for validating the
48 - A software implementation of OpenGL is useful for experimentation,
49 such as testing new rendering techniques.
50 - Mesa can render images with deep color channels: 16-bit integer and
51 32-bit floating point color channels are supported. This capability
52 is only now appearing in hardware.
53 - Mesa's internal limits (max lights, clip planes, texture size, etc)
54 can be changed for special needs (hardware limits are hard to
57 1.4 What's the difference between "Stand-Alone" Mesa and the DRI drivers?
58 -------------------------------------------------------------------------
60 *Stand-alone Mesa* is the original incarnation of Mesa. On systems
61 running the X Window System it does all its rendering through the Xlib
64 - The GLX API is supported, but it's really just an emulation of the
66 - The GLX wire protocol is not supported and there's no OpenGL
67 extension loaded by the X server.
68 - There is no hardware acceleration.
69 - The OpenGL library, ``libGL.so``, contains everything (the
70 programming API, the GLX functions and all the rendering code).
72 Alternately, Mesa acts as the core for a number of OpenGL hardware
73 drivers within the DRI (Direct Rendering Infrastructure):
75 - The ``libGL.so`` library provides the GL and GLX API functions, a GLX
76 protocol encoder, and a device driver loader.
77 - The device driver modules (such as ``r200_dri.so``) contain a
78 built-in copy of the core Mesa code.
79 - The X server loads the GLX module. The GLX module decodes incoming
80 GLX protocol and dispatches the commands to a rendering module. For
81 the DRI, this module is basically a software Mesa renderer.
83 1.5 How do I upgrade my DRI installation to use a new Mesa release?
84 -------------------------------------------------------------------
86 This wasn't easy in the past. Now, the DRI drivers are included in the
87 Mesa tree and can be compiled separately from the X server. Just follow
88 the Mesa :doc:`compilation instructions <install>`.
90 1.6 Are there other open-source implementations of OpenGL?
91 ----------------------------------------------------------
93 Yes, SGI's `OpenGL Sample Implementation
94 (SI) <http://web.archive.org/web/20171010115110_/http://oss.sgi.com/projects/ogl-sample/index.html>`__
95 is available. The SI was written during the time that OpenGL was
96 originally designed. Unfortunately, development of the SI has stagnated.
97 Mesa is much more up to date with modern features and extensions.
99 `Vincent <https://sourceforge.net/projects/ogl-es/>`__ is an open-source
100 implementation of OpenGL ES for mobile devices.
102 `miniGL <http://web.archive.org/web/20130830162848/http://www.dsbox.com/minigl.html>`__
103 is a subset of OpenGL for PalmOS devices. The website is gone, but the
104 source code can still be found on
105 `sourceforge.net <https://sourceforge.net/projects/minigl/>`__.
107 `TinyGL <http://bellard.org/TinyGL/>`__ is a subset of OpenGL.
109 `SoftGL <https://sourceforge.net/projects/softgl/>`__ is an OpenGL
110 subset for mobile devices.
112 `Chromium <http://chromium.sourceforge.net/>`__ isn't a conventional
113 OpenGL implementation (it's layered upon OpenGL), but it does export the
114 OpenGL API. It allows tiled rendering, sort-last rendering, etc.
116 `ClosedGL <http://www.ticalc.org/archives/files/fileinfo/361/36173.html>`__
117 is an OpenGL subset library for TI graphing calculators.
119 There may be other open OpenGL implementations, but Mesa is the most
120 popular and feature-complete.
122 2. Compilation and Installation Problems
123 ----------------------------------------
125 2.1 What's the easiest way to install Mesa?
126 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128 If you're using a Linux-based system, your distro CD most likely already
129 has Mesa packages (like RPM or DEB) which you can easily install.
131 2.2 I get undefined symbols such as bgnpolygon, v3f, etc...
132 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134 Your application is written in IRIS GL, not OpenGL. IRIS GL was the
135 predecessor to OpenGL and is a different thing (almost) entirely. Mesa's
138 2.3 Where is the GLUT library?
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141 GLUT (OpenGL Utility Toolkit) is no longer in the separate
142 ``MesaGLUT-x.y.z.tar.gz`` file. If you don't already have GLUT
143 installed, you should grab
144 `freeglut <http://freeglut.sourceforge.net/>`__.
146 2.4 Where is the GLw library?
147 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149 GLw (OpenGL widget library) is now available from a separate `git
150 repository <https://gitlab.freedesktop.org/mesa/glw>`__. Unless you're
151 using very old Xt/Motif applications with OpenGL, you shouldn't need it.
153 2.5 What's the proper place for the libraries and headers?
154 ----------------------------------------------------------
156 On Linux-based systems you'll want to follow the `Linux
157 ABI <https://www.khronos.org/registry/OpenGL/ABI/>`__ standard.
158 Basically you'll want the following:
160 ``/usr/include/GL/gl.h``
161 the main OpenGL header
162 ``/usr/include/GL/glu.h``
163 the OpenGL GLU (utility) header
164 ``/usr/include/GL/glx.h``
165 the OpenGL GLX header
166 ``/usr/include/GL/glext.h``
167 the OpenGL extensions header
168 ``/usr/include/GL/glxext.h``
169 the OpenGL GLX extensions header
170 ``/usr/include/GL/osmesa.h``
171 the Mesa off-screen rendering header
172 ``/usr/lib/libGL.so``
173 a symlink to ``libGL.so.1``
174 ``/usr/lib/libGL.so.1``
175 a symlink to ``libGL.so.1.xyz``
176 ``/usr/lib/libGL.so.xyz``
177 the actual OpenGL/Mesa library. xyz denotes the Mesa version number.
179 When configuring Mesa, there are three meson options that affect the
180 install location that you should take care with: ``--prefix``,
181 ``--libdir``, and ``-D dri-drivers-path``. To install Mesa into the
182 system location where it will be available for all programs to use, set
183 ``--prefix=/usr``. Set ``--libdir`` to where your Linux distribution
184 installs system libraries, usually either ``/usr/lib`` or
185 ``/usr/lib64``. Set ``-D dri-drivers-path`` to the directory where your
186 Linux distribution installs DRI drivers. To find your system's DRI
187 driver directory, try executing ``find /usr -type d -name dri``. For
188 example, if the ``find`` command listed ``/usr/lib64/dri``, then set
189 ``-D dri-drivers-path=/usr/lib64/dri``.
191 After determining the correct values for the install location, configure
193 ``meson configure --prefix=/usr --libdir=xxx -D dri-drivers-path=xxx``
194 and then install with ``sudo ninja install``.
196 3. Runtime / Rendering Problems
197 -------------------------------
199 3.1 Rendering is slow / why isn't my graphics hardware being used?
200 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202 If Mesa can't use its hardware accelerated drivers it falls back on one
203 of its software renderers. (e.g. Softpipe or LLVMpipe)
205 You can run the ``glxinfo`` program to learn about your OpenGL library.
206 Look for the ``OpenGL vendor`` and ``OpenGL renderer`` values. That will
207 identify who's OpenGL library with which driver you're using and what
208 sort of hardware it has detected.
210 If you're using a hardware accelerated driver you want
211 ``direct rendering: Yes``.
213 If your DRI-based driver isn't working, go to the `DRI
214 website <https://dri.freedesktop.org/>`__ for trouble-shooting
217 3.2 I'm seeing errors in depth (Z) buffering. Why?
218 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220 Make sure the ratio of the far to near clipping planes isn't too great.
222 `here <https://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm#0040>`__
225 Mesa uses a 16-bit depth buffer by default which is smaller and faster
226 to clear than a 32-bit buffer but not as accurate. If you need a deeper
227 you can modify the parameters to ``glXChooseVisual`` in your code.
229 3.3 Why Isn't depth buffering working at all?
230 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232 Be sure you're requesting a depth buffered-visual. If you set the
233 ``MESA_DEBUG`` environment variable it will warn you about trying to
234 enable depth testing when you don't have a depth buffer.
236 Specifically, make sure ``glutInitDisplayMode`` is being called with
237 ``GLUT_DEPTH`` or ``glXChooseVisual`` is being called with a non-zero
238 value for ``GLX_DEPTH_SIZE``.
240 This discussion applies to stencil buffers, accumulation buffers and
243 3.4 Why does ``glGetString()`` always return ``NULL``?
244 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246 Be sure you have an active/current OpenGL rendering context before
247 calling ``glGetString``.
249 3.5 ``GL_POINTS`` and ``GL_LINES`` don't touch the right pixels
250 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252 If you're trying to draw a filled region by using ``GL_POINTS`` or
253 ``GL_LINES`` and seeing holes or gaps it's because of a float-to-int
254 rounding problem. But this is not a bug. See Appendix H of the OpenGL
255 Programming Guide - "OpenGL Correctness Tips". Basically, applying a
256 translation of (0.375, 0.375, 0.0) to your coordinates will fix the
259 4. Developer Questions
260 ----------------------
262 4.1 How can I contribute?
263 ~~~~~~~~~~~~~~~~~~~~~~~~~
265 First, join the :doc:`mesa-dev mailing list <lists>`. That's where
266 Mesa development is discussed.
268 The `OpenGL Specification <https://www.opengl.org/documentation>`__ is
269 the bible for OpenGL implementation work. You should read it.
271 Most of the Mesa development work involves implementing new OpenGL
272 extensions, writing hardware drivers (for the DRI), and code
275 4.2 How do I write a new device driver?
276 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278 Unfortunately, writing a device driver isn't easy. It requires detailed
279 understanding of OpenGL, the Mesa code, and your target
280 hardware/operating system. 3D graphics are not simple.
282 The best way to get started is to use an existing driver as your
283 starting point. For a classic hardware driver, the i965 driver is a good
284 example. For a Gallium3D hardware driver, the r300g, r600g and the i915g
287 The DRI website has more information about writing hardware drivers. The
288 process isn't well document because the Mesa driver interface changes
289 over time, and we seldom have spare time for writing documentation. That
290 being said, many people have managed to figure out the process.
292 Joining the appropriate mailing lists and asking questions (and
293 searching the archives) is a good way to get information.
295 4.3 Why isn't ``GL_EXT_texture_compression_s3tc`` implemented in Mesa?
296 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298 Oh but it is! Prior to 2nd October 2017, the Mesa project did not
299 include S3TC support due to intellectual property (IP) and/or patent
300 issues around the S3TC algorithm.
302 As of Mesa 17.3.0, Mesa now officially supports S3TC, as the patent has
305 In versions prior to this, a 3rd party `plug-in
306 library <https://dri.freedesktop.org/wiki/S3TC>`__ was required.