Class: Parasol::Shader

Inherits:
Object
  • Object
show all
Includes:
OpenGLContext
Defined in:
lib/parasol/shader.rb

Direct Known Subclasses

FragmentShader, GeometryShader, VertexShader

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OpenGLContext

#require_opengl_context!

Constructor Details

#initialize(source:, type:) ⇒ Shader

Returns a new instance of Shader.



9
10
11
12
# File 'lib/parasol/shader.rb', line 9

def initialize source:, type:
  @source = source
  @type = type
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



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

def source
  @source
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#compiled?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/parasol/shader.rb', line 22

def compiled?
  !the_shader.nil?
end

#deleteObject



18
19
20
# File 'lib/parasol/shader.rb', line 18

def delete
  cleanup
end

#handleObject



14
15
16
# File 'lib/parasol/shader.rb', line 14

def handle
  the_shader || compile_the_shader!
end