add wireframe paint option,

write file information on the screen,
bug fixes
This commit is contained in:
Anakin
2017-01-16 14:24:30 +01:00
parent 454ed45fa1
commit 86dfe32145
7 changed files with 45 additions and 7 deletions

View File

@@ -127,7 +127,7 @@ void GeometryEngine::loadFile(QString filePath)
}
}
void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program, bool wireframe)
{
if (!m_arrayBuf.isCreated() || !m_indexBuf.isCreated())
return;
@@ -178,7 +178,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
bool tmp_transparent(false);
// bind the correct texture
if (it.textureIndex < m_materials->size())
if (it.textureIndex < m_materials->size() && m_materials->at(it.textureIndex).texture != Q_NULLPTR)
{
m_materials->at(it.textureIndex).texture->bind();
tmp_transparent = m_materials->at(it.textureIndex).transparent;
@@ -195,7 +195,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
program->setUniformValue("b_transparent", tmp_transparent);
// Draw cube geometry using indices from VBO 1
glDrawElements(GL_TRIANGLES, it.size, GL_UNSIGNED_INT, (void*)(it.offset * sizeof(GLuint)));
glDrawElements(wireframe? GL_LINES : GL_TRIANGLES, it.size, GL_UNSIGNED_INT, (void*)(it.offset * sizeof(GLuint)));
}
}