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

Author Topic: Huge slowdown when drawing  (Read 5068 times)

0 Members and 1 Guest are viewing this topic.

Staggy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Huge slowdown when drawing
« 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.

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Huge slowdown when drawing
« Reply #1 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 ?
Mindiell
----

bullno1

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Huge slowdown when drawing
« Reply #2 on: April 09, 2010, 04:24:40 pm »
Try sfml 2.0. 1.x does a lot of useless state change when drawing sprites.

Staggy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Huge slowdown when drawing
« Reply #3 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Huge slowdown when drawing
« Reply #4 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?
Laurent Gomila - SFML developer

Staggy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Huge slowdown when drawing
« Reply #5 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.

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Huge slowdown when drawing
« Reply #6 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.

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Huge slowdown when drawing
« Reply #7 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?

Staggy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Huge slowdown when drawing
« Reply #8 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

Oz1571

  • Newbie
  • *
  • Posts: 28
    • View Profile
Huge slowdown when drawing
« Reply #9 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.

 

anything