Home | History | Annotate | Download | only in docs
      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>
     13 Mesa's off-screen rendering interface is used for rendering into
     14 user-allocated blocks of memory.
     15 That is, the GL_FRONT colorbuffer is actually a buffer in main memory,
     16 rather than a window on your display.
     17 There are no window system or operating system dependencies.
     18 One potential application is to use Mesa as an off-line, batch-style renderer.
     19 </p>
     20 
     21 <p>
     22 The <B>OSMesa</B> API provides three basic functions for making off-screen
     23 renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and
     24 OSMesaDestroyContext().  See the Mesa/include/GL/osmesa.h header for
     25 more information about the API functions.
     26 </p>
     27 
     28 <p>
     29 There are several examples of OSMesa in the <code>progs/osdemos/</code>
     30 directory.
     31 </p>
     32 
     33 
     34 <H2>Deep color channels</H2>
     35 
     36 <p>
     37 For some applications 8-bit color channels don't have sufficient
     38 precision.
     39 OSMesa supports 16-bit and 32-bit color channels through the OSMesa interface.
     40 When using 16-bit channels, channels are GLushorts and RGBA pixels occupy
     41 8 bytes.
     42 When using 32-bit channels, channels are GLfloats and RGBA pixels occupy
     43 16 bytes.
     44 </p>
     45 
     46 <p>
     47 Before version 6.5.1, Mesa had to be recompiled to support exactly
     48 one of 8, 16 or 32-bit channels.
     49 With Mesa 6.5.1, Mesa can be compiled for either 8, 16 or 32-bit channels
     50 and render into any of the smaller size channels.
     51 For example, if Mesa's compiled for 32-bit channels, you can also render
     52 16 and 8-bit channel images.
     53 </p>
     54 
     55 <p>
     56 To 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>
     63 To 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>
     70 You'll wind up with a library named libOSMesa16.so or libOSMesa32.so.
     71 Otherwise, most Mesa configurations build an 8-bit/channel libOSMesa.so library
     72 by default.
     73 </p>
     74 
     75 <p>
     76 If performance is important, compile Mesa for the channel size you're
     77 most interested in.
     78 </p>
     79 
     80 <p>
     81 If you need to compile on a non-Linux platform, copy Mesa/configs/linux-osmesa16
     82 to a new config file and edit it as needed.  Then, add the new config name to
     83 the top-level Makefile.  Send a patch to the Mesa developers too, if you're
     84 inclined.
     85 </p>
     86 
     87 </BODY>
     88 </HTML>
     89