Skip to content

Commit

Permalink
Change text rendering (text material) text filtering mode
Browse files Browse the repository at this point in the history
Change text rendering (text material) text filtering mode and just
force/use linear min/mag filtering for now.

Using a better filtering (with mipmaps) would require that the
rasterized text is a power of two (on ES2/WASM). But this already
seems to improve the text somewhat.

Issue #207
  • Loading branch information
ensisoft committed Sep 12, 2024
1 parent 0730f77 commit 5ef5cc4
Show file tree
Hide file tree
Showing 19 changed files with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions graphics/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2746,6 +2746,10 @@ bool TextMaterial::ApplyDynamicState(const Environment& env, Device& device, Pro
texture->SetWrapY(Texture::Wrapping::Clamp);
// see the comment above about mipmaps. it's relevant regarding
// the possible filtering settings that we can use here.

// see issue 207
// https://github.com/ensisoft/detonator/issues/207
#if 0
if (mPointSampling)
{
texture->SetFilter(Texture::MagFilter::Nearest);
Expand All @@ -2756,6 +2760,10 @@ bool TextMaterial::ApplyDynamicState(const Environment& env, Device& device, Pro
texture->SetFilter(Texture::MagFilter::Linear);
texture->SetFilter(Texture::MinFilter::Linear);
}
#endif
texture->SetFilter(Texture::MinFilter::Linear);
texture->SetFilter(Texture::MagFilter::Linear);

}
program.SetTexture("kTexture", 0, *texture);
program.SetUniform("kColor", mColor);
Expand Down
Binary file modified graphics/test/dist/Gold_TextAlignTest2_0_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextAlignTest2_1_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextAlignTest2_2_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextAlignTest_0_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextAlignTest_1_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextAlignTest_2_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_0_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_0_MSAA4_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_0_MSAA8_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_0_None_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_1_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_1_MSAA4_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_1_MSAA8_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_1_None_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_2_MSAA16_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_2_MSAA4_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_2_MSAA8_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/test/dist/Gold_TextTest_2_None_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5ef5cc4

Please sign in to comment.