blob: 629d054f4195e1f404c6951a55c98ae5ccc1742b [file] [log] [blame]
Brian Paul0b27ace2003-03-08 17:38:57 +00001<HTML>
2
3<TITLE>Off-screen Rendering</TITLE>
4
Brian Paul36da0452005-01-20 03:55:10 +00005<link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7<BODY>
Brian Paul0b27ace2003-03-08 17:38:57 +00008
9<H1>Off-screen Rendering</H1>
10
11
12<p>
Brian Paule35b9052006-05-19 03:42:16 +000013Mesa's off-screen rendering interface is used for rendering into
14user-allocated blocks of memory.
15That is, the GL_FRONT colorbuffer is actually a buffer in main memory,
16rather than a window on your display.
17There are no window system or operating system dependencies.
18One potential application is to use Mesa as an off-line, batch-style renderer.
Brian Paul0b27ace2003-03-08 17:38:57 +000019</p>
Brian Paule35b9052006-05-19 03:42:16 +000020
Brian Paul0b27ace2003-03-08 17:38:57 +000021<p>
Brian Paule35b9052006-05-19 03:42:16 +000022The <B>OSMesa</B> API provides three basic functions for making off-screen
Brian Paul0b27ace2003-03-08 17:38:57 +000023renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
24OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for
Brian Paule35b9052006-05-19 03:42:16 +000025more information about the API functions.
Brian Paul0b27ace2003-03-08 17:38:57 +000026</p>
Brian Paule35b9052006-05-19 03:42:16 +000027
Brian Paul0b27ace2003-03-08 17:38:57 +000028<p>
Brian Paule35b9052006-05-19 03:42:16 +000029There are several examples of OSMesa in the <code>progs/osdemo/</code>
30directory.
Brian Paul0b27ace2003-03-08 17:38:57 +000031</p>
32
33
34<H2>Deep color channels</H2>
35
36<p>
Brian Paule35b9052006-05-19 03:42:16 +000037For some applications 8-bit color channels don't have sufficient
38precision.
39OSMesa supports 16-bit and 32-bit color channels through the OSMesa interface.
40When using 16-bit channels, channels are GLushorts and RGBA pixels occupy
418 bytes.
42When using 32-bit channels, channels are GLfloats and RGBA pixels occupy
4316 bytes.
Brian Paul0b27ace2003-03-08 17:38:57 +000044</p>
Brian Paule35b9052006-05-19 03:42:16 +000045
Brian Paul0b27ace2003-03-08 17:38:57 +000046<p>
Brian Paule35b9052006-05-19 03:42:16 +000047Before version 6.5.1, Mesa had to be recompiled to support exactly
48one of 8, 16 or 32-bit channels.
49With Mesa 6.5.1, Mesa can be compiled for either 8, 16 or 32-bit channels
50and render into any of the smaller size channels.
51For example, if Mesa's compiled for 32-bit channels, you can also render
5216 and 8-bit channel images.
53</p>
54
55<p>
56To build Mesa/OSMesa for 16 and 8-bit color channel support:
Brian Paul0b27ace2003-03-08 17:38:57 +000057<pre>
Brian Paul58be9e62004-09-24 20:31:02 +000058 make realclean
59 make linux-osmesa16
Brian Paul0b27ace2003-03-08 17:38:57 +000060</pre>
61
Brian Paule35b9052006-05-19 03:42:16 +000062<p>
63To build Mesa/OSMesa for 32, 16 and 8-bit color channel support:
Brian Paul0b27ace2003-03-08 17:38:57 +000064<pre>
Brian Paul58be9e62004-09-24 20:31:02 +000065 make realclean
66 make linux-osmesa32
Brian Paul0b27ace2003-03-08 17:38:57 +000067</pre>
68
69<p>
Brian Paul7357f202003-05-02 15:05:02 +000070You'll wind up with a library named libOSMesa16.so or libOSMesa32.so.
Brian Paule35b9052006-05-19 03:42:16 +000071Otherwise, most Mesa configurations build an 8-bit/channel libOSMesa.so library
72by default.
73</p>
74
75<p>
76If performance is important, compile Mesa for the channel size you're
77most interested in.
Brian Paul7357f202003-05-02 15:05:02 +000078</p>
79
80<p>
Brian Paul58be9e62004-09-24 20:31:02 +000081If you need to compile on a non-Linux platform, copy Mesa/configs/linux-osmesa16
82to a new config file and edit it as needed. Then, add the new config name to
83the top-level Makefile. Send a patch to the Mesa developers too, if you're
84inclined.
Brian Paul0b27ace2003-03-08 17:38:57 +000085</p>
Brian Paul58be9e62004-09-24 20:31:02 +000086
Brian Paul0b27ace2003-03-08 17:38:57 +000087</BODY>
88</HTML>