Class: GlStuff::Material
- Inherits:
-
Object
- Object
- GlStuff::Material
- Defined in:
- lib/examples/GlStuff/material.rb
Instance Attribute Summary collapse
-
#ambient ⇒ Object
Returns the value of attribute ambient.
-
#diffuse ⇒ Object
Returns the value of attribute diffuse.
-
#emission ⇒ Object
Returns the value of attribute emission.
-
#shininess ⇒ Object
Returns the value of attribute shininess.
-
#specular ⇒ Object
Returns the value of attribute specular.
Instance Method Summary collapse
-
#initialize ⇒ Material
constructor
A new instance of Material.
- #setup_material ⇒ Object
Constructor Details
#initialize ⇒ Material
Returns a new instance of Material.
6 7 8 9 10 11 12 13 |
# File 'lib/examples/GlStuff/material.rb', line 6 def initialize() @ambient = GlUtility.mem_pointer([ 0.7, 0.7, 0.7, 1.0 ]) @ambient_color = GlUtility.mem_pointer([ 0.8, 0.8, 0.2, 1.0 ]) @diffuse = GlUtility.mem_pointer([ 0.5, 0.5, 0.5, 1.0 ]) @specular = GlUtility.mem_pointer([ 1.0, 1.0, 1.0, 1.0 ]) @shininess = GlUtility.mem_pointer([ 0.0 ]) # 0 is noe, 100 would be hide @emission = GlUtility.mem_pointer([0.3, 0.2, 0.2, 0.0]) end |
Instance Attribute Details
#ambient ⇒ Object
Returns the value of attribute ambient.
4 5 6 |
# File 'lib/examples/GlStuff/material.rb', line 4 def ambient @ambient end |
#diffuse ⇒ Object
Returns the value of attribute diffuse.
4 5 6 |
# File 'lib/examples/GlStuff/material.rb', line 4 def diffuse @diffuse end |
#emission ⇒ Object
Returns the value of attribute emission.
4 5 6 |
# File 'lib/examples/GlStuff/material.rb', line 4 def emission @emission end |
#shininess ⇒ Object
Returns the value of attribute shininess.
4 5 6 |
# File 'lib/examples/GlStuff/material.rb', line 4 def shininess @shininess end |
#specular ⇒ Object
Returns the value of attribute specular.
4 5 6 |
# File 'lib/examples/GlStuff/material.rb', line 4 def specular @specular end |
Instance Method Details
#setup_material ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/examples/GlStuff/material.rb', line 15 def setup_material glMaterialfv(GL_FRONT, GL_AMBIENT, @ambient) #glMaterialfv(GL_FRONT, GL_DIFFUSE, @diffuse) #glMaterialfv(GL_FRONT, GL_SPECULAR, @specular) #glMaterialfv(GL_FRONT, GL_SHININESS, @shininess) #glMaterialfv(GL_FRONT, GL_EMISSION, @emission) end |