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:
authorAntony Riakiotakis <kalast@gmail.com>2015-03-16 18:18:37 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-03-16 18:18:37 +0300
commit77bc623bc4b1b1d6389eb749468348c13ed19ce8 (patch)
tree29328d890f4b244be1cb0103d4265ccc012dfff7 /source/gameengine/VideoTexture/Texture.cpp
parent664c611fc8838151bc570fc39657dac9970a1c6f (diff)
Get rid og gluBuild2DMipmaps on game engine.
Diffstat (limited to 'source/gameengine/VideoTexture/Texture.cpp')
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index 9640c5544da..c31faf5a463 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -79,9 +79,21 @@ void loadTexture(unsigned int texId, unsigned int *texture, short *size,
glBindTexture(GL_TEXTURE_2D, texId);
if (mipmap)
{
+ int i;
+ ImBuf *ibuf;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, size[0], size[1], GL_RGBA, GL_UNSIGNED_BYTE, texture);
+
+ ibuf = IMB_allocFromBuffer(texture, NULL, size[0], size[1]);
+
+ IMB_makemipmap(ibuf, true);
+
+ for (i = 0; i < ibuf->miptot; i++) {
+ ImBuf *mip = IMB_getmipmap(ibuf, i);
+
+ glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA, mip->x, mip->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, mip->rect);
+ }
+ IMB_freeImBuf(ibuf);
}
else
{