| 55 | } |
| 56 | |
| 57 | unsigned int loadBMPTexture_ARGB(const char* filename) |
| 58 | { |
| 59 | unsigned int texture; |
| 60 | int width, height; |
| 61 | std::vector<unsigned char> data; |
| 62 | |
| 63 | printf("Loading texture: %s\n", filename); |
| 64 | |
| 65 | data = std::move(loadTextureARGBfromfile(filename, width, height)); |
| 66 | if (data.empty()) |
| 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | glGenTextures(1, &texture); |
| 72 | glBindTexture(GL_TEXTURE_2D, texture); |
| 73 | |
| 74 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); |
| 75 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); |
| 76 | |
| 77 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 78 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 79 | |
| 80 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, |
| 81 | GL_UNSIGNED_BYTE, data.data()); |
| 82 | |
| 83 | return texture; |
| 84 | } |
| 85 | |
| 86 | std::vector<unsigned char> loadTextureARGBfromfile(const char* filename, int& w, |
| 87 | int& h) |
no test coverage detected