Module: Tessel::RBGL
- Defined in:
- lib/tessel/rbgl.rb
Class Method Summary collapse
- .framebuffer_to_image(framebuffer) ⇒ Object
- .image_to_texture(image) ⇒ Object
- .texture_from_png(path) ⇒ Object
Class Method Details
.framebuffer_to_image(framebuffer) ⇒ Object
22 23 24 |
# File 'lib/tessel/rbgl.rb', line 22 def framebuffer_to_image(framebuffer) Image.from_rgba(framebuffer.width, framebuffer.height, framebuffer.to_rgba_bytes) end |
.image_to_texture(image) ⇒ Object
13 14 15 16 |
# File 'lib/tessel/rbgl.rb', line 13 def image_to_texture(image) colors = image.bytes.bytes.each_slice(4).map { |r, g, b, a| Larb::Color.rgba(r / 255.0, g / 255.0, b / 255.0, a / 255.0) } ::RBGL::Engine::Texture.new(image.width, image.height, colors) end |