garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
428 stars 102 forks source link

SFML2 Renderer #42

Closed voodooattack closed 11 years ago

voodooattack commented 11 years ago

New SFML2 renderer with a VertexBuffer object, speed is on par with the DX/OpenGL renderers. Also fixes the clipping problems with the original SFML 1.6 version and the window is fully sizeable.

Other changes: Cleaned the old SFML renderer/sample from SFML 2 code. Fixed build scripts on Linux (still need to identify what libraries exist on system)

ananace commented 11 years ago

I'm going to take a guess that it's still horribly slow at drawing the colour picker?

voodooattack commented 11 years ago

Well, it's using glPoints (sf::Points) to draw it, not optimal but by no means slow either. (~190 FPS on my machine)

Screenshot from 2013-02-14 21:25:28

ananace commented 11 years ago

That's actually impressive, when I tried speeding up that part using a sf::Point vertex buffer it still only ran at around 19FPS.

voodooattack commented 11 years ago

Not sure what I did differently, but my implementation collects all drawing calls up to the point where the primitive type or the texture changes (or if clipping occurs), at which point it flushes the buffer and draws to screen. In the case of points they're all collected from the ColorPicker's loop in one go as a single batch I think.

ananace commented 11 years ago

Mine only batched it in series of nine pixels I think, can't remember exactly why but there was a reason. I did manage to create a much faster way of drawing it by adding a pair of GWEN functions though, StartImage and EndImage. They'd be used before drawing a set of loose pixels if the pixels were to be part of an image anyway, which let me use direct pixel access on an sf::Image. Which in turn made the color picker draw just as fast as any other control.