Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Text drawn to renderTexture with sf::BlendNone and kerning  (Read 2227 times)

0 Members and 1 Guest are viewing this topic.

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Text drawn to renderTexture with sf::BlendNone and kerning
« 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.



Is there any other way I could draw the text on the RenderTexture but without that artiffacts?

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Text drawn to renderTexture with sf::BlendNone and kerning
« Reply #1 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

So let me rephrase my question:
Is there any way to achieve a proper font rendering on a RenderTexture but without shader involvement?
« Last Edit: February 27, 2018, 02:25:19 pm by oomek »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text drawn to renderTexture with sf::BlendNone and kerning
« Reply #2 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.
Laurent Gomila - SFML developer

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Text drawn to renderTexture with sf::BlendNone and kerning
« Reply #3 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.
« Last Edit: February 27, 2018, 03:00:59 pm by oomek »

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Text drawn to renderTexture with sf::BlendNone and kerning
« Reply #4 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?