Git Product home page Git Product logo

Comments (4)

Kostu96 avatar Kostu96 commented on May 31, 2024 2

I've found it.
You have to resetGLStates for SFML window, otherwise this happens.

from sfgui.

DrBarbare avatar DrBarbare commented on May 31, 2024

Hi there,

Could you provide a bit more info to help narrow down the cause of your problem?

  • SFML libraries: static/shared and version
  • SFGUI libraries: static/shared (You kind of already provided the version: 0.4.0, I assume compiled with Visual Studio 15 2017, was it 64 bits or 32 bits?)
  • The code that is failing
  • A font file that is failing for you, if possible.

I don't think hardware info would be relevant, however, any compilation warning, OpenGL warnings or else would be welcome.

from sfgui.

Kostu96 avatar Kostu96 commented on May 31, 2024

Ok.
SFML 2.5.1 binary release for Visual Studio 15 32 bit, static
SFGUI 0.4.0, compiled with Visual Studio 15, in 32 bit as static lib.
As for the font, I have used "lato" from google fonts, "arial" from my system, "linden_hill" shipped with sfgui, some random font from web, and of course sfgui default font. They work if I use them in example project, so I doubt it is the matter. Code is almost copy/paste from exemple so the same here. I currently test for my project configuration differences.
The code:
#include <SFML/GpuPreference.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFGUI/SFGUI.hpp>
#include <SFGUI/Desktop.hpp>

class App {
public:
	App();
	void run();
private:
	void handleEvents();
	void update(const sf::Time & dt);
	void render();

	sf::RenderWindow m_renderWindow;
	sfg::SFGUI m_gui;
	sfg::Desktop m_guiDesktop;
};

App::App() : m_renderWindow(sf::VideoMode(1280, 720), "FPS: 0", sf::Style::Close) {
	m_renderWindow.setVerticalSyncEnabled(true);

	m_guiDesktop.SetProperties(
		"Window, Button {"
		"	FontName: assets/fonts/linden_hill.otf;"
		"	FontSize: 24;"
		"}"
	);

	auto guiWindow = sfg::Window::Create();
	guiWindow->SetTitle("This is the window title!");

	auto button = sfg::Button::Create("Hello");

	guiWindow->Add(button);
	m_guiDesktop.Add(guiWindow);
}

void App::run() {
	sf::Clock clock;
	while (m_renderWindow.isOpen()) {
		handleEvents();
		update(clock.restart());
		render();
	}
}

void App::handleEvents() {
	sf::Event e;
	while (m_renderWindow.pollEvent(e)) {
		m_guiDesktop.HandleEvent(e);

		switch (e.type)	 {
		case sf::Event::Closed:
			m_renderWindow.close();
			break;
		}
	}
}

void App::update(const sf::Time & dt) {
	m_guiDesktop.Update(dt.asSeconds());

	// .. stuff updating fps counter ..
}

void App::render() {
	m_renderWindow.clear();
	m_gui.Display(m_renderWindow);
	m_renderWindow.display();
}

And these are errors I'm getting when I close sfml window. I do not get them when closing example.
bez tytulu

EDIT:
I run through project configuration of my project, example project and sfgui project, I checked every compiler and linker switch and problem still occures. I've created new project within cmake generated solution and problem occures also. I'm runnign out of ideas.

from sfgui.

DrBarbare avatar DrBarbare commented on May 31, 2024

Awesome! Glad you figured it out. I also noticed that the samples were chronically sending a lot of GL errors on closing BTW, in my project I solved that by making sure no draw calls were called after the window is closed. (In my case, that meant leaving the main loop after polling event, before updating or drawing.)

from sfgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.