1
SFML projects / (Very) small techdemo with sources (threaded OGL rendering)
« on: July 31, 2009, 06:49:20 pm »
Nice work!
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.
Windows XP SP 3.
Edit: Installed the latest driver now, but nothing changed.
Edit2: On a different computer with XP SP 3 and a Radeon X1950 it runs with 64 fps.
Where do the 32/64 frames come from, when I set it to exactly 60?
An easy fix for you:
1/ If the crash is happening at global startup, instanciate your singleton on demand rather than at global startupCode: [Select]class TemplateManager
{
public:
static TemplateManager& instance()
{
static TemplateManager manager;
return manager;
}
};
2/ If the crash is happening at global exit, create a function to free resources so that you can control the moment it is done. In fact you always want to control when your resources are cleaned up, trust me
On big projects with tons of modules handling resources and dependencies everywhere, your (lack of) design would never work.
You shouldn't rely on the initialization order of static or extern variables in different modules because it is undefined.
Are you sure that nothing is accessed before it has been initialized? Check that with your debugger.
And what about destruction ? Sometimes you cannot allow the destruction at an unknown time. You may say there is always a solution but it need more work to do it well.
Another thing about global : using them show that your architecture is badly design.
Conclusion : forget global.
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
struct structure
{
structure() :
font(sf::Font::GetDefaultFont())
{
}
sf::Font font;
};
static structure s_structure;
int main()
{
//===========================================
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");
// Get a reference to the input manager associated to our window, and store it for later use
const sf::Input& Input = App.GetInput();
// Start main loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Escape key : exit
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
// Display window on screen
App.Display();
}
//==================================
return EXIT_SUCCESS;
}
I do have a router though but the other computer is closed
I guess downloading the SVN and compiling it is more or less the same...