diff --git a/ext/ghoul b/ext/ghoul index f5c64aca95..7a0f5ee29a 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit f5c64aca9511a9cbc99b3e6c8dae610a8f280102 +Subproject commit 7a0f5ee29ad62240bd891eb32f55cdbb27df90ed diff --git a/src/rendering/renderablevolumeexpert.cpp b/src/rendering/renderablevolumeexpert.cpp index fa7d1048f6..7b0d3644ec 100644 --- a/src/rendering/renderablevolumeexpert.cpp +++ b/src/rendering/renderablevolumeexpert.cpp @@ -206,7 +206,7 @@ bool RenderableVolumeExpert::initialize() { for (int i = 0; i < _volumePaths.size(); ++i) { ghoul::RawVolumeReader rawReader(_volumeHints.at(i)); ghoul::opengl::Texture* volume = rawReader.read(_volumePaths.at(i)); - volume->uploadTexture(); +// volume->uploadTexture(); cl_mem volumeTexture = _context.createTextureFromGLTexture(CL_MEM_READ_ONLY, *volume); _volumes.push_back(volume); @@ -293,7 +293,6 @@ bool RenderableVolumeExpert::deinitialize() { } void RenderableVolumeExpert::render(const Camera *camera, const psc &thisPosition) { - if( ! _kernel.isValidKernel()) return; @@ -304,16 +303,30 @@ void RenderableVolumeExpert::render(const Camera *camera, const psc &thisPositio double factor = pow(10.0,thisPosition[3]); transform = glm::translate(transform, glm::vec3(thisPosition[0]*factor, thisPosition[1]*factor, thisPosition[2]*factor)); transform = glm::rotate(transform, time*speed, glm::vec3(0.0f, 1.0f, 0.0f)); - + _colorBoxRenderer->render(transform); _textureLock->lock(); _kernelLock->lock(); glFinish(); + // Aquire GL objects + _commands.enqueueAcquireGLObjects(_clBackTexture); + _commands.enqueueAcquireGLObjects(_clFrontTexture); + _commands.enqueueAcquireGLObjects(_clOutput); + _commands.enqueueAcquireGLObjects(_clVolumes); + _commands.enqueueAcquireGLObjects(_clTransferFunctions); + _commands.enqueueKernelBlocking(_kernel, *_ws); _commands.finish(); - + + // Release GL objects + _commands.enqueueReleaseGLObjects(_clBackTexture); + _commands.enqueueReleaseGLObjects(_clFrontTexture); + _commands.enqueueReleaseGLObjects(_clOutput); + _commands.enqueueReleaseGLObjects(_clVolumes); + _commands.enqueueReleaseGLObjects(_clTransferFunctions); + _quadProgram->activate(); glActiveTexture(GL_TEXTURE0); _output->bind(); @@ -322,6 +335,7 @@ void RenderableVolumeExpert::render(const Camera *camera, const psc &thisPositio glBindVertexArray(_screenQuad); glDrawArrays(GL_TRIANGLES, 0, 6); glBindVertexArray(0); + _kernelLock->unlock(); _textureLock->unlock(); @@ -449,4 +463,4 @@ void RenderableVolumeExpert::safeUpdateTexture(const ghoul::filesystem::File& fi } } -} // namespace openspace \ No newline at end of file +} // namespace openspace