trying to fix the crash
This commit is contained in:
@@ -98,7 +98,7 @@ void GeometryEngine::loadFile(const char* filePath)
|
||||
emit sendMessage("loading textures..", 0);
|
||||
// load the textures
|
||||
for(auto& it : *textureNames)
|
||||
loadTexture(std::string(path + it).c_str());
|
||||
loadTexture(path.c_str(), it.c_str());
|
||||
|
||||
emit requestUpdate();
|
||||
emit sendMessage("done..", 0);
|
||||
@@ -109,11 +109,26 @@ void GeometryEngine::loadFile(const char* filePath)
|
||||
}
|
||||
}
|
||||
|
||||
void GeometryEngine::loadTexture(const char* filePath)
|
||||
void GeometryEngine::loadTexture(const char* filePath, const char* fileName)
|
||||
{
|
||||
bool loadSuccess;
|
||||
QImage img = loadTga(filePath, loadSuccess);
|
||||
bool loadSuccess(false);
|
||||
QImage img;
|
||||
|
||||
//if (!strcmp(fileName, ""))
|
||||
//{
|
||||
// img = QImage(1, 1, QImage::Format_RGB32);
|
||||
// img.fill(Qt::red);
|
||||
//}
|
||||
//else
|
||||
img = loadTga((std::string(filePath) + std::string(fileName)).c_str(), loadSuccess);
|
||||
|
||||
//TODO: emit if not successfull
|
||||
if (!loadSuccess)
|
||||
{
|
||||
QString msg = "WARNING: texture not found or corrupted: ";
|
||||
msg += QString(fileName);
|
||||
emit sendMessage(msg, 1);
|
||||
}
|
||||
// Load image to OglTexture
|
||||
QOpenGLTexture* new_texture = new QOpenGLTexture(img.mirrored());
|
||||
|
||||
|
Reference in New Issue
Block a user