world previews demo

This commit is contained in:
MihailRis
2024-04-23 01:09:30 +03:00
parent 5afa5304ff
commit 6e2bc9ca95
24 changed files with 153 additions and 59 deletions
+2 -2
View File
@@ -49,12 +49,12 @@ void Texture::reload(ubyte* data){
glBindTexture(GL_TEXTURE_2D, 0);
}
ImageData* Texture::readData() {
std::unique_ptr<ImageData> Texture::readData() {
std::unique_ptr<ubyte[]> data (new ubyte[width * height * 4]);
glBindTexture(GL_TEXTURE_2D, id);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.get());
glBindTexture(GL_TEXTURE_2D, 0);
return new ImageData(ImageFormat::rgba8888, width, height, data.release());
return std::make_unique<ImageData>(ImageFormat::rgba8888, width, height, data.release());
}
void Texture::setNearestFilter() {