Sha256: 7245163f2686bc6d354fbbcbf236d14e79d67e6f3af79bf2793472d3c847683a

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib")
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../../ext")

require 'ray'

Ray.game "My Own Buffer" do
  register { add_hook :quit, method(:exit!) }

  scene :triangle do
    @buffer = Ray::GL::Buffer.new :static, Ray::Vertex

    @buffer[0] = Ray::Vertex.new([100, 100], Ray::Color.new(255, 0, 0))
    @buffer[1] = Ray::Vertex.new([200, 100], Ray::Color.new(255, 255, 0))
    @buffer[2] = Ray::Vertex.new([200, 200], Ray::Color.new(255, 255, 255))

    @buffer.update

    # We need this: projection matrix isn't set if you don't use drawables
    window.shader["in_Projection"] = window.view.matrix

    render do |win|
      win.make_current
      Ray::GL.draw_arrays :triangles, 0, 3
    end
  end

  scenes << :triangle
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ray-0.1.1 samples/buffer/buffer.rb
ray-0.1.0 samples/buffer/buffer.rb