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

Author Topic: image tearing???  (Read 11819 times)

0 Members and 1 Guest are viewing this topic.

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« on: August 26, 2009, 09:52:39 am »
my game's sprites at time's tear

as seen here: (note his head)



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

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
VSync fixes Tearing
« Reply #1 on: August 27, 2009, 12:41:41 am »
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.
I use the latest build of SFML2

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« Reply #2 on: August 27, 2009, 09:03:38 am »
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

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
image tearing???
« Reply #3 on: August 28, 2009, 03:15:10 am »
Quote from: "Dinocool"
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.
I use the latest build of SFML2

Jaenis

  • Newbie
  • *
  • Posts: 48
    • View Profile
image tearing???
« Reply #4 on: August 28, 2009, 04:44:41 am »
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)

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« Reply #5 on: August 28, 2009, 05:24:45 am »
If you havent realised, there is no image smoothing.

and you why cant i have frame limit AND vsync?

Core Xii

  • Jr. Member
  • **
  • Posts: 54
    • MSN Messenger - corexii@gmail.com
    • AOL Instant Messenger - Core+Xii
    • View Profile
image tearing???
« Reply #6 on: August 28, 2009, 11:33:04 am »
To my understanding you can't vsync a windowed application, it has to be fullscreen.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
image tearing???
« Reply #7 on: August 28, 2009, 01:13:46 pm »
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.
Want to play movies in your SFML application? Check out sfeMovie!

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« Reply #8 on: August 28, 2009, 01:29:11 pm »
thanks for that tip, and i've now disabled vsync, but alas there still is the issue of tearing...

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
image tearing???
« Reply #9 on: August 28, 2009, 01:35:13 pm »
Did you have the tearing with vertical synchronisation enabled ?
Want to play movies in your SFML application? Check out sfeMovie!

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« Reply #10 on: August 28, 2009, 01:42:04 pm »
yeppers, plus a massive ammount of cpu usage.

would switching to the latest 2.0 beta help?

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
image tearing???
« Reply #11 on: August 28, 2009, 01:59:50 pm »
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 ?
Want to play movies in your SFML application? Check out sfeMovie!

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« Reply #12 on: August 28, 2009, 02:00:52 pm »
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

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
image tearing???
« Reply #13 on: August 28, 2009, 02:02:53 pm »
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.
Want to play movies in your SFML application? Check out sfeMovie!

Dinocool

  • Newbie
  • *
  • Posts: 24
    • View Profile
image tearing???
« Reply #14 on: August 28, 2009, 02:09:43 pm »
aww ok, well do you think it could be that the x and y are at decimal positions?

 

anything