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 | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 21 | Mesa's off-screen interface is used for rendering into user-allocated memory |
| 22 | without any sort of window system or operating system dependencies. |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 23 | That is, the GL_FRONT colorbuffer is actually a buffer in main memory, |
| 24 | rather than a window on your display. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 25 | </p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 26 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 27 | <p> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 28 | The OSMesa API provides three basic functions for making off-screen |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 29 | renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and |
| 30 | OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 31 | more information about the API functions. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 32 | </p> |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 33 | |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 34 | <p> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 35 | The OSMesa interface may be used with any of three software renderers: |
| 36 | </p> |
| 37 | <ol> |
| 38 | <li>llvmpipe - this is the high-performance Gallium LLVM driver |
| 39 | <li>softpipe - this it the reference Gallium software driver |
| 40 | <li>swrast - this is the legacy Mesa software rasterizer |
| 41 | </ol> |
| 42 | |
| 43 | |
| 44 | <p> |
Andreas Boll | 7b314b3 | 2012-09-20 16:01:15 +0200 | [diff] [blame] | 45 | There are several examples of OSMesa in the mesa/demos repository. |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 46 | </p> |
| 47 | |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 48 | <h1>Building OSMesa</h1> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 49 | |
| 50 | <p> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 51 | Configure and build Mesa with something like: |
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 | <pre> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 54 | configure --enable-osmesa --disable-driglx-direct --disable-dri --with-gallium-drivers=swrast |
| 55 | make |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 56 | </pre> |
| 57 | |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 58 | <p> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 59 | Make sure you have LLVM installed first if you want to use the llvmpipe driver. |
| 60 | </p> |
| 61 | |
| 62 | <p> |
| 63 | When the build is complete you should find: |
| 64 | </p> |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 65 | <pre> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 66 | lib/libOSMesa.so (swrast-based OSMesa) |
| 67 | lib/gallium/libOSMsea.so (gallium-based OSMesa) |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 68 | </pre> |
| 69 | |
| 70 | <p> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 71 | Set your LD_LIBRARY_PATH to point to one directory or the other to select |
| 72 | the library you want to use. |
Brian Paul | e35b905 | 2006-05-19 03:42:16 +0000 | [diff] [blame] | 73 | </p> |
| 74 | |
| 75 | <p> |
Brian Paul | 6f86b93 | 2013-03-11 18:31:22 -0600 | [diff] [blame] | 76 | When you link your application, link with -lOSMesa |
Brian Paul | 0b27ace | 2003-03-08 17:38:57 +0000 | [diff] [blame] | 77 | </p> |
Brian Paul | 58be9e6 | 2004-09-24 20:31:02 +0000 | [diff] [blame] | 78 | |
Andreas Boll | b5da52a | 2012-09-18 18:57:02 +0200 | [diff] [blame] | 79 | </div> |
Andreas Boll | ecd5c7c | 2012-06-12 09:05:03 +0200 | [diff] [blame] | 80 | </body> |
| 81 | </html> |