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
: dimensions_(dimensions)
, internalformat_(internalFormat)
, filter_(filter)
, wrapping_(CLAMP)
, wrapping_(CLAMP_TO_EDGE)
, id_(0)
, type_(type)
, bpp_(0)
......@@ -51,7 +51,7 @@ Texture::Texture(GLenum type, const cgt::ivec3& dimensions, GLint internalFormat
: dimensions_(dimensions)
, internalformat_(internalFormat)
, filter_(filter)
, wrapping_(CLAMP)
, wrapping_(CLAMP_TO_EDGE)
, id_(0)
, type_(type)
, bpp_(0)
......
......@@ -53,7 +53,6 @@ public:
enum Wrapping {
REPEAT = GL_REPEAT,
CLAMP = GL_CLAMP,
CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE,
CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER,
MIRRORED_REPEAT = GL_MIRRORED_REPEAT
......
......@@ -112,7 +112,7 @@ namespace campvis {
// create texture for result
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
_shader->activate();
......
......@@ -89,7 +89,7 @@ namespace campvis {
// create texture for result
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
_shader->activate();
......
......@@ -162,11 +162,11 @@ namespace registration {
cgt::Texture* similarityTex = 0;
cgt::Texture* similarityTex2 = 0;
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...
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->setWrapping(cgt::Texture::CLAMP);
similarityTex2->setWrapping(cgt::Texture::CLAMP_TO_EDGE);
leShader = _nccsnrCostFunctionShader;
}
......
......@@ -164,7 +164,7 @@ namespace campvis {
// create new texture
_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;
// attach mipmaps manually (as we want special ones)
......@@ -218,7 +218,7 @@ namespace campvis {
cgt::TextureUnit xorUnit;
xorUnit.activate();
_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();
_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