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

Author Topic: The new graphics API in SFML 2  (Read 74148 times)

0 Members and 1 Guest are viewing this topic.

Mikademus

  • Newbie
  • *
  • Posts: 31
    • View Profile
The new graphics API in SFML 2
« Reply #165 on: November 08, 2011, 03:42:20 pm »
Since Font and Text was separated, this might also be the time to introduce a much needed extension to text styles. Especially outline colours but also shadows would be extremely appreciated additions.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
The new graphics API in SFML 2
« Reply #166 on: November 08, 2011, 03:55:47 pm »
Quote
Anyway I think that all 2.0 compliant drivers will support the extension since that is the dependency and we can only trust that. Because according to OpenGL it has officially supported Instancing since 3.0 (but the extension was created in 2.0).

A dependency on 2.0 doesn't mean that anything which supports 2.0 will have this extension too. The only way to see how an extension is supported is to use this kind of software.

Quote
You can fake instancing on the CPU and still get big GPU/CPU performance boost

How would you do that?

Quote
Since Font and Text was separated, this might also be the time to introduce a much needed extension to text styles. Especially outline colours but also shadows would be extremely appreciated additions.

I can't implement that easily.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
The new graphics API in SFML 2
« Reply #167 on: November 08, 2011, 04:29:17 pm »
Quote
How would you do that?


It's not pretty, but it's how they originally did it before hardware support came. But I have to kind of go trough the basics of how instancing works in order to explain how I think. IF you are interested I could send it in a private message instead of bloating it here?

Any how this will not be implemented for SFML2 then. And faking it on the CPU can be done without SFML doing anything special behind the scene.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
The new graphics API in SFML 2
« Reply #168 on: November 08, 2011, 04:33:25 pm »
Quote
IF you are interested I could send it in a private message instead of bloating it here?

Yes please :)
Laurent Gomila - SFML developer

Mikademus

  • Newbie
  • *
  • Posts: 31
    • View Profile
The new graphics API in SFML 2
« Reply #169 on: November 08, 2011, 04:45:01 pm »
Quote from: "Laurent"

Quote
Since Font and Text was separated, this might also be the time to introduce a much needed extension to text styles. Especially outline colours but also shadows would be extremely appreciated additions.

I can't implement that easily.

What would be required, or are there particular problems associated with font rendering?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
The new graphics API in SFML 2
« Reply #170 on: November 08, 2011, 04:56:15 pm »
Quote
What would be required, or are there particular problems associated with font rendering?

Fonts glyphs are pre-rendered, that's why effects are hard to achieve. Glyphs already come in two versions: bold and regular, which doubles the amount of video memory that sf::Font requires; I can't add more overhead.

In the future I might be able to add new effects, when text rendering will be rewritten to use shaders and distance fields.
Laurent Gomila - SFML developer

Mikademus

  • Newbie
  • *
  • Posts: 31
    • View Profile
The new graphics API in SFML 2
« Reply #171 on: November 08, 2011, 05:09:37 pm »
Aah, ok, that explains it. Thanks for the explanation.

A thought: since creating a large set of textures with all combinations of styles is obviously unrealistic, an alternative possibility might be to request the creation of a font texture with a given (user-specified) combination of styles when a typeface is loaded. A specialised typeface like that would of course not be able to take any other styles, but it would solve principally all problems and satisfy all usage scenarios I can think of, as well as actually reduce memory footprint when only a particular style is needed.

The drawback of this solution is of course that colours would need to be part of the requested style.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
The new graphics API in SFML 2
« Reply #172 on: November 08, 2011, 07:15:54 pm »
Alright I sent you a very LOOOOOONG message about instancing now :)
I tried to cut as many corners as possible and forced myself not to give you complete code examples to demonstrate what I mean, else I might had broken some buffer in PHP by the shear amount of text :twisted:
If anyone else want's it then just let me know and I'll PM it to you as well.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Ricky

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Tejada
    • Email
The new graphics API in SFML 2
« Reply #173 on: November 09, 2011, 12:14:32 am »
Quote from: "Groogy"
Alright I sent you a very LOOOOOONG message about instancing now :)
I tried to cut as many corners as possible and forced myself not to give you complete code examples to demonstrate what I mean, else I might had broken some buffer in PHP by the shear amount of text :twisted:
If anyone else want's it then just let me know and I'll PM it to you as well.


me  :o
Wilt thou yet say before him that slayeth thee, I am God? but thou shalt be a man, and no God, in the hand of him that slayeth thee.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
The new graphics API in SFML 2
« Reply #174 on: November 09, 2011, 01:41:13 am »
Done ;)
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
The new graphics API in SFML 2
« Reply #175 on: November 09, 2011, 07:36:16 am »
Quote
A thought: since creating a large set of textures with all combinations of styles is obviously unrealistic, an alternative possibility might be to request the creation of a font texture with a given (user-specified) combination of styles when a typeface is loaded. A specialised typeface like that would of course not be able to take any other styles, but it would solve principally all problems and satisfy all usage scenarios I can think of, as well as actually reduce memory footprint when only a particular style is needed.

That's a possible solution. But like I said, text rendering will probably be rewritten soon and allow much more flexibility, so it's not worth changing it now :)

Quote
Alright I sent you a very LOOOOOONG message about instancing now

Thanks :D
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
The new graphics API in SFML 2
« Reply #176 on: November 09, 2011, 11:22:53 am »
Quote from: "Laurent"
But like I said, text rendering will probably be rewritten soon and allow much more flexibility, so it's not worth changing it now :)

Will it get faster, too? sf::Text is the main framerate dropper in SFGUI applications. ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
The new graphics API in SFML 2
« Reply #177 on: November 09, 2011, 01:13:17 pm »
Quote
Will it get faster, too? sf::Text is the main framerate dropper in SFGUI applications.

It should already be much faster with the new graphics API of SFML 2.0 -- as long as the text doesn't change every frame.

Distance fields, if I implement them in the future, should not improve performances that much. The main benefit of this technique is that you need only a single texture to store the glyphs for every possible size -- compared to one texture per size now.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
The new graphics API in SFML 2
« Reply #178 on: November 09, 2011, 03:18:21 pm »
Is that comparible to texture atlases?

Any chance that you push your current progress to the SFML experimental repository? I wouldn't mind if it doesn't build at all.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
The new graphics API in SFML 2
« Reply #179 on: November 09, 2011, 03:22:49 pm »
...if you mean SFML2's current state, here's what a simple benchmark shows:



We did play around with caching texts into render textures, which (of course) boosted everything up at the cost of video memory. So are there optimizations for the new 2.0 API or are they already included?

 

anything