Module: Roglew::RenderContextExtension::ClassMethods
- Defined in:
- lib/roglew/render_context_extension.rb
Instance Method Summary collapse
Instance Method Details
#def_delete(name, function) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/roglew/render_context_extension.rb', line 14 def def_delete(name, function) checks_current define_method "delete_#{name}", ->(ids) do raise Roglew::RenderContext::ContextError, 'render handle not current' unless @rh.current? p = FFI::MemoryPointer.new(:uint, ids.count) p.write_array_of_uint(ids) send(function, ids.count, p) nil end end |
#def_gen(name, function) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/roglew/render_context_extension.rb', line 4 def def_gen(name, function) checks_current define_method "gen_#{name}", ->(count = 1) do p = FFI::MemoryPointer.new(:uint, count) @rh.send(function, count, p) ids = p.read_array_of_uint(count) count == 1 ? ids[0] : ids end end |
#def_object(name) ⇒ Object
25 26 27 28 |
# File 'lib/roglew/render_context_extension.rb', line 25 def def_object(name) def_gen(name.to_s.snakecase, "glGen#{name}") def_delete(name.to_s.snakecase, "glDelete#{name}") end |