blob: 848754570df2e8d225bbfc87df5442795383920a [file] [log] [blame]
Andreas Bollecd5c7c2012-06-12 09:05:03 +02001<!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>
Brian Paul0b27ace2003-03-08 17:38:57 +00009
Andreas Bollb5da52a2012-09-18 18:57:02 +020010<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
Andreas Bollecd5c7c2012-06-12 09:05:03 +020017<h1>Off-screen Rendering</h1>
Brian Paul0b27ace2003-03-08 17:38:57 +000018
19
20<p>
Brian Paul6f86b932013-03-11 18:31:22 -060021Mesa's off-screen interface is used for rendering into user-allocated memory
22without any sort of window system or operating system dependencies.
Brian Paule35b9052006-05-19 03:42:16 +000023That is, the GL_FRONT colorbuffer is actually a buffer in main memory,
24rather than a window on your display.
Brian Paul0b27ace2003-03-08 17:38:57 +000025</p>
Brian Paule35b9052006-05-19 03:42:16 +000026
Brian Paul0b27ace2003-03-08 17:38:57 +000027<p>
Brian Paul6f86b932013-03-11 18:31:22 -060028The OSMesa API provides three basic functions for making off-screen
Brian Paul0b27ace2003-03-08 17:38:57 +000029renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
30OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for
Brian Paule35b9052006-05-19 03:42:16 +000031more information about the API functions.
Brian Paul0b27ace2003-03-08 17:38:57 +000032</p>
Brian Paule35b9052006-05-19 03:42:16 +000033
Brian Paul0b27ace2003-03-08 17:38:57 +000034<p>
Brian Paul6f86b932013-03-11 18:31:22 -060035The 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>
Andreas Boll7b314b32012-09-20 16:01:15 +020045There are several examples of OSMesa in the mesa/demos repository.
Brian Paul0b27ace2003-03-08 17:38:57 +000046</p>
47
Brian Paul6f86b932013-03-11 18:31:22 -060048<h1>Building OSMesa</h1>
Brian Paul0b27ace2003-03-08 17:38:57 +000049
50<p>
Brian Paul6f86b932013-03-11 18:31:22 -060051Configure and build Mesa with something like:
Brian Paule35b9052006-05-19 03:42:16 +000052
Brian Paul0b27ace2003-03-08 17:38:57 +000053<pre>
Brian Paul6f86b932013-03-11 18:31:22 -060054configure --enable-osmesa --disable-driglx-direct --disable-dri --with-gallium-drivers=swrast
55make
Brian Paul0b27ace2003-03-08 17:38:57 +000056</pre>
57
Brian Paule35b9052006-05-19 03:42:16 +000058<p>
Brian Paul6f86b932013-03-11 18:31:22 -060059Make 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>
Brian Paul0b27ace2003-03-08 17:38:57 +000065<pre>
Brian Paul6f86b932013-03-11 18:31:22 -060066lib/libOSMesa.so (swrast-based OSMesa)
67lib/gallium/libOSMsea.so (gallium-based OSMesa)
Brian Paul0b27ace2003-03-08 17:38:57 +000068</pre>
69
70<p>
Brian Paul6f86b932013-03-11 18:31:22 -060071Set your LD_LIBRARY_PATH to point to one directory or the other to select
72the library you want to use.
Brian Paule35b9052006-05-19 03:42:16 +000073</p>
74
75<p>
Brian Paul6f86b932013-03-11 18:31:22 -060076When you link your application, link with -lOSMesa
Brian Paul0b27ace2003-03-08 17:38:57 +000077</p>
Brian Paul58be9e62004-09-24 20:31:02 +000078
Andreas Bollb5da52a2012-09-18 18:57:02 +020079</div>
Andreas Bollecd5c7c2012-06-12 09:05:03 +020080</body>
81</html>