FileTexture.cpp 386 B

12345678910111213141516
  1. #include "client/rendering/FileTexture.h"
  2. #include "client/utils/PNGReader.h"
  3. FileTexture::FileTexture(const char* path) {
  4. u32 width;
  5. u32 height;
  6. u32* data = PNGReader::load(path, width, height);
  7. if(data != nullptr) {
  8. texture.setRGBAData(width, height, data);
  9. delete[] data;
  10. }
  11. }
  12. void FileTexture::bind(uint index) const {
  13. texture.bind(index);
  14. }