Commit f1fe09b1 authored by schultezub's avatar schultezub
Browse files

made the fix from the last commit more elegant

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@229 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 0dd9b3da
......@@ -36,54 +36,60 @@ namespace TUMVis {
LWARNING("Neither non-power-of-two textures nor texture rectangles seem to be supported!");
}
switch(internalFormatColor) {
case GL_RGB:
_colorTexture = new tgt::Texture(0, _size, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, tgt::Texture::LINEAR);
{
// acqiure a new TextureUnit, so that we don't mess with other currently bound textures during texture upload...
tgt::TextureUnit rtUnit;
rtUnit.activate();
switch(internalFormatColor) {
case GL_RGB:
_colorTexture = new tgt::Texture(0, _size, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, tgt::Texture::LINEAR);
break;
case GL_RGBA:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, tgt::Texture::LINEAR);
break;
case GL_RGBA8:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA8, GL_UNSIGNED_BYTE, tgt::Texture::LINEAR);
break;
case GL_RGBA16:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA16, GL_UNSIGNED_SHORT, tgt::Texture::LINEAR);
break;
case GL_RGB16F_ARB:
_colorTexture = new tgt::Texture(0, _size, GL_RGB, GL_RGB16F_ARB, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA16F_ARB:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA16F_ARB, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA32F_ARB:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA32F_ARB, GL_FLOAT, tgt::Texture::LINEAR);
break;
default:
LERROR("Unknown internal format!");
}
_colorTexture->uploadTexture();
_colorTexture->setWrapping(tgt::Texture::CLAMP_TO_EDGE);
switch(internalFormatDepth) {
case GL_DEPTH_COMPONENT16:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, tgt::Texture::LINEAR);
case GL_DEPTH_COMPONENT24:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT24, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA8:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA8, GL_UNSIGNED_BYTE, tgt::Texture::LINEAR);
case GL_DEPTH_COMPONENT32:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA16:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA16, GL_UNSIGNED_SHORT, tgt::Texture::LINEAR);
break;
case GL_RGB16F_ARB:
_colorTexture = new tgt::Texture(0, _size, GL_RGB, GL_RGB16F_ARB, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA16F_ARB:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA16F_ARB, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_RGBA32F_ARB:
_colorTexture = new tgt::Texture(0, _size, GL_RGBA, GL_RGBA32F_ARB, GL_FLOAT, tgt::Texture::LINEAR);
#ifdef GL_DEPTH_COMPONENT32F
case GL_DEPTH_COMPONENT32F:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F, GL_FLOAT, tgt::Texture::LINEAR);
break;
#endif
default:
LERROR("Unknown internal format!");
}
_colorTexture->uploadTexture();
_colorTexture->setWrapping(tgt::Texture::CLAMP_TO_EDGE);
switch(internalFormatDepth) {
case GL_DEPTH_COMPONENT16:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_DEPTH_COMPONENT24:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT24, GL_FLOAT, tgt::Texture::LINEAR);
break;
case GL_DEPTH_COMPONENT32:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32, GL_FLOAT, tgt::Texture::LINEAR);
break;
#ifdef GL_DEPTH_COMPONENT32F
case GL_DEPTH_COMPONENT32F:
_depthTexture = new tgt::Texture(0, _size, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F, GL_FLOAT, tgt::Texture::LINEAR);
break;
#endif
default:
LERROR("Unknown internal depth format!");
LERROR("Unknown internal depth format!");
}
_depthTexture->uploadTexture();
_depthTexture->setWrapping(tgt::Texture::CLAMP_TO_EDGE);
}
_depthTexture->uploadTexture();
_depthTexture->setWrapping(tgt::Texture::CLAMP_TO_EDGE);
_fbo = new tgt::FramebufferObject();
if (!_fbo) {
......
......@@ -80,9 +80,6 @@ namespace TUMVis {
* Put additional (processor specific) setup code here, create and activate your render target(s), render
* your quad and store your results in \a data.
*
* \note When creating new render targets, pleas make sure to activate a new TextureUnit first or
* one of the previous bound textures (volume, TF, entry-/exit points) will be destroyed!
*
* \sa RaycastingProcessor::process()
* \param data DataContainer to work on.
*/
......
......@@ -27,8 +27,6 @@ namespace TUMVis {
_shader->setUniform("_shift", _shift.getValue());
_shader->setUniform("_scale", _scale.getValue());
tgt::TextureUnit rtUnit;
rtUnit.activate();
ImageDataRenderTarget* rt = new ImageDataRenderTarget(tgt::svec3(_renderTargetSize.getValue(), 1));
rt->activate();
......
......@@ -18,8 +18,6 @@ namespace TUMVis {
}
void SimpleRaycaster::processImpl(DataContainer& data) {
tgt::TextureUnit rtUnit;
rtUnit.activate();
ImageDataRenderTarget* rt = new ImageDataRenderTarget(tgt::svec3(_renderTargetSize.getValue(), 1));
rt->activate();
......
......@@ -64,6 +64,7 @@ namespace TUMVis {
rt->deactivate();
_shader->deactivate();
tgt::TextureUnit::setZeroUnit();
data.addData(_targetImageID.getValue(), rt);
delete slice;
......
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