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

Author Topic: drawing sprite is very slow..  (Read 4897 times)

0 Members and 1 Guest are viewing this topic.

krwoong

  • Newbie
  • *
  • Posts: 5
    • View Profile
drawing sprite is very slow..
« on: March 01, 2012, 02:26:19 am »
hellow!

i'm korean ^^;

I can't speak English very well yet.


Code: [Select]

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#pragma comment(lib, "sfml-system-s.lib")
#pragma comment(lib, "sfml-window-s.lib")
#pragma comment(lib, "sfml-graphics-s.lib")

int main()
{
sf::RenderWindow App(sf::VideoMode(317, 528, 32), "GANDI", sf::Style::Close);



sf::Image img;
img.LoadFromFile("korea.png");


sf::Sprite spr;
spr.SetImage(img);
spr.SetPosition(0,0);


while (App.IsOpened())
{
static int mvx, mvy;
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();

if (Event.Type == sf::Event::KeyPressed)
{
if (Event.Key.Code == sf::Key::F12)
{
sf::Image Screen = App.Capture();
Screen.SaveToFile("screenshot.png");
}
}

if(Event.Type == sf::Event::MouseButtonReleased)
{
if(Event.MouseButton.Button == sf::Mouse::Left)
{
}
}

if(Event.Type == sf::Event::MouseMoved)
{
mvx = Event.MouseMove.X;
mvy = Event.MouseMove.Y;
}
}

App.Clear(sf::Color(0, 0, 0));

App.Draw(spr);

App.Display();
}

return EXIT_SUCCESS;
}



I want to draw image. so I found it in tutorial.

Code: [Select]
sf::Image img;
img.LoadFromFile("korea.png");
sf::Sprite spr;
spr.SetImage(img);


and, App.Draw(spr)

i'm not using App.SetFramerateLimit(60).

but, when i run program, fps is "20"!



when delete App.Draw(spr), fps is "900~1000"!...

I don't know what to do..



please help me. :(



I check fps, by "bandicam"

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
drawing sprite is very slow..
« Reply #1 on: March 01, 2012, 03:22:49 am »
Looks to me like SFML 1.6. Any possibility that you have an ATI graphics card? One thing I would suggest, upgrade to SFML 2.0. It is much better(and faster).
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

krwoong

  • Newbie
  • *
  • Posts: 5
    • View Profile
drawing sprite is very slow..
« Reply #2 on: March 01, 2012, 04:55:15 am »
umm..

I use "NVIDIA GeForce 9400 GT"

i try to upgrade to sfml 2.0.

thank you.  :o

krwoong

  • Newbie
  • *
  • Posts: 5
    • View Profile
drawing sprite is very slow..
« Reply #3 on: March 01, 2012, 05:34:58 am »
I try to upgrade to SFML 2.0.

but fps is also "20"...  :(

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
drawing sprite is very slow..
« Reply #4 on: March 01, 2012, 10:13:27 am »
What settings are you using in bandicam. If you're only recording at 20fps then that might just be what it shows. Also remember if you're actually recording with it it'll affect your performance

krwoong

  • Newbie
  • *
  • Posts: 5
    • View Profile
drawing sprite is very slow..
« Reply #5 on: March 01, 2012, 11:48:07 am »
Bandicam program has "fps checker".

i was not recording~

i want to upload image.

but i can't upload...;;

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
drawing sprite is very slow..
« Reply #6 on: March 01, 2012, 12:30:02 pm »
Just to be sure... is it really only SFML? Do other OpenGL apps run fine?

Do you compile your application in release mode for these tests?
Laurent Gomila - SFML developer

mateandmetal

  • Full Member
  • ***
  • Posts: 171
  • The bird is the word
    • View Profile
    • my blog
drawing sprite is very slow..
« Reply #7 on: March 01, 2012, 10:13:19 pm »
Why donĀ“t you create your own fps class?
Something like this example on the wiki:

http://www.sfml-dev.org/wiki/en/sources/fps
- Mate (beverage) addict
- Heavy metal addict _lml
- SFML 2 addict
- My first (and free) game: BichingISH!

krwoong

  • Newbie
  • *
  • Posts: 5
    • View Profile
drawing sprite is very slow..
« Reply #8 on: March 02, 2012, 02:35:06 pm »
yes i run at release mode.


OpenGL app in slowly too;;


I don't know reason;;


I use "Gefore 9400GT"

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
drawing sprite is very slow..
« Reply #9 on: March 02, 2012, 03:02:21 pm »
Quote
OpenGL app in slowly too;;

Which ones have you tried?

If all OpenGL apps are slow, it's definitely a driver issue. Have you tried to update your graphics drivers?
Laurent Gomila - SFML developer

 

anything