mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
Update ghoul reference
- Added destructor to OpenSpaceEngine to deallocate SyncBuffer - Changed texture reading to avoid memory leak
This commit is contained in:
+1
-1
Submodule ext/ghoul updated: 5c087a74a6...9a72f28714
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
private:
|
||||
OpenSpaceEngine(std::string programName);
|
||||
~OpenSpaceEngine() = default;
|
||||
~OpenSpaceEngine();
|
||||
|
||||
void clearAllWindows();
|
||||
bool gatherCommandlineArguments();
|
||||
|
||||
@@ -90,6 +90,12 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName)
|
||||
ghoul::systemcapabilities::SystemCapabilities::initialize();
|
||||
}
|
||||
|
||||
OpenSpaceEngine::~OpenSpaceEngine() {
|
||||
if(_syncBuffer)
|
||||
delete _syncBuffer;
|
||||
_syncBuffer = nullptr;
|
||||
}
|
||||
|
||||
OpenSpaceEngine& OpenSpaceEngine::ref() {
|
||||
assert(_engine);
|
||||
return *_engine;
|
||||
@@ -201,6 +207,7 @@ bool OpenSpaceEngine::create(int argc, char** argv,
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::destroy() {
|
||||
|
||||
delete _engine;
|
||||
ghoul::systemcapabilities::SystemCapabilities::deinitialize();
|
||||
FactoryManager::deinitialize();
|
||||
|
||||
@@ -173,7 +173,7 @@ void RenderableModel::loadTexture()
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
@@ -170,7 +170,7 @@ void RenderablePlanet::loadTexture()
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
@@ -308,7 +308,7 @@ void RenderableEphemeris::loadTexture()
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
@@ -238,7 +238,7 @@ void RenderableFov::loadTexture()
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
@@ -233,7 +233,7 @@ void RenderablePath::loadTexture()
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
@@ -184,7 +184,7 @@ void RenderablePlane::loadTexture()
|
||||
LDEBUG("loadTexture");
|
||||
if (_texturePath.value() != "") {
|
||||
LDEBUG("loadTexture2");
|
||||
ghoul::opengl::Texture* texture = ghoul::io::TextureReader::loadTexture(absPath(_texturePath));
|
||||
ghoul::opengl::Texture* texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'");
|
||||
texture->uploadTexture();
|
||||
|
||||
@@ -310,7 +310,7 @@ void RenderableTrail::loadTexture()
|
||||
delete _texture;
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
@@ -294,7 +294,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::loadTexture(f);
|
||||
ghoul::opengl::Texture* t = ghoul::io::TextureReader::ref().loadTexture(f);
|
||||
t->setWrapping(wrappingmode);
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -162,13 +162,13 @@ bool RenderEngine::initialize()
|
||||
OsEng.interactionHandler().setCamera(_mainCamera);
|
||||
|
||||
#ifdef GHOUL_USE_DEVIL
|
||||
ghoul::io::TextureReader::addReader(new ghoul::io::impl::TextureReaderDevIL);
|
||||
ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderDevIL);
|
||||
#endif // GHOUL_USE_DEVIL
|
||||
#ifdef GHOUL_USE_FREEIMAGE
|
||||
ghoul::io::TextureReader::addReader(new ghoul::io::impl::TextureReaderFreeImage);
|
||||
ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderFreeImage);
|
||||
#endif // GHOUL_USE_FREEIMAGE
|
||||
|
||||
ghoul::io::TextureReader::addReader(new ghoul::io::impl::TextureReaderCMAP);
|
||||
ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderCMAP);
|
||||
|
||||
#if ABUFFER_IMPLEMENTATION == ABUFFER_FRAMEBUFFER
|
||||
_abuffer = new ABufferFramebuffer();
|
||||
|
||||
@@ -292,7 +292,7 @@ void RenderableStars::update(const UpdateData& data) {
|
||||
delete _pointSpreadFunctionTexture;
|
||||
_pointSpreadFunctionTexture = nullptr;
|
||||
if (_pointSpreadFunctionTexturePath.value() != "") {
|
||||
_pointSpreadFunctionTexture = ghoul::io::TextureReader::loadTexture(absPath(_pointSpreadFunctionTexturePath));
|
||||
_pointSpreadFunctionTexture = ghoul::io::TextureReader::ref().loadTexture(absPath(_pointSpreadFunctionTexturePath));
|
||||
if (_pointSpreadFunctionTexture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_pointSpreadFunctionTexturePath) << "'");
|
||||
_pointSpreadFunctionTexture->uploadTexture();
|
||||
@@ -306,7 +306,7 @@ void RenderableStars::update(const UpdateData& data) {
|
||||
delete _colorTexture;
|
||||
_colorTexture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_colorTexture = ghoul::io::TextureReader::loadTexture(absPath(_colorTexturePath));
|
||||
_colorTexture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath));
|
||||
if (_colorTexture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
|
||||
_colorTexture->uploadTexture();
|
||||
|
||||
Reference in New Issue
Block a user