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