Fix wrong width/height values being stored in thin3d textures

This commit is contained in:
Henrik Rydgård 2022-08-24 10:23:37 +02:00
parent eb2f12e64a
commit 8b3ef19450

View file

@ -821,11 +821,14 @@ OpenGLTexture::OpenGLTexture(GLRenderManager *render, const TextureDesc &desc) :
return;
int level = 0;
int width = width_;
int height = height_;
int depth = depth_;
for (auto data : desc.initData) {
SetImageData(0, 0, 0, width_, height_, depth_, level, 0, data, desc.initDataCallback);
width_ = (width_ + 1) / 2;
height_ = (height_ + 1) / 2;
depth_ = (depth_ + 1) / 2;
SetImageData(0, 0, 0, width, height, depth, level, 0, data, desc.initDataCallback);
width = (width + 1) / 2;
height = (height + 1) / 2;
depth = (depth + 1) / 2;
level++;
}
mipLevels_ = desc.generateMips ? desc.mipLevels : level;