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

Fixed usage of GL_CLAMP wrapping mode for OpenGL textures. This mode is...

Fixed usage of GL_CLAMP wrapping mode for OpenGL textures. This mode is deprecated since OpenGL 3.1. Replaced all its occurrences with CLAMP_TO_EDGE, which usually is the wanted behavior. This also seems to improve the performance of the AdvOptimizedRaycaster.
parent 11ccf001
...@@ -38,7 +38,7 @@ Texture::Texture(GLenum type, const cgt::ivec3& dimensions, GLint internalFormat ...@@ -38,7 +38,7 @@ Texture::Texture(GLenum type, const cgt::ivec3& dimensions, GLint internalFormat
: dimensions_(dimensions) : dimensions_(dimensions)
, internalformat_(internalFormat) , internalformat_(internalFormat)
, filter_(filter) , filter_(filter)
, wrapping_(CLAMP) , wrapping_(CLAMP_TO_EDGE)
, id_(0) , id_(0)
, type_(type) , type_(type)
, bpp_(0) , bpp_(0)
...@@ -51,7 +51,7 @@ Texture::Texture(GLenum type, const cgt::ivec3& dimensions, GLint internalFormat ...@@ -51,7 +51,7 @@ Texture::Texture(GLenum type, const cgt::ivec3& dimensions, GLint internalFormat
: dimensions_(dimensions) : dimensions_(dimensions)
, internalformat_(internalFormat) , internalformat_(internalFormat)
, filter_(filter) , filter_(filter)
, wrapping_(CLAMP) , wrapping_(CLAMP_TO_EDGE)
, id_(0) , id_(0)
, type_(type) , type_(type)
, bpp_(0) , bpp_(0)
......
...@@ -53,7 +53,6 @@ public: ...@@ -53,7 +53,6 @@ public:
enum Wrapping { enum Wrapping {
REPEAT = GL_REPEAT, REPEAT = GL_REPEAT,
CLAMP = GL_CLAMP,
CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE,
CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER, CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER,
MIRRORED_REPEAT = GL_MIRRORED_REPEAT MIRRORED_REPEAT = GL_MIRRORED_REPEAT
......
...@@ -112,7 +112,7 @@ namespace campvis { ...@@ -112,7 +112,7 @@ namespace campvis {
// create texture for result // create texture for result
cgt::Texture* resultTexture = new cgt::Texture(GL_TEXTURE_3D, cgt::ivec3(size), GL_R8UI, cgt::Texture::NEAREST); cgt::Texture* resultTexture = new cgt::Texture(GL_TEXTURE_3D, cgt::ivec3(size), GL_R8UI, cgt::Texture::NEAREST);
resultTexture->setWrapping(cgt::Texture::CLAMP); resultTexture->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
// activate shader and bind textures // activate shader and bind textures
_shader->activate(); _shader->activate();
......
...@@ -89,7 +89,7 @@ namespace campvis { ...@@ -89,7 +89,7 @@ namespace campvis {
// create texture for result // create texture for result
cgt::Texture* distanceTexture = new cgt::Texture(GL_TEXTURE_3D, cgt::ivec3(size), GL_RGB16F, cgt::Texture::LINEAR); cgt::Texture* distanceTexture = new cgt::Texture(GL_TEXTURE_3D, cgt::ivec3(size), GL_RGB16F, cgt::Texture::LINEAR);
distanceTexture->setWrapping(cgt::Texture::CLAMP); distanceTexture->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
// activate shader and bind textures // activate shader and bind textures
_shader->activate(); _shader->activate();
......
...@@ -162,11 +162,11 @@ namespace registration { ...@@ -162,11 +162,11 @@ namespace registration {
cgt::Texture* similarityTex = 0; cgt::Texture* similarityTex = 0;
cgt::Texture* similarityTex2 = 0; cgt::Texture* similarityTex2 = 0;
similarityTex = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(p_viewportSize.getValue(), 1), GL_RGBA32F, cgt::Texture::NEAREST); similarityTex = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(p_viewportSize.getValue(), 1), GL_RGBA32F, cgt::Texture::NEAREST);
similarityTex->setWrapping(cgt::Texture::CLAMP); similarityTex->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
// NCC and SNR need a second texture and a different shader... // NCC and SNR need a second texture and a different shader...
if (p_metric.getOptionValue() == "NCC" || p_metric.getOptionValue() == "SNR") { if (p_metric.getOptionValue() == "NCC" || p_metric.getOptionValue() == "SNR") {
similarityTex2 = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(p_viewportSize.getValue(), 1), GL_RGBA32F, cgt::Texture::NEAREST); similarityTex2 = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(p_viewportSize.getValue(), 1), GL_RGBA32F, cgt::Texture::NEAREST);
similarityTex2->setWrapping(cgt::Texture::CLAMP); similarityTex2->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
leShader = _nccsnrCostFunctionShader; leShader = _nccsnrCostFunctionShader;
} }
......
...@@ -164,7 +164,7 @@ namespace campvis { ...@@ -164,7 +164,7 @@ namespace campvis {
// create new texture // create new texture
_hierarchyTexture = new cgt::Texture(GL_TEXTURE_2D, _dimPackedBricks, GL_RGBA32UI, cgt::Texture::NEAREST); _hierarchyTexture = new cgt::Texture(GL_TEXTURE_2D, _dimPackedBricks, GL_RGBA32UI, cgt::Texture::NEAREST);
_hierarchyTexture->setWrapping(cgt::Texture::CLAMP); _hierarchyTexture->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
LGL_ERROR; LGL_ERROR;
// attach mipmaps manually (as we want special ones) // attach mipmaps manually (as we want special ones)
...@@ -218,7 +218,7 @@ namespace campvis { ...@@ -218,7 +218,7 @@ namespace campvis {
cgt::TextureUnit xorUnit; cgt::TextureUnit xorUnit;
xorUnit.activate(); xorUnit.activate();
_xorBitmaskTexture = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(128, 128, 1), GL_RGBA32UI, cgt::Texture::NEAREST); _xorBitmaskTexture = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(128, 128, 1), GL_RGBA32UI, cgt::Texture::NEAREST);
_xorBitmaskTexture->setWrapping(cgt::Texture::CLAMP); _xorBitmaskTexture->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
_xorBitmaskShader->activate(); _xorBitmaskShader->activate();
_fbo->activate(); _fbo->activate();
......
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