• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<HTML>
2
3<TITLE>Off-screen Rendering</TITLE>
4
5<link rel="stylesheet" type="text/css" href="mesa.css"></head>
6
7<BODY>
8
9<H1>Off-screen Rendering</H1>
10
11
12<p>
13Mesa'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.
19</p>
20
21<p>
22The <B>OSMesa</B> API provides three basic functions for making off-screen
23renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
24OSMesaDestroyContext().  See the Mesa/include/GL/osmesa.h header for
25more information about the API functions.
26</p>
27
28<p>
29There are several examples of OSMesa in the <code>progs/osdemos/</code>
30directory.
31</p>
32
33
34<H2>Deep color channels</H2>
35
36<p>
37For 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.
44</p>
45
46<p>
47Before 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:
57<pre>
58      make realclean
59      make linux-osmesa16
60</pre>
61
62<p>
63To build Mesa/OSMesa for 32, 16 and 8-bit color channel support:
64<pre>
65      make realclean
66      make linux-osmesa32
67</pre>
68
69<p>
70You'll wind up with a library named libOSMesa16.so or libOSMesa32.so.
71Otherwise, 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.
78</p>
79
80<p>
81If 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.
85</p>
86
87</BODY>
88</HTML>
89