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

Author Topic: Black line sometimes appears when moving view  (Read 1261 times)

0 Members and 1 Guest are viewing this topic.

Unearthly

  • Newbie
  • *
  • Posts: 1
    • View Profile
Black line sometimes appears when moving view
« on: November 24, 2012, 12:30:46 am »
Hi,

I've just started using SFML 2.0RC and I've encountered a small problem when moving my view. Here is my view move code, which is simply adapted from the 1.6 tutorial:

Code: [Select]
if ( elapsed_time > 1/100.0f )
{
// Move the view using arrow keys
float Offset = 800.f * elapsed_time;
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))    view.move( 0,      -Offset);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))  view.move( 0,       Offset);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))  view.move(-Offset,  0);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) view.move( Offset,  0);

It's set to only run at 100 FPS, because if it gets too high view.move just does nothing (even with non-zero numbers).

When holding the key to constantly move, you can occasionally see a black vertical line on the screen. Usually it does not stay, but I managed to stop the view while it was visible. This screenshot was taken while the view was not moving.

http://i.imgur.com/GNBYC.png

Is there something I might be doing to cause this? Right now my sprite code is very simple, I'm just setting their position once and drawing them each frame.

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
Re: Black line sometimes appears when moving view
« Reply #1 on: January 19, 2013, 10:02:12 pm »
100 fps is.. alot.. 60 fps is what the human eye is generally capable of noticing, so unless your superhuman.. but nvm that, try enabling vertical sync, your problem might be that your displaying a frame before it can buffer, which vertical sync will fix
Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

 

anything