mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-01 09:08:49 -06:00
Fixed some cl stuff in ghoul used in renderablevolumeexpert
This commit is contained in:
Submodule ext/ghoul updated: f5c64aca95...7a0f5ee29a
@@ -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
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user