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

Author Topic: New graphics API ready  (Read 92446 times)

0 Members and 2 Guests are viewing this topic.

Delarock

  • Newbie
  • *
  • Posts: 5
    • View Profile
New graphics API ready
« Reply #210 on: January 20, 2012, 03:11:38 pm »
Hello, I asked about a half year ago.

Quote

Is it possible to use debug mode, but do not debug graphics code (or what is it making so slow) ?

 I use text/graphics a lot in my project, and that drops my FPS to 1-2 in debug mode, but 60+ in release. I of course would like to debug my actual "working" code and not SFML graphic library (which is working fine  ).


and got this answer from Laurent

Quote

The new graphics API should be much faster in debug mode, there could even be almost no difference.


So my question now, is it already that fast? :)
And how much faster do you think it is?
I don't have good code for compare now, so I cant test it.

Thanks

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
New graphics API ready
« Reply #211 on: January 20, 2012, 04:10:53 pm »
Just test it. Also had a massive slowdown when run using GDB while working with many instances of std::set while rendering sf::Text. Could be another reason.

Delarock

  • Newbie
  • *
  • Posts: 5
    • View Profile
New graphics API ready
« Reply #212 on: January 20, 2012, 06:11:39 pm »
I asked, because I dont have code for that I did before and I dont have SFML compiled and that stuff...
I just only want to know if its faster than 1.6 already and if debug FPS almost == release FPS. Or if I should wait more, before using SFML again.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #213 on: January 20, 2012, 06:12:18 pm »
The new graphics API is not better in debug mode, but it allows you to do better things.

Example:
- if I draw 10000 individual sprites with sf::Sprite, I can get 50 FPs in release and 1 FPS in debug because there are 10000 OpenGL calls involved
- if I draw 10000 sprites with a single sf::VertexArray, I can get 350 FPS in both release and debug mode because there is 1 OpenGL call involved, it's the GPU which is busy not the CPU anymore
Laurent Gomila - SFML developer

Delarock

  • Newbie
  • *
  • Posts: 5
    • View Profile
New graphics API ready
« Reply #214 on: January 20, 2012, 06:21:09 pm »
Ah, thanks.

Never used sf::VertexArray because sf::Sprite is kind of easy for use, hope that vertex array too...
I am not sure if I understand well, but couldn't the (almost) same fps be achieved by using release versions of SFML libraries in debug mode? (guess it wont work that way :/).
Or something like that? Like "I trust SFML, debug only my code"?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #215 on: January 20, 2012, 06:37:07 pm »
You can generally not mix debug and release. For example, Visual C++ has a different definition for STL classes in debug and release mode, so if you pass a std::string from your app (debug definition) to SFML (release definition) it will crash.
Laurent Gomila - SFML developer

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
New graphics API ready
« Reply #216 on: January 25, 2012, 04:33:54 pm »
Shader's doc says:

Quote
To apply a shader to a drawable, you must pass it as an additional parameter to the Draw function:

Code: [Select]
window.Draw(sprite, shader);

... which is in fact just a shortcut for this:

Code: [Select]
sf::RenderStates states;
states.Shader = shader;
window.Draw(sprite, states);



But I can't find a Draw(drawable, shader) method in RenderWindow or RenderTarget. Am I missing something?
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #217 on: January 25, 2012, 05:06:34 pm »
Yes: the RenderStates(sf::Shader*) implicit constructor. A sf::RenderStates can be implicitely constructed from any of its members.
Laurent Gomila - SFML developer

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
New graphics API ready
« Reply #218 on: January 25, 2012, 05:45:54 pm »
Thanks.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
New graphics API ready
« Reply #219 on: January 25, 2012, 07:04:23 pm »
test.GetGlobalBounds()

Does not take end white space in to account and trims it?

and height seems to be wrong by half..

AM I right that it should return width and height of displayed text?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #220 on: January 25, 2012, 07:12:34 pm »
Quote
test.GetGlobalBounds()

Does not take end white space in to account and trims it?

http://www.sfml-dev.org/forum/viewtopic.php?t=6672

Quote
and height seems to be wrong by half..

Really? Can you show a complete and minimal code that reproduces this problem?
Laurent Gomila - SFML developer

BlueMagic

  • Newbie
  • *
  • Posts: 49
    • View Profile
New graphics API ready
« Reply #221 on: January 25, 2012, 07:21:03 pm »
Just to be clear, the optimized version is not out yet, right?

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
New graphics API ready
« Reply #222 on: January 25, 2012, 08:23:09 pm »
Quote from: "Laurent"
Quote
test.GetGlobalBounds()

Does not take end white space in to account and trims it?

http://www.sfml-dev.org/forum/viewtopic.php?t=6672

Quote
and height seems to be wrong by half..

Really? Can you show a complete and minimal code that reproduces this problem?


eek, sorry, all tests show it does come back with the same height as shapes drawn next door.

Using gwen, it returns an odd height, but I can fix it be using the height of the font,and knowing no new lines will be used....but I cant get the correct width, because of spaces. + using a fixed font.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
New graphics API ready
« Reply #223 on: January 25, 2012, 10:58:07 pm »
Quote
Just to be clear, the optimized version is not out yet, right?

It is.
Laurent Gomila - SFML developer

BlueMagic

  • Newbie
  • *
  • Posts: 49
    • View Profile
New graphics API ready
« Reply #224 on: January 25, 2012, 11:16:56 pm »
Quote from: "Laurent"
Quote
Just to be clear, the optimized version is not out yet, right?

It is.


Amazing, I will be starting the transition then.

 

anything