image.gl_load: moving error cleaning to before all gl calls"

This commit is contained in:
Dalai Felinto
2012-05-28 17:47:42 +00:00
parent 6323b32c08
commit 481658867e

View File

@@ -207,15 +207,16 @@ 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_BYTE, ibuf->rect);
if (!error) {
/* clean glError buffer */
while (glGetError() != GL_NO_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_BYTE, ibuf->rect);
while (error != GL_NO_ERROR)
error = (int)glGetError();
error = (int)glGetError();
}
if (error) {