Class: Hate::Graphics::Shader::Program

Inherits:
Object
  • Object
show all
Defined in:
lib/hate/graphics/shader.rb

Instance Method Summary collapse

Constructor Details

#initializeProgram

Returns a new instance of Program.



7
8
9
# File 'lib/hate/graphics/shader.rb', line 7

def initialize
  @program = glCreateProgram
end

Instance Method Details

#attach(shader) ⇒ Object



11
12
13
14
# File 'lib/hate/graphics/shader.rb', line 11

def attach(shader)
  glAttachShader(@program, shader)
  self
end

#compileObject



16
17
18
19
# File 'lib/hate/graphics/shader.rb', line 16

def compile
  glLinkProgram(@program)
  self
end

#runObject



21
22
23
# File 'lib/hate/graphics/shader.rb', line 21

def run
  glUseProgram(@program)
end