* Renamed OpenGLJobProcessor::iKnowWhatImDoingGetArbitraryContext() to...

* Renamed OpenGLJobProcessor::iKnowWhatImDoingGetArbitraryContext() to OpenGLJobProcessor::getContext()
* Adjusted headers and method calls in various files
parent 3d8aea3d
......@@ -124,6 +124,12 @@ namespace campvis {
/// \see Runnable::stop
virtual void stop();
/**
* Executes this pipeline.
* To be implemented in the subclass.
*/
virtual void executePipeline() = 0;
/**
* Returns the DataContainer of this pipeline, const version.
* \return _data
......@@ -187,12 +193,6 @@ namespace campvis {
*/
void setPipelineDirty();
/**
* Executes this pipeline.
* To be implemented in the subclass.
*/
virtual void executePipeline() = 0;
/**
* Executes the processor \a processor on the pipeline's data and locks its properties meanwhile.
* \param processor Processor to execute.
......
......@@ -63,10 +63,11 @@ namespace campvis {
/// \see AbstractPipeline::addProcessor()
virtual void addProcessor(AbstractProcessor* processor);
protected:
/// \see AbstractPipeline::executePipeline()
virtual void executePipeline();
protected:
/**
* Slot getting called when one of the observed processors got invalidated.
* The default behaviour is to dispatch a job to execute the invalidated processor and emit the s_invalidated signal.
......
......@@ -38,7 +38,7 @@ namespace tgt {
{
if (! GLCtxtMgr.checkWhetherThisThreadHasAcquiredOpenGlContext()) {
GLJobProc.pause();
_lock = new tgt::GLContextScopedLock(GLJobProc.iKnowWhatImDoingGetArbitraryContext());
_lock = new tgt::GLContextScopedLock(GLJobProc.getContext());
}
}
......@@ -135,8 +135,7 @@ namespace tgt {
_context = context;
}
tgt::GLCanvas* OpenGLJobProcessor::iKnowWhatImDoingGetArbitraryContext() {
tgt::GLCanvas* OpenGLJobProcessor::getContext() {
return _context;
}
......
......@@ -86,6 +86,12 @@ namespace tgt {
*/
void setContext(tgt::GLCanvas* context);
/**
* Returns the OpenGL context of this object..
* \return _context
*/
tgt::GLCanvas* getContext();
/// \see Runnable::stop
void stop();
......@@ -114,13 +120,6 @@ namespace tgt {
void enqueueJob(AbstractJob* job);
/**
* Returns an arbitrary registered OpenGL context.
* \note You can do really messy things with this. Do not use this method unless
* you know what you're doing and know that there is no other way...
*/
tgt::GLCanvas* iKnowWhatImDoingGetArbitraryContext();
protected:
// Protected constructor since it's a singleton
OpenGLJobProcessor();
......
......@@ -28,9 +28,6 @@
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/tfgeometry1d.h"
#include "core/tools/simplejobprocessor.h"
#include "core/tools/job.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
namespace campvis {
......
......@@ -124,7 +124,7 @@ namespace campvis {
p_autoExecution.setValue(false);
tgt::GLContextScopedLock lock(_canvas, true);
tgt::GLContextScopedLock lock(_canvas);
for (int i = p_range.getValue().x; i < p_range.getValue().y; ++i) {
executePass(i);
}
......
......@@ -26,8 +26,7 @@
#include "tgt/assert.h"
#include "tgt/logmanager.h"
#include "core/tools/opengljobprocessor.h"
#include "tgt/opengljobprocessor.h"
namespace campvis {
......@@ -36,7 +35,7 @@ namespace campvis {
return nullptr;
if (const AbstractImageRepresentationItk* tester = dynamic_cast<const AbstractImageRepresentationItk*>(source)) {
OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
tgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
ImageRepresentationGL* toReturn = ImageRepresentationGL::create(const_cast<ImageData*>(tester->getParent()), tester->getWeaklyTypedPointer());
return toReturn;
}
......
......@@ -34,12 +34,12 @@
#include "tgt/gpucapabilities.h"
#include "tgt/shadermanager.h"
#include "tgt/glcontextmanager.h"
#include "tgt/opengljobprocessor.h"
#include "tgt/qt/qtthreadedcanvas.h"
#include "tgt/logmanager.h"
#include "tgt/qt/qtapplication.h"
#include "core/tools/simplejobprocessor.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/quadrenderer.h"
#ifdef Q_WS_X11
......@@ -64,8 +64,7 @@ void init() {
tgt::GlContextManager::init();
campvis::OpenGLJobProcessor::init();
campvis::OpenGLJobProcessor::getRef().iKnowWhatImDoingSetThisThreadOpenGlThread();
tgt::OpenGLJobProcessor::init();
campvis::SimpleJobProcessor::init();
tgtAssert(_initialized == false, "Tried to initialize CampVisApplication twice.");
......@@ -76,12 +75,14 @@ void init() {
LogMgr.getConsoleLog()->addCat("", true, tgt::Info);
// create a local OpenGL context and init GL
_localContext = new tgt::QtThreadedCanvas("", tgt::ivec2(16, 16));
tgt::QtThreadedCanvas* backgroundCanvas = new tgt::QtThreadedCanvas("", tgt::ivec2(16, 16));
GLCtxtMgr.registerContextAndInitGlew(backgroundCanvas, "Background Context");
GLCtxtMgr.releaseContext(backgroundCanvas, false);
GLJobProc.setContext(backgroundCanvas);
GLJobProc.start();
tgt::GLContextScopedLock lock(_localContext);
tgt::GlContextManager::getRef().registerContextAndInitGlew(_localContext);
GLJobProc.iKnowWhatImDoingSetThisThreadOpenGlThread();
GLJobProc.registerContext(_localContext);
_localContext = new tgt::QtThreadedCanvas("", tgt::ivec2(16, 16));
tgt::GlContextManager::getRef().registerContextAndInitGlew(_localContext, "Local Context");
tgt::initGL(featureset);
ShdrMgr.setDefaultGlslVersion("330");
......@@ -105,7 +106,9 @@ void init() {
if (GpuCaps.getShaderVersion() < tgt::GpuCapabilities::GlVersion::SHADER_VERSION_330) {
LERROR("Your system does not support GLSL Shader Version 3.30, which is mandatory. CAMPVis will probably not work as intended.");
}
GLCtxtMgr.releaseContext(_localContext, false);
_initialized = true;
}
......@@ -118,12 +121,13 @@ void deinit() {
campvis::QuadRenderer::deinit();
campvis::SimpleJobProcessor::deinit();
GLJobProc.stop();
tgt::OpenGLJobProcessor::deinit();
tgt::deinitGL();
}
campvis::SimpleJobProcessor::deinit();
campvis::OpenGLJobProcessor::deinit();
tgt::GlContextManager::deinit();
tgt::deinit();
......
......@@ -27,11 +27,11 @@
#ifdef CAMPVIS_HAS_MODULE_DEVIL
#include "tgt/filesystem.h"
#include "tgt/opengljobprocessor.h"
#include "core/datastructures/datacontainer.h"
#include "core/datastructures/renderdata.h"
#include "core/pipeline/abstractpipeline.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/stringutils.h"
#include "modules/pipelinefactory.h"
......@@ -85,7 +85,7 @@ protected:
if (_pipeline != nullptr) {
// setup pipeline
_pipeline->setCanvas(GLJobProc.iKnowWhatImDoingGetArbitraryContext());
_pipeline->setCanvas(GLJobProc.getContext());
_pipeline->init();
_pipeline->setEnabled(true);
_pipeline->setRenderTargetSize(tgt::ivec2(1024, 1024));
......@@ -100,12 +100,7 @@ protected:
processors[i]->invalidate(AbstractProcessor::INVALID_RESULT);
}
// execute each processor (we do this n*n times, as we might have a complex dependency graph)
for (size_t i = 0; i < processors.size(); ++i) {
for (size_t i = 0; i < processors.size(); ++i) {
processors[i]->process(_dataContainer);
}
}
_pipeline->executePipeline();
// write result image
_imageWriter.p_inputImage.setValue(_pipeline->getRenderTargetID());
......
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