A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/larskanis/osmesa below:

larskanis/osmesa: Ruby bindings for osmesa

Warning: OSMesa was removed from mesa-25 here stating:

Remove osmesa

It's redundant with EGL surfaceless and it doesn't have much use.

It's also available from the amber branch, so distros should get it from
there if they want to continue packaging it.

Unfortunately there seems to be no egl binding for ruby so far.

OSMesa - Off-screen Rendering

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.

Install osmesa library and header files:

$ sudo apt-get install libosmesa6-dev

Install the gem:

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:

require 'osmesa'
require 'opengl'
require 'chunky_png'

width, height = 100, 70
ctx = OSMesa::Context.new(OSMesa::RGBA, nil)
buffer = "rgba" * width * height
ctx.MakeCurrent(buffer, GL::UNSIGNED_BYTE, width, height)

OSMesa.load_lib
GL.MatrixMode(GL::MODELVIEW)
GL.LoadIdentity()

GL.Clear(GL::COLOR_BUFFER_BIT)

GL.Color4ub(0xff, 0x00, 0x00, 0xff)
GL.Begin(GL::LINES)
GL.Vertex2f(0.5, 0.5)
GL.Vertex2f(-0.5, -0.5)
GL.End

GL.Flush()

png = ChunkyPNG::Image.from_rgba_stream(width, height, buffer)
png.save('test.png')
Build Windows fat binary gems

This project makes use of rake-compiler-dock for building binary Windows gems. This is done by the following rake task:

After download and compile, there should be some files in the pkg directory: pkg/osmesa-{VERSION}-{PLATFORM}.gem

  1. Fork it ( http://github.com/larskanis/osmesa/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4