Class: GlStuff::Material

Inherits:
Object
  • Object
show all
Defined in:
lib/examples/GlStuff/material.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMaterial

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

#ambientObject

Returns the value of attribute ambient.



4
5
6
# File 'lib/examples/GlStuff/material.rb', line 4

def ambient
  @ambient
end

#diffuseObject

Returns the value of attribute diffuse.



4
5
6
# File 'lib/examples/GlStuff/material.rb', line 4

def diffuse
  @diffuse
end

#emissionObject

Returns the value of attribute emission.



4
5
6
# File 'lib/examples/GlStuff/material.rb', line 4

def emission
  @emission
end

#shininessObject

Returns the value of attribute shininess.



4
5
6
# File 'lib/examples/GlStuff/material.rb', line 4

def shininess
  @shininess
end

#specularObject

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_materialObject



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