17ec681f3SmrgOff-screen Rendering
27ec681f3Smrg====================
37ec681f3Smrg
47ec681f3SmrgMesa's off-screen interface is used for rendering into user-allocated
57ec681f3Smrgmemory without any sort of window system or operating system
67ec681f3Smrgdependencies. That is, the GL_FRONT colorbuffer is actually a buffer in
77ec681f3Smrgmain memory, rather than a window on your display.
87ec681f3Smrg
97ec681f3SmrgThe OSMesa API provides three basic functions for making off-screen
107ec681f3Smrgrenderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
117ec681f3SmrgOSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for more
127ec681f3Smrginformation about the API functions.
137ec681f3Smrg
147ec681f3SmrgThe OSMesa interface may be used with the gallium software renderers:
157ec681f3Smrg
167ec681f3Smrg#. llvmpipe - this is the high-performance Gallium LLVM driver
177ec681f3Smrg#. softpipe - this it the reference Gallium software driver
187ec681f3Smrg
197ec681f3SmrgThere are several examples of OSMesa in the mesa/demos repository.
207ec681f3Smrg
217ec681f3SmrgBuilding OSMesa
227ec681f3Smrg---------------
237ec681f3Smrg
247ec681f3SmrgConfigure and build Mesa with something like:
257ec681f3Smrg
267ec681f3Smrg.. code-block:: console
277ec681f3Smrg
287ec681f3Smrg   meson builddir -Dosmesa=true -Dgallium-drivers=swrast -Ddri-drivers=[] -Dvulkan-drivers=[] -Dprefix=$PWD/builddir/install
297ec681f3Smrg   ninja -C builddir install
307ec681f3Smrg
317ec681f3SmrgMake sure you have LLVM installed first if you want to use the llvmpipe
327ec681f3Smrgdriver.
337ec681f3Smrg
347ec681f3SmrgWhen the build is complete you should find:
357ec681f3Smrg
367ec681f3Smrg::
377ec681f3Smrg
387ec681f3Smrg   $PWD/builddir/install/lib/libOSMesa.so
397ec681f3Smrg
407ec681f3SmrgSet your LD_LIBRARY_PATH to point to $PWD/builddir/install to use the
417ec681f3Smrglibraries
427ec681f3Smrg
437ec681f3SmrgWhen you link your application, link with -lOSMesa
44