SFML community forums

Help => Graphics => Topic started by: starstriker1 on March 22, 2010, 05:39:43 am

Title: Setting a view causes flickering
Post by: starstriker1 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?
Title: Setting a view causes flickering
Post by: Laurent on March 22, 2010, 08:12:35 am
Can you provide a minimal and complete example that reproduces this problem?
Title: Setting a view causes flickering
Post by: starstriker1 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.