Mercurial > hg > orthanc-stone
changeset 2035:a73a8415780f deep-learning
added OpenGLTexture::SetClampingToZero()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Jan 2023 19:03:47 +0100 |
parents | 4b24b7533346 |
children | 444527d34647 |
files | OrthancStone/Sources/OpenGL/OpenGLTexture.cpp OrthancStone/Sources/OpenGL/OpenGLTexture.h |
diffstat | 2 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp Fri Jan 27 15:43:24 2023 +0100 +++ b/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp Fri Jan 27 19:03:47 2023 +0100 @@ -211,5 +211,16 @@ return target.release(); } + + + void OpenGLTexture::SetClampingToZero() + { + glBindTexture(GL_TEXTURE_2D, texture_); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + + GLfloat colorfv[4] = { 0, 0, 0, 0 }; + glTextureParameterfv(texture_, GL_TEXTURE_BORDER_COLOR, colorfv); + } } }
--- a/OrthancStone/Sources/OpenGL/OpenGLTexture.h Fri Jan 27 15:43:24 2023 +0100 +++ b/OrthancStone/Sources/OpenGL/OpenGLTexture.h Fri Jan 27 19:03:47 2023 +0100 @@ -83,6 +83,12 @@ void Bind(GLint location); Orthanc::ImageAccessor* Download(Orthanc::PixelFormat format); + + /** + * By default, textures are mirrored at the borders. This + * function will set out-of-image access to zero. + **/ + void SetClampingToZero(); }; } }