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 - kurozael

Pages: [1]
1
Graphics / Loading a TFF with sf::Font and rendering in 3D with OpenGL?
« on: August 12, 2011, 01:31:03 pm »
Would you be able to add the ability to render sf::Text without preserving states or whatever.

So that we could render it at a 3D location, or a 2D location on the screen but at any point during our OpenGL drawing.

I'm simply only using SFML for window management, input and fonts. Thanks a bunch.

2
Is this possible? How would I go about doing it. My reasoning for this is that I'd rather use SFML's font loading for TTF's than write my own or get some other external lib.

Thanks!

3
Window / Window.GetFrameTime is returning strange values
« on: July 24, 2011, 01:57:06 pm »
Sorry, this was an unexpected change! Thanks a lot man!

4
Window / Window.GetFrameTime is returning strange values
« on: July 24, 2011, 01:46:19 pm »
I've recently upgraded SFML2 to the latest revision and now my simultation runs extremely fast and GetFrameTime returns "15" - "16" so when I calculate FPS by doing 1.0f / GetFrameTime() I'm getting "FPS" of 0.0666666667 so as you can tell something is seriously wrong.

I've still doing SetFramerateLimit(60.0f)

I have a project due in Tuesday at uni so I hope you can help!

Thanks!  :P

5
Fixed by this:

Code: [Select]

static T* m_pInstance =  0;
if (!m_pInstance)
m_pInstance = new T;

return m_pInstance;


(Creating it on the heap).

Thanks for your help!

6
Okay yeah the "magic static place" is causing the crash, any ideas?

Code: [Select]

#include <SFML/Graphics.hpp>

class Test
{
public:
static Test* Instance();
Test() {};
~Test() {};
void Blah();
sf::RenderWindow m_window;
};

Test* Test::Instance()
{
static Test* test;
return test;
}

void Test::Blah()
{
m_window.Create(
sf::VideoMode(800, 600, 32), "Game",
sf::Style::Titlebar | sf::Style::Close
);
}

int main()
{
Test* lol = Test::Instance();

while ( lol->m_window.IsOpened() )
{
sf::Event windowEvent;

while ( lol->m_window.PollEvent(windowEvent) )
{
if (windowEvent.Type == sf::Event::Closed)
lol->m_window.Close();
}

lol->m_window.Clear();
lol->m_window.Display();
}

return 0;
}

7
Code: [Select]

class Test
{
public:
Test() {};
~Test() {};
void Blah();
sf::RenderWindow m_window;
};

void Test::Blah()
{
m_window.Create(
sf::VideoMode(800, 600, 32), "Game",
sf::Style::Titlebar | sf::Style::Close
);
}

int main()
{
Test lol;

lol.Blah();

while ( lol.m_window.IsOpened() )
{
sf::Event windowEvent;

while ( lol.m_window.PollEvent(windowEvent) )
{
if (windowEvent.Type == sf::Event::Closed)
lol.m_window.Close();
}

lol.m_window.Clear();
lol.m_window.Display();
}

return 0;
}


Works fine... so could it be that storing sf:: objects such as RenderWindow or Image within a class that is stored in the "magic static place" e.g: my singleton Engine class causes the crash/memory violation error?

If so, can this be fixed?

8
Quote from: "Laurent"
Does the following code produce the same crash?
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::Image image;
    image.Create(10, 10);

    return 0;
}


Nope, like I said my problem seems to be when sf::Image is a class member variable.

9
Quote from: "Laurent"
Which revision of SFML 2 are you using?


LaurentGomila-SFML-df68742 (SFML 2.0 Snapshot)

but to re-iterate I had the same problem with SFML 1.6.

10
Code: [Select]

int main(int argc, char** argv)
{
Engine* engine = Engine::Instance();
engine->Init();

    return EXIT_SUCCESS;
}



11
Okay, let me clear a few things up:

- I've compiled for VS 2010, and am dynamically linking.
- I have all the VS 2010 compiled .dlls in the distro dir.
- I have all the VS 2010 compiled .libs linked to the project.
- I am only linking to debug libs in Debug mode, and same for release.



I have tried with both 1.6 and 2.0. I can get everything to compile and run fine, I have my window, and my 3D OpenGL cubes and spheres spinning about contently.

However:

When I want to have, say, an sf::Image as a member variable of a class (Engine, in the above picture), and then I call something like... say... LoadFromFile on it, I get an unhandled exception/access violation error when I run the executable.





Please help me somebody, I need to get this working ASAP for my university course and I'm tearing my hair out.

It would do the same thing if it were an sf::RenderWindow I was to have as a member variable.

Please don't moan at me for not searching the forum, or Google, because I assure you I've been searching the net for the past 4 hours straight and I have like 28 tabs open because of it. Yet I haven't fixed my problem.

Thank you.

Pages: [1]