Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Add DataSourcePlugin::finishGL() #367

Merged
merged 1 commit into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Changelog {#Changelog}

# git master

* [#367](https://github.com/BlueBrain/Livre/pull/367):
Add DataSourcePlugin::finishGL() to release OpenGL resources that are held
by the plugin, e.g. Cubist
* [#363](https://github.com/BlueBrain/Livre/pull/363):
Add detailed information on the volume URIs to help, wrap help to
current terminal size, remove config file support
Expand Down
5 changes: 5 additions & 0 deletions livre/core/data/DataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ bool DataSource::initializeGL()
return _impl->plugin->initializeGL();
}

void DataSource::finishGL()
{
_impl->plugin->finishGL();
}

MemoryUnitPtr DataSource::getData( const NodeId& nodeId )
{
if( !nodeId.isValid( ))
Expand Down
3 changes: 3 additions & 0 deletions livre/core/data/DataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class DataSource
/** Initializes the GL specific functions. */
LIVRECORE_API bool initializeGL();

/** @copydoc DataSourcePlugin::finishGL() */
LIVRECORE_API void finishGL();

/**
* Read the data for a given node.
* @param nodeId NodeId to be read.
Expand Down
9 changes: 5 additions & 4 deletions livre/core/data/DataSourcePlugin.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2016, EPFL/Blue Brain Project
/* Copyright (c) 2011-2017, EPFL/Blue Brain Project
* Ahmet Bilgili <ahmet.bilgili@epfl.ch>
*
* This file is part of Livre <https://github.com/BlueBrain/Livre>
Expand Down Expand Up @@ -73,11 +73,12 @@ class DataSourcePlugin
*/
const VolumeInformation& getVolumeInfo() const;

/**
* Initializes the GL specific functions.
*/
/** Initializes the GL specific functions. */
virtual bool initializeGL() { return true; }

/** Last call with a valid and active GL context to clear GL objects. */
virtual void finishGL() {}

/**
* Read the data for a given node.
* @param node LODNode to be read.
Expand Down
10 changes: 9 additions & 1 deletion livre/eq/Window.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2007-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Maxim Makhinya <maxmah@gmail.com>
* Ahmet Bilgili <ahmet.bilgili@epfl.ch>
* Daniel Nachbaur <daniel.nachbaur@epfl.ch>
Expand Down Expand Up @@ -36,6 +36,7 @@
#include <livre/lib/cache/TextureObject.h>

#include <livre/core/cache/Cache.h>
#include <livre/core/data/DataSource.h>
#include <livre/core/render/TexturePool.h>

#include <eq/gl.h>
Expand Down Expand Up @@ -75,6 +76,13 @@ struct Window::Impl
_renderPipeline.reset();
_textureCache.reset();
_texturePool.reset();

if( _glContext.use_count() == 1 )
{
Node* node = static_cast< Node* >( _window->getNode( ));
node->getDataSource().finishGL();
}

_glContext->doneCurrent();
_glContext.reset();
return true;
Expand Down