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

Author Topic: Setting a view causes flickering  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

starstriker1

  • Newbie
  • *
  • Posts: 3
    • View Profile
Setting a view causes flickering
« on: March 22, 2010, 05:39:43 am »
When I added the code to manage the view, the screen in my window began flickering (IE, objects began to flicker black, the background colour). VSync has already been set on the window.

Code: [Select]
void GameManager::render() const
{
// Clear the window
window->Clear();

//Manage view
View view = window->GetDefaultView();
if(viewObject)
{
view.SetCenter(viewObject->getPosition(currentFrameTime));
view.Zoom(viewZoom);
}

window->SetView(view);

//Render all objects
for(list<GameObject *>::const_iterator iter = gameObjects.begin(); iter != gameObjects.end(); iter++)
{
GameObject *obj = (*iter);
obj->render(GetTime(), window);
}

// Display things on screen
window->Display();
}


Anyone know what's causing the flickering?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Setting a view causes flickering
« Reply #1 on: March 22, 2010, 08:12:35 am »
Can you provide a minimal and complete example that reproduces this problem?
Laurent Gomila - SFML developer

starstriker1

  • Newbie
  • *
  • Posts: 3
    • View Profile
Setting a view causes flickering
« Reply #2 on: March 22, 2010, 02:33:40 pm »
Hmm. No, I'm not. I threw almost identical code into a quick test app and was unable to reproduce it. I suspect that I may be doing something wierd. My apologies!

[edit] Yep, just found the problem. Was doing something wierd when calculating the view object's position.