FileTexture.cpp 424 B

123456789101112131415
  1. #include "client/rendering/FileTexture.h"
  2. #include "client/utils/PNGReader.h"
  3. FileTexture::FileTexture(const char* path) {
  4. int maxWidth = 256;
  5. int maxHeight = 256;
  6. int buffer[256 * 256];
  7. if(PNGReader::load(path, buffer, maxWidth, maxHeight)) {
  8. texture.setColorData(maxWidth, maxHeight, reinterpret_cast<Color4*>(buffer));
  9. }
  10. }
  11. void FileTexture::bind(int index) const {
  12. texture.bind(index);
  13. }