You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mesa's off-screen rendering interface is used for rendering into user-allocated Ruby string.
That is, the GL_FRONT colorbuffer is actually a buffer in main memory, rather than a window on your display.
There are no window system or operating system dependencies.
One potential application is to use Mesa as an off-line, batch-style renderer.
The OSMesa API provides two basic functions for making off-screen renderings: OSMesa::Context.new() and OSMesa::Context#MakeCurrent().
See API-docs for more information about the API functions.
Installation
Install osmesa library and header files:
on Ubuntu/Debian:
$ sudo apt-get install libosmesa6-dev
on Windows: No need to install dependencies - the binary gem includes everything
Install the gem:
$ gem install osmesa
Usage Example
Use OSMesa to create an offline rendering buffer and use the opengl gem to render a red line.
The raw RGBA image buffer is written to a PNG image file with the help of the chunky_png gem: