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

Author Topic: OpenGl, SFML and fps problem :D  (Read 3052 times)

0 Members and 1 Guest are viewing this topic.

Superman

  • Newbie
  • *
  • Posts: 4
    • View Profile
OpenGl, SFML and fps problem :D
« on: October 06, 2009, 05:18:40 pm »
Ok, I'm using OpenGL and SFML for my 3d Scene (C++). So far I've created a simple scene and am able to walk trough it and so on... I've calculated my fps and I want to display it in my window (for example in down left corner)... I don't know how to do it. I create my RenderWindow and use it to display my OpenGL scene, and when i try to use it to display any text on it with App.Draw(Text), the whole scene is gone, and all I see in my window is text and background. Is there a way to tell sfml that I only want to display text rather than text and black background (that completly covers my scene)?

Tnx for any advice. I'm new to SFML and I'm loving it so far... :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGl, SFML and fps problem :D
« Reply #1 on: October 06, 2009, 05:27:32 pm »
In SFML 1.5, you have to call window.PreserveOpenGLStates(true) once at the beginning of your program.
Laurent Gomila - SFML developer

Superman

  • Newbie
  • *
  • Posts: 4
    • View Profile
OpenGl, SFML and fps problem :D
« Reply #2 on: October 06, 2009, 06:13:07 pm »
That is what I'm looking for, tnx... But it splits my fps in half. Is it possible that a little bit of text is so demanding?

One more thing, I'm getting an unhandled exception when using sf::String even though I'm using my font from hard drive...

Tnc for a quick response... :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGl, SFML and fps problem :D
« Reply #3 on: October 06, 2009, 06:17:29 pm »
Quote
That is what I'm looking for, tnx... But it splits my fps in half. Is it possible that a little bit of text is so demanding?

This is the simple solution, which saves and restores all OpenGL states every time you call window.Draw(text). So yes it can be slow.
You can do much better, by saving and restoring yourself only the states that you need.

Quote
One more thing, I'm getting an unhandled exception when using sf::String even though I'm using my font from hard drive...

There must be a default constructed sf::String somewhere ;)

Note that both of these issues are completely solved in SFML 2.
Laurent Gomila - SFML developer

Superman

  • Newbie
  • *
  • Posts: 4
    • View Profile
OpenGl, SFML and fps problem :D
« Reply #4 on: October 07, 2009, 12:54:42 pm »
Tnx again for help... When is SFML 2 going to be published?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGl, SFML and fps problem :D
« Reply #5 on: October 07, 2009, 02:08:23 pm »
I don't know yet, you can have a look at the task tracker to get an idea of what has to be done before the release.
Laurent Gomila - SFML developer

 

anything