[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42137] trunk/blender/source/gameengine/ VideoTexture/Texture.cpp: BGE patch: [#29285] Video Texture: Avoid slow rescale (non power of 2 support check) by Goran Milovanovic ( goran)
Dalai Felinto
dfelinto at gmail.com
Thu Nov 24 20:27:15 CET 2011
Revision: 42137
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42137
Author: dfelinto
Date: 2011-11-24 19:27:15 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/gameengine/VideoTexture/Texture.cpp
Modified: trunk/blender/source/gameengine/VideoTexture/Texture.cpp
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/Texture.cpp 2011-11-24 19:22:34 UTC (rev 42136)
+++ trunk/blender/source/gameengine/VideoTexture/Texture.cpp 2011-11-24 19:27:15 UTC (rev 42137)
@@ -329,7 +329,17 @@
// 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])
{
More information about the Bf-blender-cvs
mailing list