Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 1 | <HTML> |
| 2 | |
| 3 | <TITLE>Off-screen Rendering</TITLE> |
| 4 | |
Brian Paul | 36da045 | 2005-01-20 03:55:10 +0000 | [diff] [blame] | 5 | <link rel="stylesheet" type="text/css" href="mesa.css"></head> |
| 6 | |
| 7 | <BODY> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 8 | |
| 9 | <H1>Off-screen Rendering</H1> |
| 10 | |
| 11 | |
| 12 | <p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 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. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 19 | </p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 20 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 21 | <p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 22 | 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] | 23 | renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and |
| 24 | OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 25 | more information about the API functions. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 26 | </p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 27 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 28 | <p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 29 | There are several examples of OSMesa in the <code>progs/osdemo/</code> |
| 30 | directory. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 31 | </p> |
| 32 | |
| 33 | |
| 34 | <H2>Deep color channels</H2> |
| 35 | |
| 36 | <p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 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. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 44 | </p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 45 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 46 | <p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 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: |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 57 | <pre> |
Brian Paul | 58be9e6 | 2004-09-24 20:31:02 +0000 | [diff] [blame] | 58 | make realclean |
| 59 | make linux-osmesa16 |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 60 | </pre> |
| 61 | |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 62 | <p> |
| 63 | 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] | 64 | <pre> |
Brian Paul | 58be9e6 | 2004-09-24 20:31:02 +0000 | [diff] [blame] | 65 | make realclean |
| 66 | make linux-osmesa32 |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 67 | </pre> |
| 68 | |
| 69 | <p> |
Brian Paul | 7357f20 | 2003-05-02 15:05:02 +0000 | [diff] [blame] | 70 | 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] | 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. |
Brian Paul | 7357f20 | 2003-05-02 15:05:02 +0000 | [diff] [blame] | 78 | </p> |
| 79 | |
| 80 | <p> |
Brian Paul | 58be9e6 | 2004-09-24 20:31:02 +0000 | [diff] [blame] | 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. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 85 | </p> |
Brian Paul | 58be9e6 | 2004-09-24 20:31:02 +0000 | [diff] [blame] | 86 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 87 | </BODY> |
| 88 | </HTML> |