From 383c7028a8b4747d29038ab3d699ec57cb5f6058 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 24 Nov 2015 18:15:23 -0500 Subject: [PATCH] Applied changes in texture reading io classes to OpenSpace --- ext/ghoul | 2 +- modules/base/rendering/renderablemodel.cpp | 4 +--- modules/base/rendering/renderablemodel.h | 2 +- modules/base/rendering/renderableplane.cpp | 11 ++++------ modules/base/rendering/renderableplane.h | 2 +- modules/base/rendering/renderableplanet.cpp | 10 ++------- modules/base/rendering/renderableplanet.h | 4 ++-- modules/base/rendering/renderablesphere.cpp | 7 ++----- modules/base/rendering/renderablesphere.h | 2 +- modules/base/rendering/renderablestars.cpp | 12 ++++------- modules/base/rendering/renderablestars.h | 4 ++-- modules/newhorizons/newhorizonsmodule.cpp | 2 -- .../rendering/renderablemodelprojection.cpp | 21 ++++--------------- .../rendering/renderablemodelprojection.h | 8 +++---- .../rendering/renderableplaneprojection.cpp | 8 +++---- .../rendering/renderableplaneprojection.h | 9 ++++---- .../rendering/renderableplanetprojection.cpp | 16 ++++---------- .../rendering/renderableplanetprojection.h | 10 ++++----- modules/volume/rendering/renderablevolume.cpp | 2 +- src/rendering/renderengine.cpp | 6 +++--- 20 files changed, 50 insertions(+), 92 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index c040a8b62b..ca2362fb5a 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c040a8b62baed9f3a989656c42cd3294cffb68ef +Subproject commit ca2362fb5a8b7a4a2543c3c1c8ca1ed51a10f19c diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 6cba9c1b4e..34d588437d 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -149,7 +149,6 @@ bool RenderableModel::deinitialize() { delete _geometry; _geometry = nullptr; } - delete _texture; _texture = nullptr; delete _programObject; @@ -253,10 +252,9 @@ void RenderableModel::update(const UpdateData& data) { } void RenderableModel::loadTexture() { - delete _texture; _texture = nullptr; if (_colorTexturePath.value() != "") { - _texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath)); + _texture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath))); if (_texture) { LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); _texture->uploadTexture(); diff --git a/modules/base/rendering/renderablemodel.h b/modules/base/rendering/renderablemodel.h index 968f27a149..cd1025f958 100644 --- a/modules/base/rendering/renderablemodel.h +++ b/modules/base/rendering/renderablemodel.h @@ -60,7 +60,7 @@ private: properties::BoolProperty _performFade; properties::FloatProperty _fading; ghoul::opengl::ProgramObject* _programObject; - ghoul::opengl::Texture* _texture; + std::unique_ptr _texture; modelgeometry::ModelGeometry* _geometry; diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index ef7108646b..ae07fa66f7 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -166,7 +166,6 @@ bool RenderablePlane::deinitialize() { if (!_projectionListener){ // its parents job to kill texture // iff projectionlistener - delete _texture; _texture = nullptr; } @@ -190,8 +189,8 @@ void RenderablePlane::render(const RenderData& data) { //get parent node-texture and set with correct dimensions SceneGraphNode* textureNode = OsEng.renderEngine()->scene()->sceneGraphNode(_nodeName)->parent(); if (textureNode != nullptr){ - RenderablePlanetProjection *t = static_cast(textureNode->renderable()); - _texture = t->baseTexture(); + RenderablePlanetProjection* t = static_cast(textureNode->renderable()); + _texture = std::unique_ptr(t->baseTexture()); float h = _texture->height(); float w = _texture->width(); float scale = h / w; @@ -229,7 +228,7 @@ void RenderablePlane::update(const UpdateData& data) { void RenderablePlane::loadTexture() { if (_texturePath.value() != "") { - ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath)); + std::unique_ptr texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath)); if (texture) { LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'"); texture->uploadTexture(); @@ -237,9 +236,7 @@ void RenderablePlane::loadTexture() { // Textures of planets looks much smoother with AnisotropicMipMap rather than linear texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); - if (_texture) - delete _texture; - _texture = texture; + _texture = std::move(texture); delete _textureFile; _textureFile = new ghoul::filesystem::File(_texturePath); diff --git a/modules/base/rendering/renderableplane.h b/modules/base/rendering/renderableplane.h index e4301cd7f0..136b999a2d 100644 --- a/modules/base/rendering/renderableplane.h +++ b/modules/base/rendering/renderableplane.h @@ -78,7 +78,7 @@ private: ghoul::opengl::ProgramObject* _shader; bool _textureIsDirty; - ghoul::opengl::Texture* _texture; + std::unique_ptr _texture; ghoul::filesystem::File* _textureFile; GLuint _quad; GLuint _vertexPositionBuffer; diff --git a/modules/base/rendering/renderableplanet.cpp b/modules/base/rendering/renderableplanet.cpp index 65d78eb81d..ffd2db0fd5 100644 --- a/modules/base/rendering/renderableplanet.cpp +++ b/modules/base/rendering/renderableplanet.cpp @@ -138,10 +138,6 @@ bool RenderablePlanet::deinitialize() { _geometry->deinitialize(); delete _geometry; } - if (_texture) - delete _texture; - if (_nightTexture) - delete _nightTexture; _geometry = nullptr; _texture = nullptr; @@ -222,10 +218,9 @@ void RenderablePlanet::update(const UpdateData& data){ } void RenderablePlanet::loadTexture() { - delete _texture; _texture = nullptr; if (_colorTexturePath.value() != "") { - _texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath)); + _texture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath))); if (_texture) { LDEBUG("Loaded texture from '" << _colorTexturePath << "'"); _texture->uploadTexture(); @@ -237,10 +232,9 @@ void RenderablePlanet::loadTexture() { } } if (_hasNightTexture) { - delete _nightTexture; _nightTexture = nullptr; if (_nightTexturePath != "") { - _nightTexture = ghoul::io::TextureReader::ref().loadTexture(absPath(_nightTexturePath)); + _nightTexture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_nightTexturePath))); if (_nightTexture) { LDEBUG("Loaded texture from '" << _nightTexturePath << "'"); _nightTexture->uploadTexture(); diff --git a/modules/base/rendering/renderableplanet.h b/modules/base/rendering/renderableplanet.h index 9ce978fe72..69cb48ef52 100644 --- a/modules/base/rendering/renderableplanet.h +++ b/modules/base/rendering/renderableplanet.h @@ -63,8 +63,8 @@ protected: private: properties::StringProperty _colorTexturePath; ghoul::opengl::ProgramObject* _programObject; - ghoul::opengl::Texture* _texture; - ghoul::opengl::Texture* _nightTexture; + std::unique_ptr _texture; + std::unique_ptr _nightTexture; planetgeometry::PlanetGeometry* _geometry; properties::BoolProperty _performShading; properties::IntProperty _rotation; diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 18ee8780e4..cc2804aa0f 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -131,7 +131,6 @@ bool RenderableSphere::deinitialize() { delete _sphere; _sphere = nullptr; - delete _texture; _texture = nullptr; delete _shader; @@ -182,7 +181,7 @@ void RenderableSphere::update(const UpdateData& data) { void RenderableSphere::loadTexture() { if (_texturePath.value() != "") { - ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(_texturePath); + std::unique_ptr texture = ghoul::io::TextureReader::ref().loadTexture(_texturePath); if (texture) { LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'"); texture->uploadTexture(); @@ -192,9 +191,7 @@ void RenderableSphere::loadTexture() { //texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); - if (_texture) - delete _texture; - _texture = texture; + _texture = std::move(texture); } } } diff --git a/modules/base/rendering/renderablesphere.h b/modules/base/rendering/renderablesphere.h index 06f15ae1ab..1cc484d090 100644 --- a/modules/base/rendering/renderablesphere.h +++ b/modules/base/rendering/renderablesphere.h @@ -62,7 +62,7 @@ private: properties::FloatProperty _transparency; ghoul::opengl::ProgramObject* _shader; - ghoul::opengl::Texture* _texture; + std::unique_ptr _texture; PowerScaledSphere* _sphere; diff --git a/modules/base/rendering/renderablestars.cpp b/modules/base/rendering/renderablestars.cpp index d3da22ce01..b4ba656c74 100644 --- a/modules/base/rendering/renderablestars.cpp +++ b/modules/base/rendering/renderablestars.cpp @@ -137,7 +137,6 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) RenderableStars::~RenderableStars() { delete _psfTextureFile; delete _colorTextureFile; - delete _colorTexture; } bool RenderableStars::isReady() const { @@ -165,11 +164,10 @@ bool RenderableStars::deinitialize() { glDeleteVertexArrays(1, &_vao); _vao = 0; - delete _pointSpreadFunctionTexture; _pointSpreadFunctionTexture = nullptr; + _colorTexture = nullptr; - if(_program) - delete _program; + delete _program; _program = nullptr; return true; } @@ -312,10 +310,9 @@ void RenderableStars::update(const UpdateData& data) { if (_pointSpreadFunctionTextureIsDirty) { LDEBUG("Reloading Point Spread Function texture"); - delete _pointSpreadFunctionTexture; _pointSpreadFunctionTexture = nullptr; if (_pointSpreadFunctionTexturePath.value() != "") { - _pointSpreadFunctionTexture = ghoul::io::TextureReader::ref().loadTexture(absPath(_pointSpreadFunctionTexturePath)); + _pointSpreadFunctionTexture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_pointSpreadFunctionTexturePath))); if (_pointSpreadFunctionTexture) { LDEBUG("Loaded texture from '" << absPath(_pointSpreadFunctionTexturePath) << "'"); _pointSpreadFunctionTexture->uploadTexture(); @@ -330,10 +327,9 @@ void RenderableStars::update(const UpdateData& data) { if (_colorTextureIsDirty) { LDEBUG("Reloading Color Texture"); - delete _colorTexture; _colorTexture = nullptr; if (_colorTexturePath.value() != "") { - _colorTexture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath)); + _colorTexture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath))); if (_colorTexture) { LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); _colorTexture->uploadTexture(); diff --git a/modules/base/rendering/renderablestars.h b/modules/base/rendering/renderablestars.h index 542a604850..f69ddab5b3 100644 --- a/modules/base/rendering/renderablestars.h +++ b/modules/base/rendering/renderablestars.h @@ -63,11 +63,11 @@ private: bool saveCachedFile(const std::string& file) const; properties::StringProperty _pointSpreadFunctionTexturePath; - ghoul::opengl::Texture* _pointSpreadFunctionTexture; + std::unique_ptr _pointSpreadFunctionTexture; bool _pointSpreadFunctionTextureIsDirty; properties::StringProperty _colorTexturePath; - ghoul::opengl::Texture* _colorTexture; + std::unique_ptr _colorTexture; bool _colorTextureIsDirty; properties::OptionProperty _colorOption; diff --git a/modules/newhorizons/newhorizonsmodule.cpp b/modules/newhorizons/newhorizonsmodule.cpp index caf960247f..9d5b3967a4 100644 --- a/modules/newhorizons/newhorizonsmodule.cpp +++ b/modules/newhorizons/newhorizonsmodule.cpp @@ -44,7 +44,6 @@ #include - namespace openspace { NewHorizonsModule::NewHorizonsModule() @@ -58,7 +57,6 @@ bool NewHorizonsModule::create() { ImageSequencer2::initialize(); - FactoryManager::ref().addFactory(new ghoul::TemplateFactory); FactoryManager::ref().addFactory(new ghoul::TemplateFactory); diff --git a/modules/newhorizons/rendering/renderablemodelprojection.cpp b/modules/newhorizons/rendering/renderablemodelprojection.cpp index 04d16386d8..3e9dcccee0 100644 --- a/modules/newhorizons/rendering/renderablemodelprojection.cpp +++ b/modules/newhorizons/rendering/renderablemodelprojection.cpp @@ -274,15 +274,6 @@ bool RenderableModelProjection::deinitialize() { delete _geometry; } - if (_texture) - delete _texture; - if (_textureProj) - delete _textureProj; - if (_textureOriginal) - delete _textureOriginal; - if (_textureWhiteSquare) - delete _textureWhiteSquare; - _geometry = nullptr; _texture = nullptr; _textureProj = nullptr; @@ -488,30 +479,27 @@ void RenderableModelProjection::project() { } void RenderableModelProjection::loadTexture() { - delete _texture; _texture = nullptr; if (_colorTexturePath.value() != "") { - _texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath)); + _texture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath))); if (_texture) { LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); _texture->uploadTexture(); _texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); } } - delete _textureOriginal; _textureOriginal = nullptr; if (_colorTexturePath.value() != "") { - _textureOriginal = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath)); + _textureOriginal = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath))); if (_textureOriginal) { LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); _textureOriginal->uploadTexture(); _textureOriginal->setFilter(ghoul::opengl::Texture::FilterMode::Linear); } } - delete _textureWhiteSquare; _textureWhiteSquare = nullptr; if (_defaultProjImage != "") { - _textureWhiteSquare = ghoul::io::TextureReader::ref().loadTexture(absPath(_defaultProjImage)); + _textureWhiteSquare = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_defaultProjImage))); if (_textureWhiteSquare) { _textureWhiteSquare->uploadTexture(); _textureWhiteSquare->setFilter(ghoul::opengl::Texture::FilterMode::Linear); @@ -520,10 +508,9 @@ void RenderableModelProjection::loadTexture() { } void RenderableModelProjection::loadProjectionTexture() { - delete _textureProj; _textureProj = nullptr; if (_projectionTexturePath.value() != "") { - _textureProj = ghoul::io::TextureReader::ref().loadTexture(absPath(_projectionTexturePath)); + _textureProj = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_projectionTexturePath))); if (_textureProj) { _textureProj->uploadTexture(); _textureProj->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); diff --git a/modules/newhorizons/rendering/renderablemodelprojection.h b/modules/newhorizons/rendering/renderablemodelprojection.h index 9f24290222..eefe191cd5 100644 --- a/modules/newhorizons/rendering/renderablemodelprojection.h +++ b/modules/newhorizons/rendering/renderablemodelprojection.h @@ -80,10 +80,10 @@ namespace openspace { ghoul::opengl::ProgramObject* _programObject; ghoul::opengl::ProgramObject* _fboProgramObject; - ghoul::opengl::Texture* _texture; - ghoul::opengl::Texture* _textureOriginal; - ghoul::opengl::Texture* _textureProj; - ghoul::opengl::Texture* _textureWhiteSquare; + std::unique_ptr _texture; + std::unique_ptr _textureOriginal; + std::unique_ptr _textureProj; + std::unique_ptr _textureWhiteSquare; modelgeometry::ModelGeometry* _geometry; diff --git a/modules/newhorizons/rendering/renderableplaneprojection.cpp b/modules/newhorizons/rendering/renderableplaneprojection.cpp index c5cbd1f66f..5be5dbf4f4 100644 --- a/modules/newhorizons/rendering/renderableplaneprojection.cpp +++ b/modules/newhorizons/rendering/renderableplaneprojection.cpp @@ -119,7 +119,7 @@ bool RenderablePlaneProjection::deinitialize() { _quad = 0; glDeleteBuffers(1, &_vertexPositionBuffer); _vertexPositionBuffer = 0; - delete _texture; + _texture = nullptr; return true; } @@ -190,15 +190,13 @@ void RenderablePlaneProjection::update(const UpdateData& data) { void RenderablePlaneProjection::loadTexture() { if (_texturePath != "") { - ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath)); + std::unique_ptr texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath)); if (texture) { texture->uploadTexture(); // TODO: AnisotropicMipMap crashes on ATI cards ---abock //texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); - if (_texture) - delete _texture; - _texture = texture; + _texture = std::move(texture); delete _textureFile; _textureFile = new ghoul::filesystem::File(_texturePath); diff --git a/modules/newhorizons/rendering/renderableplaneprojection.h b/modules/newhorizons/rendering/renderableplaneprojection.h index 5fc819ea1b..3373aae724 100644 --- a/modules/newhorizons/rendering/renderableplaneprojection.h +++ b/modules/newhorizons/rendering/renderableplaneprojection.h @@ -32,6 +32,8 @@ #include #include +#include + namespace ghoul { namespace filesystem { class File; @@ -52,12 +54,10 @@ struct target { }; class RenderablePlaneProjection : public Renderable { - - public: RenderablePlaneProjection(const ghoul::Dictionary& dictionary); ~RenderablePlaneProjection(); - + bool initialize() override; bool deinitialize() override; @@ -81,7 +81,8 @@ private: ghoul::opengl::ProgramObject* _shader; bool _textureIsDirty; - ghoul::opengl::Texture* _texture; + std::unique_ptr _texture = nullptr; +// ghoul::opengl::Texture* _texture; ghoul::filesystem::File* _textureFile; GLuint _quad; GLuint _vertexPositionBuffer; diff --git a/modules/newhorizons/rendering/renderableplanetprojection.cpp b/modules/newhorizons/rendering/renderableplanetprojection.cpp index c3d8a5a24c..87fcb36f07 100644 --- a/modules/newhorizons/rendering/renderableplanetprojection.cpp +++ b/modules/newhorizons/rendering/renderableplanetprojection.cpp @@ -305,13 +305,9 @@ bool RenderablePlanetProjection::auxiliaryRendertarget(){ } bool RenderablePlanetProjection::deinitialize(){ - delete _texture; _texture = nullptr; - delete _textureProj; _textureProj = nullptr; - delete _textureOriginal; _textureOriginal = nullptr; - delete _textureWhiteSquare; _textureWhiteSquare = nullptr; delete _geometry; _geometry = nullptr; @@ -561,10 +557,9 @@ void RenderablePlanetProjection::update(const UpdateData& data){ } void RenderablePlanetProjection::loadProjectionTexture() { - delete _textureProj; _textureProj = nullptr; if (_colorTexturePath.value() != "") { - _textureProj = ghoul::io::TextureReader::ref().loadTexture(absPath(_projectionTexturePath)); + _textureProj = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_projectionTexturePath))); if (_textureProj) { _textureProj->uploadTexture(); // TODO: AnisotropicMipMap crashes on ATI cards ---abock @@ -576,28 +571,25 @@ void RenderablePlanetProjection::loadProjectionTexture() { } void RenderablePlanetProjection::loadTexture() { - delete _texture; _texture = nullptr; if (_colorTexturePath.value() != "") { - _texture = ghoul::io::TextureReader::ref().loadTexture(_colorTexturePath); + _texture = std::move(ghoul::io::TextureReader::ref().loadTexture(_colorTexturePath)); if (_texture) { _texture->uploadTexture(); _texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); } } - delete _textureOriginal; _textureOriginal = nullptr; if (_colorTexturePath.value() != "") { - _textureOriginal = ghoul::io::TextureReader::ref().loadTexture(_colorTexturePath); + _textureOriginal = std::move(ghoul::io::TextureReader::ref().loadTexture(_colorTexturePath)); if (_textureOriginal) { _textureOriginal->uploadTexture(); _textureOriginal->setFilter(ghoul::opengl::Texture::FilterMode::Linear); } } - delete _textureWhiteSquare; _textureWhiteSquare = nullptr; if (_colorTexturePath.value() != "") { - _textureWhiteSquare = ghoul::io::TextureReader::ref().loadTexture(_defaultProjImage); + _textureWhiteSquare = std::move(ghoul::io::TextureReader::ref().loadTexture(_defaultProjImage)); if (_textureWhiteSquare) { _textureWhiteSquare->uploadTexture(); _textureWhiteSquare->setFilter(ghoul::opengl::Texture::FilterMode::Linear); diff --git a/modules/newhorizons/rendering/renderableplanetprojection.h b/modules/newhorizons/rendering/renderableplanetprojection.h index be5d2d0523..b2230845c7 100644 --- a/modules/newhorizons/rendering/renderableplanetprojection.h +++ b/modules/newhorizons/rendering/renderableplanetprojection.h @@ -70,7 +70,7 @@ public: void render(const RenderData& data) override; void update(const UpdateData& data) override; - ghoul::opengl::Texture* baseTexture() { return _texture; }; + ghoul::opengl::Texture* baseTexture() { return _texture.get(); }; protected: @@ -98,10 +98,10 @@ private: ghoul::opengl::ProgramObject* _programObject; ghoul::opengl::ProgramObject* _fboProgramObject; - ghoul::opengl::Texture* _texture; - ghoul::opengl::Texture* _textureOriginal; - ghoul::opengl::Texture* _textureProj; - ghoul::opengl::Texture* _textureWhiteSquare; + std::unique_ptr _texture; + std::unique_ptr _textureOriginal; + std::unique_ptr _textureProj; + std::unique_ptr _textureWhiteSquare; planetgeometryprojection::PlanetGeometryProjection* _geometry; glm::vec2 _camScaling; diff --git a/modules/volume/rendering/renderablevolume.cpp b/modules/volume/rendering/renderablevolume.cpp index 3794ed0e5c..a042df4a26 100644 --- a/modules/volume/rendering/renderablevolume.cpp +++ b/modules/volume/rendering/renderablevolume.cpp @@ -296,7 +296,7 @@ ghoul::opengl::Texture* RenderableVolume::loadTransferFunction(const std::string // check if not a txt based texture if ( ! hasExtension(filepath, "txt")) { - ghoul::opengl::Texture* t = ghoul::io::TextureReader::ref().loadTexture(f); + ghoul::opengl::Texture* t = ghoul::io::TextureReader::ref().loadTexture(f).get(); t->setWrapping(wrappingmode); return t; } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 06ca518def..7e8cc38ec2 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -182,13 +182,13 @@ bool RenderEngine::initialize() { OsEng.interactionHandler()->setCamera(_mainCamera); #ifdef GHOUL_USE_DEVIL - ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderDevIL); + ghoul::io::TextureReader::ref().addReader(std::make_shared()); #endif // GHOUL_USE_DEVIL #ifdef GHOUL_USE_FREEIMAGE - ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderFreeImage); + ghoul::io::TextureReader::ref().addReader(std::make_shared()); #endif // GHOUL_USE_FREEIMAGE - ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderCMAP); + ghoul::io::TextureReader::ref().addReader(std::make_shared()); return true;