osmesa.html revision 7357f20b1ee3ab0c58c7a20f44bf83fdfe0e256e
1<HTML> 2 3<TITLE>Off-screen Rendering</TITLE> 4 5<BODY text="#000000" bgcolor="#55bbff" link="#111188"> 6 7<H1>Off-screen Rendering</H1> 8 9 10<p> 11Mesa 1.2.4 introduced off-screen rendering, a facility for generating 123-D imagery without having to open a window on your display. Mesa's 13simple off-screen rendering interface is completely operating system 14and window system independent so programs which use off-screen 15rendering should be very portable. This feature effectively 16enables you to use Mesa as an off-line, batch-oriented renderer. 17</p> 18<p> 19The "OSMesa" API provides 3 functions for making off-screen 20renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and 21OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for 22more information. See the demos/osdemo.c file for an example program. 23There is no facility for writing images to files. That's up to you. 24</p> 25<p> 26If you want to generate large images (larger than 1280x1024) you'll 27have to edit the src/config.h file to change MAX_WIDTH and MAX_HEIGHT 28then recompile Mesa. Image size should only be limited by available 29memory. 30</p> 31 32 33<H2>Deep color channels</H2> 34 35<p> 36 For some applications 8-bit color channels don't have sufficient 37 accuracy (film and IBR, for example). If you're in this situation 38 you'll be happy to know that Mesa supports 16-bit and 32-bit color 39 channels through the OSMesa interface. When using 16-bit channels, 40 channels are GLushorts and RGBA pixels occupy 8 bytes. When using 32-bit 41 channels, channels are GLfloats and RGBA pixels occupy 16 bytes. 42</p> 43<p> 44 To build Mesa/OSMesa with 16-bit color channels: 45<pre> 46 cd Mesa-5.x/src 47 make -f Makefile.X11 clean 48 make -f Makefile.OSMesa16 linux-osmesa16 49</pre> 50 51 For 32-bit channels: 52<pre> 53 cd Mesa-5.x/src 54 make -f Makefile.X11 clean 55 make -f Makefile.OSMesa16 linux-osmesa32 56</pre> 57 58<p> 59You'll wind up with a library named libOSMesa16.so or libOSMesa32.so. 60</p> 61 62<p> 63If you're not using Linux, you can easily edit Make-config and add 64an appropriate configuration. 65</p> 66<p> 67The Mesa/tests/osdemo16.c file (available via CVS) demonstrates how 68to use this feature. 69</p> 70<p> 71BE WARNED: 16 and 32-bit channel support has not been exhaustively 72tested and there may be some bugs. However, a number of people have 73been using this feature successfully so it can't be too broken. 74</p> 75 76 77</BODY> 78</HTML> 79