Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Commit 2f83d37e authored by Anakin's avatar Anakin
Browse files

fixed the problem,

next solve texture name is taken only from the first element,
move some code around
parent b4b2538e
......@@ -119,6 +119,12 @@ void OpenGLController::processInit()
// generate texture
glGenTextures(1, &gluiTextureID);
glBindTexture(GL_TEXTURE_2D, gluiTextureID);
// set some texture parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
}
void OpenGLController::startGLFW()
......@@ -266,6 +272,21 @@ void OpenGLController::updateScene()
for (int modelIndex = 0; modelIndex < vModels.size(); modelIndex++)
{
// give texture to the shader
glTexImage2D(GL_TEXTURE_2D,
0,
vTextures[modelIndex]->alpha ? GL_RGBA : GL_RGB,
vTextures[modelIndex]->width,
vTextures[modelIndex]->height,
0,
vTextures[modelIndex]->alpha ? GL_BGRA : GL_BGR,
GL_UNSIGNED_BYTE,
vTextures[modelIndex]->data->data()
);
glGenerateMipmap(GL_TEXTURE_2D);
// give the MVP to the shader
glUniformMatrix4fv(gluiMatrixID, 1, GL_FALSE, &getMVPMatrix(modelIndex)[0][0]);
glDrawArrays(GL_TRIANGLES, instanceOffset, vModels[modelIndex]->meshSize);
......@@ -361,23 +382,4 @@ void OpenGLController::loadMsh(const char * path)
vTextures.push_back(tempData);
}
glTexImage2D(GL_TEXTURE_2D,
0,
vTextures.front()->alpha ? GL_RGBA : GL_RGB,
vTextures.front()->width,
vTextures.front()->height,
0,
vTextures.front()->alpha ? GL_BGRA : GL_BGR,
GL_UNSIGNED_BYTE,
vTextures.front()->data->data()
);
// set some texture parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glGenerateMipmap(GL_TEXTURE_2D);
}
......@@ -20,8 +20,8 @@ int main(int argc, char** argv)
else
scene = OpenGLController::getInstance();
//scene->loadMsh("..\\Release\\Msh\\multiModTex.msh");
scene->loadMsh("..\\Release\\Msh\\cubeTex.msh");
scene->loadMsh("..\\Release\\Msh\\multiModTex.msh");
//scene->loadMsh("..\\Release\\Msh\\cubeTex.msh");
do {
scene->updateScene();
......
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