From 14906d229361e71a6fa8e7aa10f5a684afce6e41 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 12 Feb 2014 10:27:43 +0000 Subject: [PATCH] Added flag JUCE_OPENGL_ALLOW_NON_POWER_OF_TWO_TEXTURES --- modules/juce_opengl/opengl/juce_OpenGLTexture.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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;