Module: GL_VERSION_1_5::RenderContext

Includes:
Roglew::RenderContextExtension
Defined in:
lib/roglew/extensions/GL_VERSION_1_5.rb

Instance Method Summary collapse

Methods included from Roglew::RenderContextExtension

included

Instance Method Details

#buffer_data(target, usage, buffer = nil, type = nil) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/roglew/extensions/GL_VERSION_1_5.rb', line 103

def buffer_data(target, usage, buffer = nil, type = nil)
  size, pointer = if buffer.is_a?(Array) && buffer.size > 0
                    p = FFI::MemoryPointer.new(type, buffer.size)
                    p.send("write_array_of_#{type}", buffer)
                    [p.size, p]
                  else
                    size = buffer.respond_to?(:to_i) ? buffer.to_i : 0
                    size *= if size > 0 && type
                              type = FFI.find_type(type) if type.is_a?(Symbol)
                              type.size
                            else
                              1
                            end
                    [size, nil]
                  end

  @rh.glBufferData(target, size, pointer, usage)
end

#buffer_sub_data(target, offset, type, buffer) ⇒ Object



123
124
125
126
127
# File 'lib/roglew/extensions/GL_VERSION_1_5.rb', line 123

def buffer_sub_data(target, offset, type, buffer)
  pointer = FFI::MemoryPointer.new(type, buffer.size)
  pointer.send("write_array_of_#{type}", buffer)
  @rh.glBufferSubData(target, offset, buffer.size, pointer)
end

#create_bufferObject



93
94
95
# File 'lib/roglew/extensions/GL_VERSION_1_5.rb', line 93

def create_buffer
  Roglew::Buffer.new(@rh)
end

#create_queryObject



98
99
100
# File 'lib/roglew/extensions/GL_VERSION_1_5.rb', line 98

def create_query
  Roglew::Query.new(@rh)
end