Commit e963b753 authored by Anakin's avatar Anakin
Browse files

fixed texture problem

parent b58b7c47
...@@ -107,6 +107,7 @@ void GeometryEngine::loadFile(const char* filePath) ...@@ -107,6 +107,7 @@ void GeometryEngine::loadFile(const char* filePath)
} }
catch (std::invalid_argument e) catch (std::invalid_argument e)
{ {
clearData();
emit sendMessage(QString(e.what()), 2); emit sendMessage(QString(e.what()), 2);
} }
} }
...@@ -126,7 +127,7 @@ void GeometryEngine::loadTexture(const char* filePath, const char* fileName) ...@@ -126,7 +127,7 @@ void GeometryEngine::loadTexture(const char* filePath, const char* fileName)
img = loadTga((std::string(filePath) + std::string(fileName)).c_str(), loadSuccess); img = loadTga((std::string(filePath) + std::string(fileName)).c_str(), loadSuccess);
//TODO: emit if not successfull //TODO: emit if not successfull
if (loadSuccess) if (!loadSuccess)
{ {
QString msg = "WARNING: texture not found or corrupted: "; QString msg = "WARNING: texture not found or corrupted: ";
msg += QString(fileName); msg += QString(fileName);
...@@ -205,6 +206,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program) ...@@ -205,6 +206,7 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
for (auto& it : m_drawList) for (auto& it : m_drawList)
{ {
Q_ASSERT(!m_textures.isEmpty());
// bind the correct texture // bind the correct texture
if (it.textureIndex < m_textures.size()) if (it.textureIndex < m_textures.size())
m_textures.at(it.textureIndex)->bind(); m_textures.at(it.textureIndex)->bind();
......
...@@ -122,7 +122,7 @@ void MainWindow::aboutTool() ...@@ -122,7 +122,7 @@ void MainWindow::aboutTool()
void MainWindow::printMessage(QString message, int severity) void MainWindow::printMessage(QString message, int severity)
{ {
if (severity < m_curSeverity) if (!ui->statusBar->currentMessage().isEmpty() && severity < m_curSeverity)
return; return;
m_curSeverity = severity; m_curSeverity = severity;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment