SFML community forums

Help => Graphics => Topic started by: Staggy on April 09, 2010, 04:06:56 pm

Title: Huge slowdown when drawing
Post by: Staggy on April 09, 2010, 04:06:56 pm
I'm drawing the background for a pacman clone, using a grid of tiles. Each Tile is a basic structure that holds a pointer to a sf::Sprite. My grid at the moment is 28  by 31 - so 868 sprites drawn each frame. The problem is this absolutely murders the framerate, taking it down from about 80 FPS to about 8.

Am I going about this in the right way, or am I missing the point of sf::Sprite? Or is it something else that I should be changing in my approach? This just seems like too big a slowdown when all I'm doing is drawing the background.
Title: Huge slowdown when drawing
Post by: Mindiell on April 09, 2010, 04:17:41 pm
As usual : It's certainly your main loop that causes this slow down.

Can you put your code here ?
Title: Huge slowdown when drawing
Post by: bullno1 on April 09, 2010, 04:24:40 pm
Try sfml 2.0. 1.x does a lot of useless state change when drawing sprites.
Title: Huge slowdown when drawing
Post by: Staggy on April 09, 2010, 05:21:48 pm
I don't think it's my main loop, as simply commenting out the one line that draws the sprites is enough to get the FPS back up to normal. It all comes down to that one line.

Here's the render code: http://pastebin.com/xw15cqcu
Here's the 'Get': http://pastebin.com/SncrV2zH
Title: Huge slowdown when drawing
Post by: Laurent on April 09, 2010, 06:06:46 pm
Do you test performances in release mode (not in debug)?

What graphics card do you have? Are your drivers up to date?
Title: Huge slowdown when drawing
Post by: Staggy on April 18, 2010, 11:08:59 pm
Damn, sorry for taking so long to reply. Real life has not been forgiving recently.

I'm on an Acer Aspire 1810TZ (netbook). As far as graphics go, it's got the integrated Mobile Intel 4 Chipset, with 1GB video memory.
Title: Huge slowdown when drawing
Post by: Ashenwraith on April 19, 2010, 12:32:43 am
Quote from: "Staggy"
Damn, sorry for taking so long to reply. Real life has not been forgiving recently.

I'm on an Acer Aspire 1810TZ (netbook). As far as graphics go, it's got the integrated Mobile Intel 4 Chipset, with 1GB video memory.


An integrated chipset on a netbook with 1GB vram?

I know I haven't been shopping for laptops in a while, but are you sure about that?

Last I remember Intel integrated chips had crappy driver support for games, but maybe this is new.
Title: Huge slowdown when drawing
Post by: Spodi on April 19, 2010, 01:20:06 am
How about just post a copy of the complete code and/or binaries so others can test it, and we can determine if its your hardware or your code?
Title: Huge slowdown when drawing
Post by: Staggy on April 19, 2010, 09:08:27 am
Quote from: "Ashenwraith"
An integrated chipset on a netbook with 1GB vram?

That's what I think it says - I might be misreading dxdiag.

Quote from: "Spodi"
How about just post a copy of the complete code and/or binaries so others can test it, and we can determine if its your hardware or your code?

I put it into Release to build it, and the damn thing shot up to about 40 FPS.

Still, if it's worth anything here's the binary AND the source code.

http://rapidshare.com/files/377548276/Test.zip.html
Title: Huge slowdown when drawing
Post by: Oz1571 on April 19, 2010, 12:24:15 pm
Quote from: "Ashenwraith"

An integrated chipset on a netbook with 1GB vram?


Unless I'm mistaken, integrated graphics cards usually use the standard "cpu" ram rather than dedicated video ram.