blob: 48bf65e8ba24a15701227a7f63b1f8ae4df89fb3 [file] [log] [blame]
Erik Faye-Lund4d066832020-06-12 20:09:42 +02001Off-screen Rendering
2====================
3
4Mesa's off-screen interface is used for rendering into user-allocated
5memory without any sort of window system or operating system
6dependencies. That is, the GL_FRONT colorbuffer is actually a buffer in
7main memory, rather than a window on your display.
8
9The OSMesa API provides three basic functions for making off-screen
10renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
11OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for more
12information about the API functions.
13
14The OSMesa interface may be used with any of three software renderers:
15
16#. llvmpipe - this is the high-performance Gallium LLVM driver
17#. softpipe - this it the reference Gallium software driver
18#. swrast - this is the legacy Mesa software rasterizer
19
20There are several examples of OSMesa in the mesa/demos repository.
21
22Building OSMesa
23---------------
24
25Configure and build Mesa with something like:
26
27::
28
29 meson builddir -Dosmesa=gallium -Dgallium-drivers=swrast -Ddri-drivers=[] -Dvulkan-drivers=[] -Dprefix=$PWD/builddir/install
30 ninja -C builddir install
31
32Make sure you have LLVM installed first if you want to use the llvmpipe
33driver.
34
35When the build is complete you should find:
36
37::
38
39 $PWD/builddir/install/lib/libOSMesa.so (swrast-based OSMesa)
Erik Faye-Lund8f24a142020-09-28 13:49:20 +020040 $PWD/builddir/install/lib/gallium/libOSMsea.so (Gallium-based OSMesa)
Erik Faye-Lund4d066832020-06-12 20:09:42 +020041
42Set your LD_LIBRARY_PATH to point to $PWD/builddir/install to use the
43libraries
44
45When you link your application, link with -lOSMesa