diff --git a/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp b/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp index 49fb95d0d8..f6ca11bffb 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp @@ -22,6 +22,15 @@ ============================================================================== */ +static int getAllowedTextureSize (int x) +{ + #if JUCE_OPENGL_ALLOW_NON_POWER_OF_TWO_TEXTURES + return x; + #else + return nextPowerOfTwo (x); + #endif +} + OpenGLTexture::OpenGLTexture() : textureID (0), width (0), height (0), ownerContext (nullptr) { @@ -65,8 +74,8 @@ void OpenGLTexture::create (const int w, const int h, const void* pixels, GLenum glPixelStorei (GL_UNPACK_ALIGNMENT, 1); JUCE_CHECK_OPENGL_ERROR - width = nextPowerOfTwo (w); - height = nextPowerOfTwo (h); + width = getAllowedTextureSize (w); + height = getAllowedTextureSize (h); const GLint internalformat = type == GL_ALPHA ? GL_ALPHA : GL_RGBA;