From e0000fccbfb25464bc7cb1fbf91c84b020ad9352 Mon Sep 17 00:00:00 2001 From: Sovanny Huy Date: Tue, 28 May 2019 15:33:09 -0400 Subject: [PATCH] change to vector --- modules/base/rendering/suntexturemanager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/base/rendering/suntexturemanager.cpp b/modules/base/rendering/suntexturemanager.cpp index 817651e47b..f4dc6bdb69 100644 --- a/modules/base/rendering/suntexturemanager.cpp +++ b/modules/base/rendering/suntexturemanager.cpp @@ -186,16 +186,14 @@ SunTextureManager::SunTextureManager(){ } const float stdvalue = *fitsFileReader.readHeaderValueFloat("IMGRMS01"); - GLfloat fitsImage[360 * 180]; - for (int i = 0; i < 360; i++) { - for (int j = 0; j < 180; j++) { - float color = tempBild->contents[(i * 180) + j]; - color = (color+stdvalue)/stdvalue; //some semirandom operation to actually se something in the texture - fitsImage[(i * 180) + j] = static_cast(color); - } + std::vector fitsImage; + for(float c : tempBild->contents){ + fitsImage.push_back((c+stdvalue)/stdvalue); } + + LERROR(std::to_string(fitsImage.at(100))); - auto textureFits = std::make_unique(fitsImage, glm::vec3(360, 180, 1),ghoul::opengl::Texture::Format::Red, GL_R32F,GL_FLOAT); + auto textureFits = std::make_unique(fitsImage.data(), glm::vec3(360, 180, 1),ghoul::opengl::Texture::Format::Red, GL_R32F,GL_FLOAT); textureFits->uploadTexture(); if(_textureListGPU.find(dateID) != _textureListGPU.end()){ @@ -204,6 +202,8 @@ SunTextureManager::SunTextureManager(){ _textureListGPU[dateID] = std::move(textureFits); } + + void SunTextureManager::uploadTexturesFromList(std::vector& filelist){