patch [#23144] bpy.Image.gl_load() -- fix
authorCampbell Barton <ideasman42@gmail.com>
Sun, 1 Aug 2010 22:20:45 +0000 (22:20 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 1 Aug 2010 22:20:45 +0000 (22:20 +0000)
from Dan Eicher (dna)
- image.gl_load() was using GL_UNSIGNED_INT rather then GL_UNSIGNED_BYTE channel type.
- changed image.gl_load() to use the image clamp settings (patch had this as an extra argument).

source/blender/makesrna/intern/rna_image_api.c

index 289530d4f3296f7f51970a255f62ed7d06f889cb..efe3d39d6cd6f7f5a0a5b209670cc6fabaf1b856 100644 (file)
@@ -153,10 +153,12 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
                error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect);
 
        if (!error) {
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image->tpageflag & IMA_CLAMP_V ? GL_CLAMP : GL_REPEAT);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
                glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect); 
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); 
                error = (int)glGetError();
        }