printf("Found existing texture for %s\n", texture_file.c_str());
} else {
int img_width, img_height;
- unsigned char* image = stbi_load(texture_file.c_str(), &img_width, &img_height, 0, STBI_rgb);
+ unsigned char* image = stbi_load(texture_file.c_str(), &img_width, &img_height, 0, 4);
if(!image){
printf("image failed to load: %s\n", texture_file.c_str());
return false;
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img_width, img_height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img_width, img_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
free(image);
gl_resources[texture_file] = tex;
}