12345678910111213141516171819202122 |
- #include <iostream>
- #include "rendering/FileTexture.h"
- #include "utils/PNGReader.h"
- FileTexture::FileTexture(const char* path) {
- PNGReader reader(path);
- if(reader.hasError()) {
- return;
- }
- char* buffer = new char[reader.getBufferSize()];
- if(reader.readData(buffer)) {
- delete[] buffer;
- return;
- }
- texture.setColors(reader.getWidth(), reader.getHeight(), buffer, reader.getChannels());
- delete[] buffer;
- }
- void FileTexture::bind() const {
- texture.bind();
- }
|