preparing for textures

This commit is contained in:
Josh Holtrop 2011-05-16 15:43:54 -04:00
parent 0a8691414e
commit f672782921

View File

@ -19,7 +19,8 @@ using namespace std;
enum Locations {
LOC_POSITION,
LOC_NORMAL
LOC_NORMAL,
LOC_TEXTURE
};
class Viewer
@ -267,7 +268,8 @@ void Viewer::display()
stride, (GLvoid *) m_obj.getNormalOffset());
if (m_obj.doTextures())
{
/* TODO */
glVertexAttribPointer(LOC_TEXTURE, 3, GL_FLOAT, GL_FALSE,
stride, (GLvoid *) m_obj.getTextureCoordOffset());
}
for (map<string, WFObj::Material>::iterator it =
m_obj.getMaterials().begin();
@ -287,9 +289,9 @@ void Viewer::display()
{
cerr << "error: textured materials not implemented yet" << endl;
}
glDrawElements(GL_TRIANGLES, it->second.num_vertices,
glDrawElements(GL_TRIANGLES, m.num_vertices,
GL_UNSIGNED_SHORT,
(GLvoid *) (sizeof(GLushort) * it->second.first_vertex));
(GLvoid *) (sizeof(GLushort) * m.first_vertex));
}
SDL_GL_SwapBuffers();
}