blob: 0ec67c44b4e28f3ce4c5e92ca2b845e7ee26a245 [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 Paule35b9052006-05-19 03:42:16 +000021Mesa's off-screen rendering interface is used for rendering into
22user-allocated blocks of memory.
23That is, the GL_FRONT colorbuffer is actually a buffer in main memory,
24rather than a window on your display.
25There are no window system or operating system dependencies.
26One potential application is to use Mesa as an off-line, batch-style renderer.
Brian Paul0b27ace2003-03-08 17:38:57 +000027</p>
Brian Paule35b9052006-05-19 03:42:16 +000028
Brian Paul0b27ace2003-03-08 17:38:57 +000029<p>
Andreas Boll210a27d2012-06-12 09:05:36 +020030The <b>OSMesa</b> API provides three basic functions for making off-screen
Brian Paul0b27ace2003-03-08 17:38:57 +000031renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
32OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for
Brian Paule35b9052006-05-19 03:42:16 +000033more information about the API functions.
Brian Paul0b27ace2003-03-08 17:38:57 +000034</p>
Brian Paule35b9052006-05-19 03:42:16 +000035
Brian Paul0b27ace2003-03-08 17:38:57 +000036<p>
Brian Paulb0613d82010-02-09 11:21:41 -070037There are several examples of OSMesa in the <code>progs/osdemos/</code>
Brian Paule35b9052006-05-19 03:42:16 +000038directory.
Brian Paul0b27ace2003-03-08 17:38:57 +000039</p>
40
41
Andreas Boll210a27d2012-06-12 09:05:36 +020042<h2>Deep color channels</h2>
Brian Paul0b27ace2003-03-08 17:38:57 +000043
44<p>
Brian Paule35b9052006-05-19 03:42:16 +000045For some applications 8-bit color channels don't have sufficient
46precision.
47OSMesa supports 16-bit and 32-bit color channels through the OSMesa interface.
48When using 16-bit channels, channels are GLushorts and RGBA pixels occupy
498 bytes.
50When using 32-bit channels, channels are GLfloats and RGBA pixels occupy
5116 bytes.
Brian Paul0b27ace2003-03-08 17:38:57 +000052</p>
Brian Paule35b9052006-05-19 03:42:16 +000053
Brian Paul0b27ace2003-03-08 17:38:57 +000054<p>
Brian Paule35b9052006-05-19 03:42:16 +000055Before version 6.5.1, Mesa had to be recompiled to support exactly
56one of 8, 16 or 32-bit channels.
57With Mesa 6.5.1, Mesa can be compiled for either 8, 16 or 32-bit channels
58and render into any of the smaller size channels.
59For example, if Mesa's compiled for 32-bit channels, you can also render
6016 and 8-bit channel images.
61</p>
62
63<p>
64To build Mesa/OSMesa for 16 and 8-bit color channel support:
Brian Paul0b27ace2003-03-08 17:38:57 +000065<pre>
Brian Paul58be9e62004-09-24 20:31:02 +000066 make realclean
67 make linux-osmesa16
Brian Paul0b27ace2003-03-08 17:38:57 +000068</pre>
69
Brian Paule35b9052006-05-19 03:42:16 +000070<p>
71To build Mesa/OSMesa for 32, 16 and 8-bit color channel support:
Brian Paul0b27ace2003-03-08 17:38:57 +000072<pre>
Brian Paul58be9e62004-09-24 20:31:02 +000073 make realclean
74 make linux-osmesa32
Brian Paul0b27ace2003-03-08 17:38:57 +000075</pre>
76
77<p>
Brian Paul7357f202003-05-02 15:05:02 +000078You'll wind up with a library named libOSMesa16.so or libOSMesa32.so.
Brian Paule35b9052006-05-19 03:42:16 +000079Otherwise, most Mesa configurations build an 8-bit/channel libOSMesa.so library
80by default.
81</p>
82
83<p>
84If performance is important, compile Mesa for the channel size you're
85most interested in.
Brian Paul7357f202003-05-02 15:05:02 +000086</p>
87
88<p>
Brian Paul58be9e62004-09-24 20:31:02 +000089If you need to compile on a non-Linux platform, copy Mesa/configs/linux-osmesa16
90to a new config file and edit it as needed. Then, add the new config name to
91the top-level Makefile. Send a patch to the Mesa developers too, if you're
92inclined.
Brian Paul0b27ace2003-03-08 17:38:57 +000093</p>
Brian Paul58be9e62004-09-24 20:31:02 +000094
Andreas Bollb5da52a2012-09-18 18:57:02 +020095</div>
Andreas Bollecd5c7c2012-06-12 09:05:03 +020096</body>
97</html>