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

Author Topic: SFML rendering jerkiness  (Read 2377 times)

0 Members and 1 Guest are viewing this topic.

Timesquare

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML rendering jerkiness
« on: July 14, 2011, 05:10:00 am »
I have compiled the opengl example here.
Code: [Select]
g++ window-opengl.cpp -lGL -lGLU -lsfml-system -lsfml-window

When the example is run a 3d cube is shown devoid of shading. It might appear to rotate nicely for ~10 frames before freezing up. A few seconds later another ~10 frames are show and it freezes again.

I'm running 64-bit Ubuntu 11.04; the problem appear both with libsfml from the ubuntu repositories, and with libsfml compiled from source.

Any ideas on what is happening?


Edit

Interestingly if I add:
Code: [Select]
std::cout << "Time: " << Clock.GetElapsedTime() << std::endl
to the runloop, most of the jerkiness disappears, though it still stutters occasionally.

Timesquare

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML rendering jerkiness
« Reply #1 on: July 14, 2011, 02:19:21 pm »
I have found a solution to the problem, by adding:
Code: [Select]
App.SetFramerateLimit(60);
This removes all stuttering from the display.

I am still interested in learning why this is happening?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML rendering jerkiness
« Reply #2 on: July 14, 2011, 06:46:07 pm »
You can also use sf::Window::UseVerticalSync instead of limiting the frame rate. The effect should be the same.

The «why» is that the application render too fast to be displayed and two images are mixed. You prevent it when limiting the frame rate. There should be better explanation on the Internet than mine; check out vertical synchronizing or alike.
SFML / OS X developer

Haikarainen

  • Guest
SFML rendering jerkiness
« Reply #3 on: July 16, 2011, 10:22:34 am »
Quote from: "Hiura"
There should be better explanation on the Internet than mine; check out vertical synchronizing or alike.


Basically it's like looking at carwheels in motion. As they go faster, it almost looks like they stop for a while, and even faster, they start "rolling backwards". It all depends on how fast your eyes can percieve information/on how fast your screen might display the results.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML rendering jerkiness
« Reply #4 on: July 16, 2011, 10:37:35 am »
You're referring to aliasing which is slightly different. The aliasing problem is that you skip some samples (frames in you car-wheel-example) but here, with the vertical synchronizing problem, two or more frames are mixed and produce a new ugly-'thing'.

I'm a punctilious man.  :P
SFML / OS X developer

Haikarainen

  • Guest
SFML rendering jerkiness
« Reply #5 on: July 16, 2011, 11:08:59 am »
Quote from: "Hiura"
You're referring to aliasing which is slightly different. The aliasing problem is that you skip some samples (frames in you car-wheel-example) but here, with the vertical synchronizing problem, two or more frames are mixed and produce a new ugly-'thing'.

I'm a punctilious man.  :P


Hehe, how do you know THAT isnt happening IRL too ;) Could solve the mystery to why helicopters rotors suddenly disappear when they spin fast..

Frame 1 = Rotor is down, nothing above
Frame 2 = Rotor is up, nothing below

Mixed weirdness = Nothing above, nothing below. I just think we broke the laws of .. philosophy :o

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML rendering jerkiness
« Reply #6 on: July 16, 2011, 11:50:14 am »
Quote from: "Haikarainen"
Hehe, how do you know THAT isnt happening IRL too ;)
Is «I studied aliasing two years ago» a valid answer ?  :roll:
In fact, your brain plays with you when your eyes are not fast enough to catch every frame and makes you see something understandable for you (more or less).

Quote
Mixed weirdness = Nothing above, nothing below.
Have you a picture/video of that ? I can't picture it (never seen this before).
SFML / OS X developer