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

Author Topic: Strange redrawing. Thats important  (Read 1835 times)

0 Members and 1 Guest are viewing this topic.

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
Strange redrawing. Thats important
« 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).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Strange redrawing. Thats important
« Reply #1 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.
Laurent Gomila - SFML developer

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
Strange redrawing. Thats important
« Reply #2 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?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Strange redrawing. Thats important
« Reply #3 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
Strange redrawing. Thats important
« Reply #4 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)