Class: Hate::Graphics::Shapes::Cube

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

Instance Attribute Summary

Attributes inherited from Base

#c, #memory, #ra, #rx, #ry, #rz, #size, #x, #y, #z

Instance Method Summary collapse

Methods inherited from Base

#color, #compile, #destroy, #initialize, #rotate, #run, #translate

Constructor Details

This class inherits a constructor from Hate::Graphics::Shapes::Base

Instance Method Details

#buildObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/hate/graphics/shapes.rb', line 72

def build
  glBegin(GL_QUADS)
  
  glNormal3f(0.0, 0.0, 1.0)
  glVertex3f( @size, @size,-@size)
  glVertex3f(-@size, @size,-@size)
  glVertex3f(-@size, @size, @size)
  glVertex3f( @size, @size, @size)
  
  glNormal3f(0.0, 0.0, -1.0)
glVertex3f( @size,-@size, @size)
glVertex3f(-@size,-@size, @size)
glVertex3f(-@size,-@size,-@size)
glVertex3f( @size,-@size,-@size)

glNormal3f(0.0, 1.0, 0.0)
glVertex3f( @size, @size, @size)
glVertex3f(-@size, @size, @size)
glVertex3f(-@size,-@size, @size)
glVertex3f( @size,-@size, @size)
  
  glNormal3f(0.0, -1.0, 0.0)
glVertex3f( @size,-@size,-@size)
glVertex3f(-@size,-@size,-@size)
glVertex3f(-@size, @size,-@size)
glVertex3f( @size, @size,-@size)

glNormal3f(1.0, 0.0, 0.0)
glVertex3f(-@size, @size, @size)
glVertex3f(-@size, @size,-@size)
glVertex3f(-@size,-@size,-@size)
glVertex3f(-@size,-@size, @size)

glNormal3f(-1.0, 0.0, 0.0)
glVertex3f(@size, @size,-@size)
glVertex3f(@size, @size, @size)
glVertex3f(@size,-@size, @size)
glVertex3f(@size,-@size,-@size)
  
  glEnd
end