=== modified file 'mesh.cpp'
@@ -146,6 +146,29 @@
glDisableClientState(GL_NORMAL_ARRAY);
}
+void Mesh::render_array_attrib()
+{
+ // Enable the attributes
+ glEnableVertexAttribArray(Shader::VertexAttribLocation);
+ glEnableVertexAttribArray(Shader::NormalAttribLocation);
+ glEnableVertexAttribArray(Shader::TexCoordAttribLocation);
+
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+ glVertexAttribPointer(Shader::VertexAttribLocation, 3, GL_FLOAT,
+ GL_FALSE, sizeof(Vertex), &mVertex[0].v.x);
+ glVertexAttribPointer(Shader::NormalAttribLocation, 3, GL_FLOAT,
+ GL_FALSE, sizeof(Vertex), &mVertex[0].n.x);
+ glVertexAttribPointer(Shader::TexCoordAttribLocation, 2, GL_FLOAT,
+ GL_FALSE, sizeof(Vertex), &mVertex[0].t.u);
+
+ glDrawArrays(GL_TRIANGLES, 0, mVertexQty);
+
+ // Disable the attributes
+ glDisableVertexAttribArray(Shader::TexCoordAttribLocation);
+ glDisableVertexAttribArray(Shader::NormalAttribLocation);
+ glDisableVertexAttribArray(Shader::VertexAttribLocation);
+}
+
void Mesh::build_vbo()
{
#ifdef _DEBUG
=== modified file 'mesh.h'
@@ -44,6 +44,7 @@
void make_cube();
void make_torus();
void render_array();
+ void render_array_attrib();
void build_vbo();
void render_vbo();
void render_vbo_attrib();