void LegacyOpenGLRenderer::DrawModel(const Model& InModel) { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); if (InModel.GetTexture().GetTexture()) { const Texture& tex = InModel.GetTexture(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, InModel.GetTexture().GetTexture()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); glMatrixMode(GL_TEXTURE); glPushMatrix(); const Vector3 &offset = tex.GetOffset(), &scale = tex.GetScale(); const Rotation &rot = tex.GetRotation(); glTranslatef(offset.x, offset.y, offset.z); glRotatef(rot.deg, rot.axis.x, rot.axis.y, rot.axis.z); glScalef(scale.x, scale.y, scale.z); } glMatrixMode(GL_MODELVIEW); glPushMatrix(); glVertexPointer(3, GL_FLOAT, 0, &(InModel.GetVertices()[0])); glNormalPointer(GL_FLOAT, 0, &(InModel.GetNormals()[0])); glTexCoordPointer(2, GL_FLOAT, 0, &(InModel.GetTexCoords()[0])); glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(InModel.GetVertices().size()) / 3); //glDrawElements(GL_TRIANGLES, Model.GetIndicies().size(), GL_UNSIGNED_INT, &(cube.GetIndicies()[0])); glPopMatrix(); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); if (InModel.GetTexture().GetTexture()) { glBindTexture(GL_TEXTURE_2D, NULL); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_TEXTURE); glPopMatrix(); glMatrixMode(GL_MODELVIEW); } }