Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/OpenGL/OpenGLTexture.cpp @ 2036:444527d34647 deep-learning
sanity check in textures
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 28 Jan 2023 12:05:23 +0100 |
parents | a73a8415780f |
children | d81a7157a846 |
comparison
equal
deleted
inserted
replaced
2035:a73a8415780f | 2036:444527d34647 |
---|---|
141 GLint interpolation = (isLinearInterpolation ? GL_LINEAR : GL_NEAREST); | 141 GLint interpolation = (isLinearInterpolation ? GL_LINEAR : GL_NEAREST); |
142 | 142 |
143 // Load the texture from the image buffer | 143 // Load the texture from the image buffer |
144 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, | 144 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, |
145 0, sourceFormat, pixelType, data); | 145 0, sourceFormat, pixelType, data); |
146 | |
147 GLint w, h; | |
148 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w); | |
149 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h); | |
150 if (width != static_cast<unsigned int>(w) || | |
151 height != static_cast<unsigned int>(h)) | |
152 { | |
153 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, | |
154 "Your GPU cannot create a texture of size " + | |
155 boost::lexical_cast<std::string>(width) + " x " + | |
156 boost::lexical_cast<std::string>(height)); | |
157 } | |
158 | |
146 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, interpolation); | 159 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, interpolation); |
147 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, interpolation); | 160 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, interpolation); |
148 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 161 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
149 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 162 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
150 } | 163 } |