SFML community forums

Help => Graphics => Topic started by: troopson on July 17, 2011, 10:24:32 pm

Title: Strange redrawing. Thats important
Post by: troopson on July 17, 2011, 10:24:32 pm
I wrote that code.
Code: [Select]

sf::RenderWindow w(sf::VideoMode(800,600,32),"a");
w.Clear(sf::Color(255,0,0));
w.SetFramerateLimit(100);
while(true){
w.Display();
cout<<"after disp: "<<endl;
sf::Sleep(1.0f);
}

On my PC everything works fine.
On my Notebook window once displays the red screen(good) and once the OLD BUFFER(which is totally mess). I really need help with that. I can't redraw everything each frame(the program is kinda bigger but its the minimal code).
Title: Strange redrawing. Thats important
Post by: Laurent on July 17, 2011, 10:42:32 pm
SFML is double buffered, and you cleared only one buffer so it's normal that you see the other (uncleared) buffer every two Display().

You must redraw everything every frame. That's how SFML works.
Title: Strange redrawing. Thats important
Post by: troopson on July 17, 2011, 11:09:06 pm
Nooooooooooooooooooooooooo......
I need to draw many,many lines. The solution is OpenGL or sfml 2.0 with drawing to an image, right?
Title: Strange redrawing. Thats important
Post by: Nexus on July 17, 2011, 11:19:04 pm
Before you make your life more complicated than necessary, you should test if the normal draw approach is really too slow. Test in Release mode with enabled optimizations.
Title: Strange redrawing. Thats important
Post by: troopson on July 18, 2011, 02:53:21 pm
Quote from: "Nexus"
Before you make your life more complicated than necessary, you should test if the normal draw approach is really too slow. Test in Release mode with enabled optimizations.

i think 1000+ glbegin() per frame is extremally slow.

I used glOrtho, and then drawing with glBegin(GL_LINES)