]> isoptera.lcsc.edu Git - engine26/.git/commitdiff
Changed to 4 channel textures, which fixes the HUD for some reason
authorSeth Long <sslong@lcsc.edu>
Wed, 11 Nov 2026 22:39:25 +0000 (14:39 -0800)
committerSeth Long <sslong@lcsc.edu>
Wed, 11 Nov 2026 22:39:25 +0000 (14:39 -0800)
gameobject.cpp

index 623e9b8160e9c519b529cc1a70f82686602989ce..ed3de733e5aaf36ac3c824a0eca4316a28a7bdcc 100644 (file)
@@ -42,7 +42,7 @@ unsigned int load_texture(string texture_file){
                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;
@@ -54,7 +54,7 @@ unsigned int load_texture(string texture_file){
                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;
        }