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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - NightShadeI

Pages: [1]
1
Graphics / Re: Full anti-smoothing of text / no aliasing in 2.6.x
« on: March 19, 2023, 04:52:38 am »
Ah yes definitely worth mentioning, thanks for correcting. Sorry a lot of the terminology is still new to me so sometimes I do misuse it. Yeah to be clear it would be very useful to allow aliasing in 2.6.x , especially now we're providing the setSmooth method , it makes sense in my opinion.

2
Graphics / Re: Full anti-smoothing of text / no aliasing in 2.6.x
« on: March 18, 2023, 02:36:47 pm »
Thanks eXpl0it3r, very much appreciate the reply!

I guess for now I'll look into modifying the source or other fonts like you suggest. Do you think it would be possible to add the ability to load with FT_RENDER_MODE_MONO into 2.6.1 for example? I can see this has been requested on and off over the years , and maybe now might me a good opportunity to add some ability to in combination with setSmooth change? Would that be realistically easy to do

I would infinitely appreciate that if it's not too much work :)

3
Graphics / Full anti-smoothing of text / no aliasing in 2.6.x
« on: March 18, 2023, 10:47:16 am »
Hi SFML team,

I'm trying to setup a simple example where text will not have any aliasing applied. I notice in 2.6.x we add the ability to setSmooth(false) on a given sf::Font

Unfortunately, this is making little to no difference to me, Will provide a minimal example below and a desired outcome. I have also tried some of the usual, earier tricks ive seen suggested online. Let me know if font file would help.



Top is desired (notice no aliasing), bottom is what the code produces. Note I have zoomed in here

Can use below code to reproduce in SFML 2.6.0 , I am using a windows 10 operating system

#include <SFML/Graphics.hpp>

int main() {
    sf::RenderWindow myWindow{sf::VideoMode{800, 600}, "Demo", sf::Style::Close};
    myWindow.setFramerateLimit(60);

    static constexpr uint32_t TEXT_SIZE = 14;

    const sf::Font myTimesNewRomanFont = [](){
        sf::Font myFont;
        myFont.setSmooth(false);
        myFont.loadFromFile("playground/fonts/times.ttf");
        const_cast<sf::Texture&>(myFont.getTexture(TEXT_SIZE)).setSmooth(false);
        return myFont;
    }();

    sf::Text myText{"English", myTimesNewRomanFont, TEXT_SIZE};

    while (myWindow.isOpen()) {
        myWindow.clear(sf::Color::White);

        myText.setFillColor(sf::Color::Black);
        myText.setPosition(sf::Vector2f{(int)200.f, (int)200.f});
        myWindow.draw(myText);

        myWindow.display();

        sf::Event myEvent;

        while (myWindow.pollEvent(myEvent)) {
            switch (myEvent.type) {
                case sf::Event::Closed:
                    myWindow.close();
                    break;
                default:
                    break;
            }
        }

    }
   
    return 0;
}
 

4
General / QT with SFML clean resizing in OSX
« on: January 15, 2023, 02:59:06 am »
Hi, I have managed to successfully integrate QT with SFML using the various tutorials out there.

Unfortunately resizing doesn't work as expected. It only does once the mouse button is released. Let me be clear, in a pure SFML window (no QT), I don't have this issue. Neither do I have it in Windows. This only fails in OSX

The behaviour is when decreasing the QT window size, SFML will shrink its window by too much, leaving surrounding black spaces. When increasing it will over compensate, and stretch the SFML inner window too much.

Again, the window resizes correctly when the mouse button is released.

Some possible reasons/ factors that might play into this:

- I don't call pollEvent() at all, due to this not working on SFML prior to 2.6.0
- I have a high DPI resolution display. I know SFML doesn't support this, so as a workaround, I multiply the size in set size by devicePixelRatio provided by QT (2), on my windows device this is 1
- I call set size on every resize event, this is necessary since SFML isnt seeing the resize event and for the DPI issues mentioned above

Any insight on workarounds would be infinitely appreciated, thanks

5
General discussions / When roughly can we expect 2.6.0?
« on: January 09, 2023, 12:48:26 pm »
I know there is a roadmap and various pages for this, but similarly these have been around for a while. I have an issue that makes a lot of SFML features impossible to use in 2.5.1 , that is fixed in 2.6.0 - namely the one outlined here

https://github.com/SFML/SFML/issues/1549

Exploitr might be familiar with it, since I have seen him comment in a lot of the forum posts for it here.

I would very much love to intergrate QT with SFML, and bring across the benefits of both a cross-platform UI library, and a cross-platform multimedia library such as SFML. It works perfectly in Windows, but it's simply impossible to use in its current state on OSX.

Any insight into this from the SFML team would be infinitely appreciated, for now i'll pursue other approaches, but i've loved using SFML for ages now, and want to keep using it into the future


6
Ah yes right you were, I had antialiasing and totally forgot I had it enabled  , thanks a lot for helping me track that one down. Interesting it had an effect

7
Minimal reproducible example:

static auto WHITE_COL = sf::Color{255, 255, 255, 255};
static sf::Vertex myQuads[] = {
    sf::Vertex{sf::Vector2f{100.f, 100.f}, WHITE_COL },
    sf::Vertex{sf::Vector2f{200.f, 100.f}, WHITE_COL },
    sf::Vertex{sf::Vector2f{200.f, 200.f}, WHITE_COL },
    sf::Vertex{sf::Vector2f{100.f, 200.f}, WHITE_COL },
};
aWindow.draw(myQuads, 4, sf::Quads);

static auto BLACK_COL = sf::Color{0, 0, 0, 255};
static sf::Vertex myLines[] = {
    sf::Vertex{sf::Vector2f{110.f, 150.f}, BLACK_COL},
    sf::Vertex{sf::Vector2f{190.f, 150.f}, BLACK_COL},
};

aWindow.draw(myLines, 2, sf::Lines);

This results in a gray line with RGB (99,99,99)

Oddly, adding another line 1 pixel below will resolve the issue, and the now "thickness 2" line is now black. Further, a rectangle will also be of a black colour. I'd prefer to be using a line here though.

I also tried adding sf::BlendNone , this does not help and results in the same outcome.

What is going on here?

Thanks :)


Pages: [1]