Commit 96379a9a authored by Anakin's avatar Anakin

fixed texture error

parent 481256e8
...@@ -132,7 +132,16 @@ void OpenGlViewer::paintGL() ...@@ -132,7 +132,16 @@ void OpenGlViewer::paintGL()
{ {
// set the texture // set the texture
std::uint32_t tmp_textureIndex = segmentIterator->textureIndex >= m_vTextures->size() ? m_vTextures->size() - 1 : segmentIterator->textureIndex; std::uint32_t tmp_textureIndex = segmentIterator->textureIndex >= m_vTextures->size() ? m_vTextures->size() - 1 : segmentIterator->textureIndex;
if (m_oglTexture->isCreated())
{
m_oglTexture->destroy();
m_oglTexture->create();
m_oglTexture->setSize(m_vTextures->at(tmp_textureIndex)->width(), m_vTextures->at(tmp_textureIndex)->height());
m_oglTexture->setData(*m_vTextures->at(tmp_textureIndex)); m_oglTexture->setData(*m_vTextures->at(tmp_textureIndex));
}
// give the MVP to the shader // give the MVP to the shader
m_program->setUniformValue(m_uniformMVP, getMVPMatrix(modelIndex)); m_program->setUniformValue(m_uniformMVP, getMVPMatrix(modelIndex));
......
#include "Header\MainWindow.h" #include "Header\MainWindow.h"
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
int startGUI(int argc, char* argv[]) int startGUI(int argc, char* argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
......
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