preparing for textures
This commit is contained in:
parent
0a8691414e
commit
f672782921
@ -19,7 +19,8 @@ using namespace std;
|
|||||||
|
|
||||||
enum Locations {
|
enum Locations {
|
||||||
LOC_POSITION,
|
LOC_POSITION,
|
||||||
LOC_NORMAL
|
LOC_NORMAL,
|
||||||
|
LOC_TEXTURE
|
||||||
};
|
};
|
||||||
|
|
||||||
class Viewer
|
class Viewer
|
||||||
@ -267,7 +268,8 @@ void Viewer::display()
|
|||||||
stride, (GLvoid *) m_obj.getNormalOffset());
|
stride, (GLvoid *) m_obj.getNormalOffset());
|
||||||
if (m_obj.doTextures())
|
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 =
|
for (map<string, WFObj::Material>::iterator it =
|
||||||
m_obj.getMaterials().begin();
|
m_obj.getMaterials().begin();
|
||||||
@ -287,9 +289,9 @@ void Viewer::display()
|
|||||||
{
|
{
|
||||||
cerr << "error: textured materials not implemented yet" << endl;
|
cerr << "error: textured materials not implemented yet" << endl;
|
||||||
}
|
}
|
||||||
glDrawElements(GL_TRIANGLES, it->second.num_vertices,
|
glDrawElements(GL_TRIANGLES, m.num_vertices,
|
||||||
GL_UNSIGNED_SHORT,
|
GL_UNSIGNED_SHORT,
|
||||||
(GLvoid *) (sizeof(GLushort) * it->second.first_vertex));
|
(GLvoid *) (sizeof(GLushort) * m.first_vertex));
|
||||||
}
|
}
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user