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:
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
{