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>Off-screen Rendering</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<h1>Off-screen Rendering</h1> 18 19 20<p> 21Mesa's off-screen interface is used for rendering into user-allocated memory 22without any sort of window system or operating system dependencies. 23That is, the GL_FRONT colorbuffer is actually a buffer in main memory, 24rather than a window on your display. 25</p> 26 27<p> 28The OSMesa API provides three basic functions for making off-screen 29renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and 30OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for 31more information about the API functions. 32</p> 33 34<p> 35The OSMesa interface may be used with any of three software renderers: 36</p> 37<ol> 38<li>llvmpipe - this is the high-performance Gallium LLVM driver 39<li>softpipe - this it the reference Gallium software driver 40<li>swrast - this is the legacy Mesa software rasterizer 41</ol> 42 43 44<p> 45There are several examples of OSMesa in the mesa/demos repository. 46</p> 47 48<h1>Building OSMesa</h1> 49 50<p> 51Configure and build Mesa with something like: 52 53<pre> 54configure --enable-osmesa --disable-driglx-direct --disable-dri --with-gallium-drivers=swrast 55make 56</pre> 57 58<p> 59Make sure you have LLVM installed first if you want to use the llvmpipe driver. 60</p> 61 62<p> 63When the build is complete you should find: 64</p> 65<pre> 66lib/libOSMesa.so (swrast-based OSMesa) 67lib/gallium/libOSMsea.so (gallium-based OSMesa) 68</pre> 69 70<p> 71Set your LD_LIBRARY_PATH to point to one directory or the other to select 72the library you want to use. 73</p> 74 75<p> 76When you link your application, link with -lOSMesa 77</p> 78 79</div> 80</body> 81</html> 82