Consistently use BGRA for possible performance gains.

This commit is contained in:
Themaister 2011-08-29 17:19:38 +02:00
parent dc9dd2e6bf
commit 600efab1bd
3 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
uint32_t g = (src[x] & fmt->Gmask) >> fmt->Gshift;
uint32_t b = (src[x] & fmt->Bmask) >> fmt->Bshift;
uint32_t a = (src[x] & fmt->Amask) >> fmt->Ashift;
dst[x] = (r << 24) | (g << 16) | (b << 8) | a;
dst[x] = (b << 24) | (g << 16) | (r << 8) | a;
}
}
}
@ -84,7 +84,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
uint32_t r = (color & fmt->Rmask) >> fmt->Rshift;
uint32_t g = (color & fmt->Gmask) >> fmt->Gshift;
uint32_t b = (color & fmt->Bmask) >> fmt->Bshift;
dst[x] = (r << 24) | (g << 16) | (b << 8) | 0xff;
dst[x] = (b << 24) | (g << 16) | (r << 8) | 0xff;
}
}
}

View File

@ -398,7 +398,7 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glPixelStorei(GL_UNPACK_ROW_LENGTH, img.width);
glTexImage2D(GL_TEXTURE_2D,
0, GL_RGBA, img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, img.pixels);
0, GL_RGBA, img.width, img.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, img.pixels);
lut_textures_num++;

View File

@ -356,7 +356,7 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glPixelStorei(GL_UNPACK_ROW_LENGTH, img.width);
glTexImage2D(GL_TEXTURE_2D,
0, GL_RGBA, img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, img.pixels);
0, GL_RGBA, img.width, img.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, img.pixels);
pglActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);