Skip to content

The borders sometimes won't be rendered properly #313

@Ma5t3rful

Description

@Ma5t3rful
#include "TGUI/Widgets/Button.hpp"
#include "TGUI/Widgets/HorizontalLayout.hpp"
#include <algorithm>
#include <functional>
#include <GLFW/glfw3.h>
#include <TGUI/Backend/GLFW-OpenGL3.hpp>
#include <TGUI/TGUI.hpp>


auto main (int,char**) -> int
{
    glfwInit();
    auto window = glfwCreateWindow(1000,300,"Bug",nullptr,nullptr);
    glfwMakeContextCurrent(window);
    tgui::Gui gui(window);
    const auto horizontal_layout = tgui::HorizontalLayout::create();
    horizontal_layout->setOrigin(.5f,.5f);
    horizontal_layout->setPosition("50%","50%");
    horizontal_layout->getRenderer()->setSpaceBetweenWidgets(20);
    horizontal_layout->setSize("90%", 40);
    std::array<tgui::Button::Ptr,10> buttons;
    std::ranges::generate(buttons,std::bind(tgui::Button::create,"Hello"));
    std::ranges::for_each(buttons,[&horizontal_layout](const auto &b){horizontal_layout->add(b);});
    gui.add(horizontal_layout);
    gui.mainLoop();
    glfwDestroyWindow(window);
}

Made this simple snippet to explain the bug. As you slowly resize the app you can see the borders start to flash and if you stop just at the right moment you can see that the borders are not rendered properly. Resulting in a cheap looking output. This happens more frequently if you have more complex layout on the window.

  • OS: Linux
  • Backend: tried with glfw and SDL, The bug persists.

Observed behavior

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions