Class: Mittsu::OpenGLProgram
- Inherits:
-
Object
- Object
- Mittsu::OpenGLProgram
- Defined in:
- lib/mittsu/renderers/opengl/opengl_program.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#code ⇒ Object
Returns the value of attribute code.
-
#fragment_shader ⇒ Object
Returns the value of attribute fragment_shader.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#program ⇒ Object
readonly
Returns the value of attribute program.
-
#uniforms ⇒ Object
readonly
Returns the value of attribute uniforms.
-
#used_times ⇒ Object
Returns the value of attribute used_times.
-
#vertex_shader ⇒ Object
Returns the value of attribute vertex_shader.
Instance Method Summary collapse
-
#initialize(renderer, code, material, parameters) ⇒ OpenGLProgram
constructor
A new instance of OpenGLProgram.
Constructor Details
#initialize(renderer, code, material, parameters) ⇒ OpenGLProgram
Returns a new instance of OpenGLProgram.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 9 def initialize(renderer, code, material, parameters) @id = (@@id ||= 1).tap { @@id += 1 } @renderer = renderer compile_and_link_program(material, parameters) cache_uniform_locations(material.shader[:uniforms] || {}, parameters) cache_attribute_locations(material.attributes || {}, parameters) @code = code @used_times = 2 end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 7 def attributes @attributes end |
#code ⇒ Object
Returns the value of attribute code.
7 8 9 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 7 def code @code end |
#fragment_shader ⇒ Object
Returns the value of attribute fragment_shader.
7 8 9 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 7 def fragment_shader @fragment_shader end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 6 def id @id end |
#program ⇒ Object (readonly)
Returns the value of attribute program.
6 7 8 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 6 def program @program end |
#uniforms ⇒ Object (readonly)
Returns the value of attribute uniforms.
6 7 8 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 6 def uniforms @uniforms end |
#used_times ⇒ Object
Returns the value of attribute used_times.
7 8 9 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 7 def used_times @used_times end |
#vertex_shader ⇒ Object
Returns the value of attribute vertex_shader.
7 8 9 |
# File 'lib/mittsu/renderers/opengl/opengl_program.rb', line 7 def vertex_shader @vertex_shader end |