SFML community forums

Help => General => Topic started by: oomek on February 27, 2018, 02:08:12 pm

Title: Text drawn to renderTexture with sf::BlendNone and kerning
Post by: oomek on February 27, 2018, 02:08:12 pm
Hi, I've decided to write a follow up to the old topic as digging out old threads from 2012 is undesireble for some.
https://en.sfml-dev.org/forums/index.php?topic=8792.0

The solution presented in that thread is saying to set the blending mode to sf::BlendNone is not a solution for variable width fonts as the next letter is cutting off the part of the previous letter.

(https://s17.postimg.org/5env87sfj/SFML_Blend_None.png)

Is there any other way I could draw the text on the RenderTexture but without that artiffacts?
Title: Re: Text drawn to renderTexture with sf::BlendNone and kerning
Post by: oomek on February 27, 2018, 02:19:23 pm
After writing that question I found another workaround that involves shaders.

https://en.sfml-dev.org/forums/index.php?topic=21883.15 (https://en.sfml-dev.org/forums/index.php?topic=21883.15)

So let me rephrase my question:
Is there any way to achieve a proper font rendering on a RenderTexture but without shader involvement?
Title: Re: Text drawn to renderTexture with sf::BlendNone and kerning
Post by: Laurent on February 27, 2018, 02:23:32 pm
Quote
Hi, I've decided to write a follow up to the old topic as digging out old threads from 2012 is undesireble for some.
You don't have to, if you want to add to an existing discussion then it makes sense to post in the already existing thread rather than creating a new one. People who land on the old thread may never find this one and the additional information that it contains.

Quote
Is there any other way I could draw the text on the RenderTexture but without that artiffacts?
I was about to suggest the shader solution but you found it by yourself :)

Quote
Is there any way to achieve a proper font rendering on a RenderTexture but without shader involvement?
Right now, I have no other solution in mind. I don't know if more advanced blending modes could help to solve this.
Title: Re: Text drawn to renderTexture with sf::BlendNone and kerning
Post by: oomek on February 27, 2018, 02:27:09 pm
Thanks for your reply.
I've done some experiments in the https://www.andersriggelsen.dk/glblendfunc.php tool, but I couldn't find any blending modes combination that could achieve a proper blending unfortunately

A little explanation is required of why I would like to refrain from using shaders.
I have in the works some improvements for the Attract Mode emuator frontend. The themes are written in Squirrel language. Theme developers have the ability to bind shaders to drawables, so even If i set the shader to do the dirty work it will be most likely overridden.
Title: Re: Text drawn to renderTexture with sf::BlendNone and kerning
Post by: oomek on February 28, 2018, 12:17:07 am
Could premultiplying text with alpha and setting the blending mode to BlendMode::One, BlendMode::OneMinusSrcAlpha solve the problem by any chance?
Is there any way to render the text as premultiplied?