fixed problem
This commit is contained in:
parent
e5490b9451
commit
b4b2538ea6
@ -28,7 +28,7 @@ struct textureData {
|
||||
bool alpha;
|
||||
std::uint32_t width;
|
||||
std::uint32_t height;
|
||||
const GLvoid* data;
|
||||
std::vector<std::uint8_t>* data;
|
||||
};
|
||||
|
||||
class OpenGLController
|
||||
|
@ -46,6 +46,7 @@ OpenGLController::~OpenGLController()
|
||||
{
|
||||
textureData* cursor = vTextures.back();
|
||||
vTextures.pop_back();
|
||||
delete cursor->data;
|
||||
delete cursor;
|
||||
}
|
||||
}
|
||||
@ -347,8 +348,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
tempData->alpha = tempTex.hasAlpha();
|
||||
tempData->width = tempTex.getWidth();
|
||||
tempData->height = tempTex.getHeight();
|
||||
tempData->data = tempTex.getData().data();
|
||||
|
||||
tempData->data = new std::vector<std::uint8_t>(tempTex.getData());
|
||||
}
|
||||
catch (std::invalid_argument e)
|
||||
{
|
||||
@ -356,7 +356,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
tempData->alpha = true;
|
||||
tempData->width = 1;
|
||||
tempData->height = 1;
|
||||
tempData->data = (const GLvoid*)solidColor;
|
||||
tempData->data = new std::vector<std::uint8_t>({ 0, 0, 255, 255 });
|
||||
}
|
||||
|
||||
vTextures.push_back(tempData);
|
||||
@ -370,7 +370,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
0,
|
||||
vTextures.front()->alpha ? GL_BGRA : GL_BGR,
|
||||
GL_UNSIGNED_BYTE,
|
||||
vTextures.front()->data
|
||||
vTextures.front()->data->data()
|
||||
);
|
||||
|
||||
// set some texture parameters
|
||||
@ -380,6 +380,4 @@ void OpenGLController::loadMsh(const char * path)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ int main(int argc, char** argv)
|
||||
else
|
||||
scene = OpenGLController::getInstance();
|
||||
|
||||
scene->loadMsh("..\\Release\\Msh\\multiModTex.msh");
|
||||
//scene->loadMsh("..\\Release\\Msh\\multiModTex.msh");
|
||||
scene->loadMsh("..\\Release\\Msh\\cubeTex.msh");
|
||||
|
||||
do {
|
||||
scene->updateScene();
|
||||
|
Loading…
Reference in New Issue
Block a user