disable mip-mapping for canvas texture
This commit is contained in:
parent
5b49c72d12
commit
3a203bd4b0
@ -165,7 +165,7 @@ assetload::postfunc assetload::font(
|
||||
textures.emplace_back(nullptr);
|
||||
} else {
|
||||
auto texture = Texture::from(page.get());
|
||||
texture->setMipMapping(false);
|
||||
texture->setMipMapping(false, true);
|
||||
textures.emplace_back(std::move(texture));
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,14 +71,20 @@ void GLTexture::setNearestFilter() {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
void GLTexture::setMipMapping(bool flag) {
|
||||
void GLTexture::setMipMapping(bool flag, bool pixelated) {
|
||||
bind();
|
||||
if (flag) {
|
||||
glTexParameteri(
|
||||
GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_MIN_FILTER,
|
||||
pixelated ? GL_NEAREST : GL_LINEAR_MIPMAP_NEAREST
|
||||
);
|
||||
} else {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_MIN_FILTER,
|
||||
pixelated ? GL_NEAREST : GL_LINEAR
|
||||
);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ public:
|
||||
|
||||
virtual void reload(const ImageData& image) override;
|
||||
|
||||
virtual void setMipMapping(bool flag) override;
|
||||
virtual void setMipMapping(bool flag, bool pixelated) override;
|
||||
|
||||
virtual std::unique_ptr<ImageData> readData() override;
|
||||
virtual uint getId() const override;
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
|
||||
virtual uint getId() const = 0;
|
||||
|
||||
virtual void setMipMapping(bool flag) = 0;
|
||||
virtual void setMipMapping(bool flag, bool pixelated) = 0;
|
||||
|
||||
static std::unique_ptr<Texture> from(const ImageData* image);
|
||||
};
|
||||
|
||||
@ -114,7 +114,7 @@ void PrecipitationRenderer::render(
|
||||
|
||||
batch->begin();
|
||||
auto& texture = assets.require<Texture>(weather.fall.texture);
|
||||
texture.setMipMapping(false);
|
||||
texture.setMipMapping(false, true);
|
||||
batch->setTexture(&texture, {});
|
||||
|
||||
const struct {
|
||||
|
||||
@ -17,6 +17,7 @@ LuaCanvas::LuaCanvas(
|
||||
|
||||
void LuaCanvas::createTexture() {
|
||||
mTexture = Texture::from(mData.get());
|
||||
mTexture->setMipMapping(false, true);
|
||||
}
|
||||
|
||||
union RGBA {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user