Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit e41c14c1 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

further work on OpenGL refactoring

parent 42480c65
......@@ -63,6 +63,9 @@ namespace campvis {
{
tgtAssert(_fbo != 0, "FBO must not be 0.");
_fbo->activate();
const tgt::ivec2& windowSize = vp->_renderTargetSize.getValue();
glViewport(0, 0, static_cast<GLsizei>(windowSize.x), static_cast<GLsizei>(windowSize.y));
}
~FramebufferActivationGuard() {
......
......@@ -103,8 +103,7 @@ namespace campvis {
maxDepth = std::max(maxDepth, curDepth);
}
std::pair<ImageData*, ImageRepresentationRenderTarget*> tempTarget = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue());
std::pair<ImageData*, ImageRepresentationRenderTarget*> outputTarget = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue());
FramebufferActivationGuard fag(this);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);
......@@ -124,21 +123,22 @@ namespace campvis {
_shader->setUniform("_warmColor", p_warmColor.getValue());
}
tempTarget.second->activate();
LGL_ERROR;
createAndAttachDepthTexture();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QuadRdr.renderQuad();
tempTarget.second->deactivate();
std::pair<ImageData*, ImageRepresentationRenderTarget*> tempTarget = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo);
_fbo->detachAll();
createAndAttachColorTexture();
createAndAttachDepthTexture();
inputImage->bind(_shader, colorUnit, depthUnit);
tempTarget.second->bindDepthTexture(_shader, pass2DepthUnit, "_depthPass2Texture", "_pass2TexParams");
_shader->setUniform("_direction", tgt::vec2(0.f, 1.f));
outputTarget.second->activate();
LGL_ERROR;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QuadRdr.renderQuad();
outputTarget.second->deactivate();
std::pair<ImageData*, ImageRepresentationRenderTarget*> outputTarget = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo);
_shader->deactivate();
tgt::TextureUnit::setZeroUnit();
......@@ -146,7 +146,7 @@ namespace campvis {
glDisable(GL_DEPTH_TEST);
LGL_ERROR;
data.addData(p_outputImage.getValue() + "temp", tempTarget.first);
delete tempTarget.first;
data.addData(p_outputImage.getValue(), outputTarget.first);
p_outputImage.issueWrite();
}
......
......@@ -137,6 +137,7 @@ namespace campvis {
}
}
FramebufferActivationGuard fag(this);
decorateRenderProlog(data, _shader);
const tgt::Camera& cam = p_camera.getValue();
......@@ -175,8 +176,8 @@ namespace campvis {
glEnable(GL_DEPTH_TEST);
// create entry points texture
std::pair<ImageData*, ImageRepresentationRenderTarget*> entrypoints = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), GL_RGBA16);
entrypoints.second->activate();
createAndAttachTexture(GL_RGBA16);
createAndAttachDepthTexture();
_shader->setUniform("_isEntrypoint", true);
glDepthFunc(GL_LESS);
......@@ -185,11 +186,12 @@ namespace campvis {
glCullFace(p_enableMirror.getValue() ? GL_FRONT : GL_BACK);
clipped.render(GL_POLYGON);
entrypoints.second->deactivate();
std::pair<ImageData*, ImageRepresentationRenderTarget*> entrypoints = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo);
_fbo->detachAll();
// create exit points texture
std::pair<ImageData*, ImageRepresentationRenderTarget*> exitpoints = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), GL_RGBA16);
exitpoints.second->activate();
createAndAttachTexture(GL_RGBA16);
createAndAttachDepthTexture();
_shader->setUniform("_isEntrypoint", false);
if (geometryImage != 0) {
......@@ -202,8 +204,7 @@ namespace campvis {
glCullFace(p_enableMirror.getValue() ? GL_BACK : GL_FRONT);
clipped.render(GL_POLYGON);
exitpoints.second->deactivate();
std::pair<ImageData*, ImageRepresentationRenderTarget*> exitpoints = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo);
decorateRenderEpilog(_shader);
_shader->deactivate();
......
......@@ -100,8 +100,9 @@ namespace campvis {
_shader->setIgnoreUniformLocationError(false);
// create entry points texture
std::pair<ImageData*, ImageRepresentationRenderTarget*> rt = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), GL_RGBA16);
rt.second->activate();
FramebufferActivationGuard fag(this);
createAndAttachColorTexture();
createAndAttachDepthTexture();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
......@@ -109,13 +110,12 @@ namespace campvis {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
proxyGeometry->render();
rt.second->deactivate();
decorateRenderEpilog(_shader);
_shader->deactivate();
glDisable(GL_DEPTH_TEST);
LGL_ERROR;
data.addData(p_renderTargetID.getValue(), rt.first);
data.addData(p_renderTargetID.getValue(), ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo).first);
p_renderTargetID.issueWrite();
}
else {
......
......@@ -84,24 +84,23 @@ namespace campvis {
ImageRepresentationRenderTarget::ScopedRepresentation mirrorRendered(data, p_mirrorRenderID.getValue());
if (normalImage != 0 && mirrorImage != 0 && mirrorRendered != 0) {
std::pair<ImageData*, ImageRepresentationRenderTarget*> rt = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue());
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);
FramebufferActivationGuard fag(this);
createAndAttachColorTexture();
createAndAttachDepthTexture();
_shader->activate();
tgt::TextureUnit normalColorUnit, normalDepthUnit, mirrorColorUnit, mirrorDepthUnit, mirrorRenderedDepthUnit;
decorateRenderProlog(data, _shader);
tgt::TextureUnit normalColorUnit, normalDepthUnit, mirrorColorUnit, mirrorDepthUnit, mirrorRenderedDepthUnit;
normalImage->bind(_shader, normalColorUnit, normalDepthUnit, "_normalColor", "_normalDepth", "_normalTexParams");
mirrorImage->bind(_shader, mirrorColorUnit, mirrorDepthUnit, "_mirrorColor", "_mirrorDepth", "_mirrorTexParams");
mirrorRendered->bindDepthTexture(_shader, mirrorRenderedDepthUnit, "_mirrorRenderedDepth", "_mirrorRenderedTexParams");
decorateRenderProlog(data, _shader);
rt.second->activate();
LGL_ERROR;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QuadRdr.renderQuad();
rt.second->deactivate();
_shader->deactivate();
tgt::TextureUnit::setZeroUnit();
......@@ -109,7 +108,7 @@ namespace campvis {
glDisable(GL_DEPTH_TEST);
LGL_ERROR;
data.addData(p_targetImageID.getValue(), rt.first);
data.addData(p_targetImageID.getValue(), ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo).first);
p_targetImageID.issueWrite();
}
else {
......
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