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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Fray

Pages: [1]
Window / Speed issues with Joystick event processing
« on: August 17, 2011, 01:07:30 pm »
Quote from: "Laurent"
Is it slow even if you have no joystick connected?

Does it disappear if you put a "return false" at the beginning of JoystickImpl::IsConnected, in src\SFML\Window\Win32\JoystickImpl.cpp?

It's slow even with no joystick connected, but the problem indeed desappears if JoystickImpl::IsConnected doesn't do the joyGetPosEx() stuff.


Window / Speed issues with Joystick event processing
« on: August 16, 2011, 10:05:09 pm »

I'm still having this weird problem where joystick polling drastically slows down the game (huge fps drop, stuttering, etc). I'm using the basic while loop to poll events, nothing too fancy.
The problem disappears if I comment out the ProcessJoystickEvents() call in WindowImpl.cpp

Chances are it's a problem on my side, but I'm wondering if anyone had experienced the same issue and maybe knows how to resolve it.

Here's what I get after quickly profiling a minimal sfml app:

I'm using win7, lastest SFML2, VS2010


Window / Weird stuttering and freezing
« on: July 28, 2011, 01:08:05 pm »
Quote from: "Jove"
Long shot here, but do you have Task Manager open?

I'll try disabling Aero, just to be sure, since I've already tried nearly everything else.

Edit: Disabling desktop composition seems to fix the problem. But that's not what you can really call "fixing", right?  :D

Another funny thing is that the freezing disappears if I put, for example a video player window, beneath my SFML app (the part of the window which is above the video player gets refreshed, the rest of the window remains frozen).

Window / Weird stuttering and freezing
« on: July 28, 2011, 12:13:39 pm »

My window doesn't seem to refresh correctly  (stuttering / freezing) when I try to display some sprites.
The strange thing is that it only happens when there is between about 2442 and 2507 sprites.
Even stranger, the problem disappears when I use Fraps or some other overlay to display the fps count.

Here's the code:
Code: [Select]

#include <SFML/Graphics.hpp>
#include <vector>

//#define SPRITES 2442
#define SPRITES 2500
//#define SPRITES 2507

#define WIDTH 1024
#define HEIGHT 768

inline float frand(const float min, const float max)
    return ((float(rand()) / float(RAND_MAX)) * (max - min)) + min;

void main()
sf::RenderWindow window(sf::VideoMode(WIDTH, HEIGHT), "Bench");

sf::Image image;
image.LoadFromFile("sprite1.png"); // 64x64
float originX = image.GetWidth() / 2.0f;
float originY = image.GetHeight() / 2.0f;

std::vector<sf::Sprite*> sprites;
for(int i = 0; i < SPRITES; ++i)
sf::Sprite* sprite;
sprite = new sf::Sprite(image);
sprite->SetPosition(frand(0, WIDTH), frand(0, HEIGHT));
sprite->SetOrigin(originX, originY);

sf::Clock timer;
unsigned int lastTime = 0, frameTime = 0, delta = 0;
float step = 1000.0f / 60;

sf::Sprite* sprite;
sf::Event evt;
while (window.IsOpened())
while (window.PollEvent(evt))
if (evt.Type == sf::Event::Closed)
frameTime = timer.GetElapsedTime();
delta = frameTime - lastTime;
if (delta >= step)
lastTime = frameTime;
for (std::vector<sf::Sprite*>::iterator it = sprites.begin(), itEnd = sprites.end(); it != itEnd; ++it)
sprite = *it;


I doesn't look like it's graphics related because the animation "continues" during the freezes.

I'm using SMLF2, static libs, VS 2010, Win7, ATI graphics card.

Thanks in advance  :)

Window / Polling events and setting cursor position thread safety
« on: July 26, 2011, 10:17:36 pm »

I am experiencing the exact same problem here and it looks like it comes from the Joystick event processing.
Commenting ProcessJoystickEvents(); from WindowImpl.cpp seems to "fix" the problem and also drastically improves the framerate.

Unfortunately I'm not knowledgeable enough to investigate the issue further.

SFML2 from github
VS 2010
Win7 x86

Pages: [1]