Moving more duplicate code from GPU_create_gl_tex_compressed() and BL_Texture::InitGL...
authorMitchell Stokes <mogurijin@gmail.com>
Sat, 18 Aug 2012 03:32:28 +0000 (03:32 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Sat, 18 Aug 2012 03:32:28 +0000 (03:32 +0000)
source/blender/gpu/intern/gpu_draw.c
source/gameengine/Ketsji/BL_Texture.cpp

index 3c2d3e11197ae875dbe7d246620353e7b7158c73..d03913af417e2c2d08953232233b366b3c7e82d7 100644 (file)
@@ -730,6 +730,11 @@ int GPU_upload_dxt_texture(ImBuf *ibuf)
                return FALSE;
        }
 
                return FALSE;
        }
 
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
+
+       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
        blocksize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;
        for (i=0; i<ibuf->dds_data.nummipmaps && (width||height); ++i) {
                if (width == 0)
        blocksize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;
        for (i=0; i<ibuf->dds_data.nummipmaps && (width||height); ++i) {
                if (width == 0)
@@ -766,11 +771,6 @@ void GPU_create_gl_tex_compressed(unsigned int *bind, unsigned int *pix, int x,
        glGenTextures(1, (GLuint *)bind);
        glBindTexture(GL_TEXTURE_2D, *bind);
 
        glGenTextures(1, (GLuint *)bind);
        glBindTexture(GL_TEXTURE_2D, *bind);
 
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
-
-       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
        if (GPU_upload_dxt_texture(ibuf) == 0) {
                glDeleteTextures(1, (GLuint*)bind);
                GPU_create_gl_tex(bind, pix, NULL, x, y, mipmap, 0, ima);
        if (GPU_upload_dxt_texture(ibuf) == 0) {
                glDeleteTextures(1, (GLuint*)bind);
                GPU_create_gl_tex(bind, pix, NULL, x, y, mipmap, 0, ima);
index e4e3fb95543d2e4f121c39eef41af60739095b8e..49963cee3b34f3cc4b086e164bfde87e51bf4180 100644 (file)
@@ -201,11 +201,6 @@ void BL_Texture::InitGLCompressedTex(ImBuf* ibuf, bool mipmap)
        return;
 #else
        glBindTexture(GL_TEXTURE_2D, mTexture);
        return;
 #else
        glBindTexture(GL_TEXTURE_2D, mTexture);
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
-       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
        
        if (GPU_upload_dxt_texture(ibuf) == 0) {
                InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap);
        
        if (GPU_upload_dxt_texture(ibuf) == 0) {
                InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap);