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