SFML community forums
Help => Graphics => Topic started by: Dinocool on August 26, 2009, 09:52:39 am
-
my game's sprites at time's tear
as seen here: (note his head)
(http://img38.imageshack.us/img38/3433/squeebscreen1.png)
the tearing only occurs when he is standing still. also note that the head sprite does not change (the head is a different sprite). what could be the cause of this? i was wondering if was to do with float point decimal positions. i.e x = 3.5 or something
-
Tearing is usually caused by the Game trying to update the screen while the screen is already updating. Try enabling VSync through the Window Class.
-
VSYNC is on, as is frame limit 60 fps
i tried disabling vsync, then frame limit, and then frame limit AND vsync to no avail
-
VSYNC is on, as is frame limit 60 fps
i tried disabling vsync, then frame limit, and then frame limit AND vsync to no avail
You can't have both Framerate Limit and VSync on at the same time.
-
That could just be scaling and those decimal coordinates you mentioned.
Try setting Image.SetSmooth(false); for images and see if it does anything. (if I remember correctly that was set to true by default)
-
If you havent realised, there is no image smoothing.
and you why cant i have frame limit AND vsync?
-
To my understanding you can't vsync a windowed application, it has to be fullscreen.
-
For sure you can.
But the problem with enabling both synchronisation and framerate limit is that you may lose much FPS.
Imagine your screen has a refresh rate of 60Hz. You set the framerate limit to 60. If everything goes very well, the screen will be refreshed 60 times per second. But if your app comes to late for the next frame, it'll skiped, but you app must wait for the next screen update. You missed one frame, meanning one frame out of 2 with 60 supposed frames per second => 30 FPS. And if your program is again too slow, it goes to 15 FPS, 7.5 FPS, etc.
Actually this will happen even if you don't set any framerate limit. But if you disable vertical synchronisation, these "steps", you can have FPS between 30 and 60 for example.
-
thanks for that tip, and i've now disabled vsync, but alas there still is the issue of tearing...
-
Did you have the tearing with vertical synchronisation enabled ?
-
yeppers, plus a massive ammount of cpu usage.
would switching to the latest 2.0 beta help?
-
I don't think so. If you have tearing even with vertical synchronisation enabled, it is not normal. Is it possible to get the sources to try out your program ?
-
i dont really wanna release the source, as it contains passwords .ect
if you want you can try the game out at http://squeebs.coderzilla.com/game/squeebsrev3.rar
-
I'm using Mac OS X. If you don't want to release your sources, release the sources for a minimal program reproducing the problem.
-
aww ok, well do you think it could be that the x and y are at decimal positions?
-
Hi
You can try the SVN version (either trunk of sfml2), I made a fix for that.
Otherwise if you don't mind disabling bilinear filtering, you can use image.SetSmooth(false).
-
Ok, will do laurent
just a heads up though, i dont use image smoothing, its FUGLY. specially for a sprite based pixel game. anyways i'll see what the sfml2 does for me
-
ok, this fixed the problem. but on another random note, my background which is 1px wide and 800 high, when stretched chages its origin by 100px, odd