Class: RBGLox::Mesh
- Includes:
- Gl
- Defined in:
- lib/rbglox/mesh.rb
Overview
Semi-abstract Mesh Class
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#draw ⇒ Object
Draw the mesh by calling the internal display list.
-
#free ⇒ Object
Free the mesh by destroying the internal display list.
-
#initialize(verts, texs, norms, tris) ⇒ Mesh
constructor
Constructor.
-
#reload ⇒ Object
Reload the mesh.
Constructor Details
#initialize(verts, texs, norms, tris) ⇒ Mesh
Constructor
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rbglox/mesh.rb', line 6 def initialize(verts, texs, norms, tris) @id = glGenLists 1 glNewList id, GL_COMPILE glPushClientAttrib GL_CLIENT_VERTEX_ARRAY_BIT glEnableClientState GL_VERTEX_ARRAY glEnableClientState GL_TEXTURE_COORD_ARRAY glEnableClientState GL_NORMAL_ARRAY glVertexPointer 3, GL_FLOAT, 0, verts glNormalPointer GL_FLOAT, 0, norms glTexCoordPointer 2, GL_FLOAT, 0, texs glDrawElements GL_TRIANGLES, tris.size, GL_UNSIGNED_INT, tris glPopClientAttrib glEndList end |
Instance Method Details
#draw ⇒ Object
Draw the mesh by calling the internal display list
23 24 25 |
# File 'lib/rbglox/mesh.rb', line 23 def draw glCallList id end |
#free ⇒ Object
Free the mesh by destroying the internal display list
33 34 35 |
# File 'lib/rbglox/mesh.rb', line 33 def free glDeleteLists id, 1 end |
#reload ⇒ Object
Reload the mesh
28 29 30 |
# File 'lib/rbglox/mesh.rb', line 28 def reload # do nothing end |