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]
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.

Cheers

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

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:
http://img703.imageshack.us/img703/9109/sleepyk.png

I'm using win7, lastest SFML2, VS2010

Thanks

3
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?


Nope
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).

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

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
image.SetSmooth(true);
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->SetBlendMode(sf::Blend::Alpha);
sprite->SetPosition(frand(0, WIDTH), frand(0, HEIGHT));
sprite->SetOrigin(originX, originY);
sprites.push_back(sprite);
}

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)
window.Close();
}
frameTime = timer.GetElapsedTime();
delta = frameTime - lastTime;
if (delta >= step)
{
window.Clear();
lastTime = frameTime;
for (std::vector<sf::Sprite*>::iterator it = sprites.begin(), itEnd = sprites.end(); it != itEnd; ++it)
{
sprite = *it;
sprite->Rotate(1);
window.Draw(*sprite);
}
window.Display();
}
}

}


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  :)

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

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
SFML_STATIC
Win7 x86

Pages: [1]