X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=docs%2Fosmesa.html;h=7ad512e28e7d77179f88e522e191621a92ed3ca6;hb=4a495e1a857ba344ec14924cf2247f1124c80e85;hp=ace42001131976356b43aa17cb36317a06c9f97c;hpb=0b27aceae2464db3dd149cf4fd667e353a655c5e;p=mesa.git diff --git a/docs/osmesa.html b/docs/osmesa.html index ace42001131..7ad512e28e7 100644 --- a/docs/osmesa.html +++ b/docs/osmesa.html @@ -1,74 +1,80 @@ - + + + + + Off-screen Rendering + + + -Off-screen Rendering +
+ The Mesa 3D Graphics Library +
- + +
-

Off-screen Rendering

+

Off-screen Rendering

-Mesa 1.2.4 introduced off-screen rendering, a facility for generating -3-D imagery without having to open a window on your display. Mesa's -simple off-screen rendering interface is completely operating system -and window system independent so programs which use off-screen -rendering should be very portable. This feature effectively -enables you to use Mesa as an off-line, batch-oriented renderer. +Mesa's off-screen interface is used for rendering into user-allocated memory +without any sort of window system or operating system dependencies. +That is, the GL_FRONT colorbuffer is actually a buffer in main memory, +rather than a window on your display.

+

-The "OSMesa" API provides 3 functions for making off-screen +The OSMesa API provides three basic functions for making off-screen renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for -more information. See the demos/osdemo.c file for an example program. -There is no facility for writing images to files. That's up to you. +more information about the API functions.

+

-If you want to generate large images (larger than 1280x1024) you'll -have to edit the src/config.h file to change MAX_WIDTH and MAX_HEIGHT -then recompile Mesa. Image size should only be limited by available -memory. +The OSMesa interface may be used with any of three software renderers:

+
    +
  1. llvmpipe - this is the high-performance Gallium LLVM driver +
  2. softpipe - this it the reference Gallium software driver +
  3. swrast - this is the legacy Mesa software rasterizer +
-

Deep color channels

-

- For some applications 8-bit color channels don't have sufficient - accuracy (film and IBR, for example). If you're in this situation - you'll be happy to know that Mesa supports 16-bit and 32-bit color - channels through the OSMesa interface. When using 16-bit channels, - channels are GLushorts and pixels occupy 8 bytes. When using 32-bit - channels, channels are GLfloats and pixels occupy 16 bytes. +There are several examples of OSMesa in the mesa/demos repository.

+ +

Building OSMesa

+

- To build Mesa/OSMesa with 16-bit color channels: -

-      cd Mesa-4.x/src
-      make -f Makefile.X11 clean
-      make -f Makefile.OSMesa16 linux-osmesa16
-
+Configure and build Mesa with something like: - For 32-bit channels:
-      cd Mesa-4.x/src
-      make -f Makefile.X11 clean
-      make -f Makefile.OSMesa16 linux-osmesa32
+meson builddir -Dosmesa=gallium -Dgallium-drivers=swrast -Ddri-drivers=[] -Dvulkan-drivers=[] -Dprefix=$PWD/builddir/install
+ninja -C builddir install
 

-If you're not using Linux, you can easily edit Make-config and add -an appropriate configuration. +Make sure you have LLVM installed first if you want to use the llvmpipe driver.

+

-The Mesa/tests/osdemo16.c file (available via CVS) demonstrates how -to use this feature. +When the build is complete you should find:

+
+$PWD/builddir/install/lib/libOSMesa.so  (swrast-based OSMesa)
+$PWD/builddir/install/lib/gallium/libOSMsea.so  (gallium-based OSMesa)
+
+

-BE WARNED: 16 and 32-bit channel support has not been exhaustively -tested and there may be some bugs. However, a number of people have -been using this feature successfully so it can't be too broken. +Set your LD_LIBRARY_PATH to point to $PWD/builddir/install to use the libraries

+

+When you link your application, link with -lOSMesa +

- - +
+ +