class Roglew::Shader
Attributes
handle[R]
id[R]
type[R]
Public Class Methods
finalize(id, handle)
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 14 def self.finalize(id, handle) proc do #puts "releasing shader #{id}" handle.bind { handle.glDeleteShader(id) } end end
new(handle, type, src = nil)
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 5 def initialize(handle, type, src = nil) @handle, @type = handle, type @id = handle.bind { handle.glCreateShader(type) } raise OpenGLError, "couldn't create a shader of type #{type.to_s(16)}" if @id == 0 compile(File.file?(src) ? File.read(src) : src) if src ObjectSpace.define_finalizer(self, self.class.finalize(@id, @handle)) end
Public Instance Methods
compile(src)
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 21 def compile(src) @handle.bind do |context| context.shader_sources(@id, src) @handle.glCompileShader(@id) raise CompileError, info_log unless compile_status end end
compile_status()
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 29 def compile_status @handle.bind { |context| context.get_shader(@id, GL::COMPILE_STATUS) } end
Also aliased as: compiled?
delete_status()
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 33 def delete_status @handle.bind { |context| context.get_shader(@id, GL::DELETE_STATUS) } end
info_log()
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 41 def info_log @handle.bind { |context| context.get_shader_info_log(@id) } end
info_log_length()
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 37 def info_log_length @handle.bind { |context| context.get_shader(@id, GL::INFO_LOG_LENGTH) } end
source_length()
click to toggle source
# File lib/roglew/extensions/GL_VERSION_2_0/shader.rb, line 45 def source_length @handle.bind { |context| context.get_shader(@id, GL::SHADER_SOURCE_LENGTH) } end