You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In windowed mode all run fine, smooth, without any flickering. But in fullscreen, everytime I destroy a rendertexture, or a entity that stores a rendertexture, because I don't gonna use it anymore, the flicker appears.
For 1-2 frames, the screen goes black and then return to normal. Trying to reproduce this problem, I've discovered what causes this comportament but not why.
In the following code, I find that when a RenderTexture is destroyed (out of scope/delete), the problem appears.
My specs are Win 7 64 bits, Nvidia 560Ti (driver version 320.49 WHQL), i5 2500k.
As Laurent says: "This is caused by a call to DestroyWindow in the destructor of WglContext"
#include<iostream>
#include<SFML\Graphics.hpp>
#include<SFML\Window.hpp>intmain()
{
sf::RenderWindow App(sf::VideoMode(640, 480, 32), "SFML Test", sf::Style::Fullscreen);
App.setFramerateLimit(60);
sf::RectangleShape rect(sf::Vector2f(300,300));
rect.setFillColor(sf::Color::White);
rect.setPosition(170, 100);
sf::RenderTexture *tex_ptr = NULL;
while (App.isOpen())
{
sf::Event Event;
while (App.pollEvent(Event))
{
// Close Windowif (Event.type == sf::Event::Closed)
return1;
if (Event.type == sf::Event::KeyPressed)
{
// Exitif (Event.key.code == sf::Keyboard::Escape)
return1;
// Each time F1 is pressed, screen goes black in some sort flickeringif (Event.key.code == sf::Keyboard::F1)
{
sf::RenderTexture tex;
tex.create(200,200);
}
// Each time F2 is pressed, screen goes black in some sort flickeringif (Event.key.code == sf::Keyboard::F2)
{
tex_ptr = newsf::RenderTexture();
tex_ptr->create(200,200);
delete tex_ptr; // if this line is commented, does not flick
}
}
}
App.clear();
App.draw(rect);
App.display();
}
return0;
}
The text was updated successfully, but these errors were encountered:
There have been changes to SFML's context management and other parts as well as new drivers for Nvidia cards in the past year, as such it be interesting to hear if this is still an issue and if someone else besides @mazellan can confirm this.
This is because SFML uses dummy windows to create OpenGL contexts in Windows, as can be seen here. This probably won't be fixed until context management is redone in SFML 3. A more or less simple workaround for this is to keep a pool of sf::RenderTextures around and just reuse them when necessary. Don't create and destroy them when unnecessary, they are already a heavy resource to begin with.
In windowed mode all run fine, smooth, without any flickering. But in fullscreen, everytime I destroy a rendertexture, or a entity that stores a rendertexture, because I don't gonna use it anymore, the flicker appears.
For 1-2 frames, the screen goes black and then return to normal. Trying to reproduce this problem, I've discovered what causes this comportament but not why.
In the following code, I find that when a RenderTexture is destroyed (out of scope/delete), the problem appears.
My specs are Win 7 64 bits, Nvidia 560Ti (driver version 320.49 WHQL), i5 2500k.
As Laurent says: "This is caused by a call to DestroyWindow in the destructor of WglContext"
For more info this is a link to the forum post.
http://en.sfml-dev.org/forums/index.php?topic=12324.0
The text was updated successfully, but these errors were encountered: