Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2011-11-24 23:27:15 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-11-24 23:27:15 +0400
commitddfc518caea168ae1882e717ef28a35f91705a14 (patch)
treec00a7a6571c6aa5c387cf9404a759f7f0f13df74 /source/gameengine/VideoTexture/Texture.cpp
parent366554d3038f9710f469bd2461c6761784f11f34 (diff)
BGE patch: [#29285] Video Texture: Avoid slow rescale (non power of 2 support check) by Goran Milovanovic (goran)
"Just a simple check for non power of two support (GLEW_ARB_texture_non_power_of_two), to avoid what seems to be a very slow, and very unnecessary gluScaleImage call." This is the only part of the VideoTexture that does the POT calculation, so the check seems good. It would be interesting if some opengl guru would like to benchmark the use of this in other areas of Blender (e.g. 2D Filters, and all GLSL materials). Note that mipmap should also be supported automatically by this extension, so it's not something to worry about.
Diffstat (limited to 'source/gameengine/VideoTexture/Texture.cpp')
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index e1ddd7fce1e..40e9f899ef0 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -329,7 +329,17 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
// get texture size
short * orgSize = self->m_source->m_image->getSize();
// calc scaled sizes
- short size[] = {ImageBase::calcSize(orgSize[0]), ImageBase::calcSize(orgSize[1])};
+ short size[2];
+ if (GLEW_ARB_texture_non_power_of_two)
+ {
+ size[0] = orgSize[0];
+ size[1] = orgSize[1];
+ }
+ else
+ {
+ size[0] = ImageBase::calcSize(orgSize[0]);
+ size[1] = ImageBase::calcSize(orgSize[1]);
+ }
// scale texture if needed
if (size[0] != orgSize[0] || size[1] != orgSize[1])
{