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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - KilledWhale

Pages: [1]
1
Window / Checking when window is ready for drawing
« on: January 07, 2012, 04:50:11 pm »
Following code draws the line as it should but without the sleep(1); it doesn't display a thing. Not even a black background.

Is some part of window initialization done asynchronously?

Happens at least on linux x64.

I wonder if there's any way to check if the window's ready for drawing or not because this solution seems kinda hacky.

Discovered the issue when I was trying to draw sierpinski triangle line-by-line without clearing the screen between each line drawing.

Code: [Select]
#include <stdint.h>
#include <iostream>
#include <SFML/Graphics.hpp>

int main() {
  sf::RenderWindow window(sf::VideoMode(800, 800), "");

  sleep(1);
 
  sf::Vertex points[2];
  points[0].Position.y = 50;
  points[0].Position.x = 50;
  points[1].Position.y = 400;
  points[1].Position.x = 500;

  window.Draw(points, 2, sf::Lines);
  window.Display();
 
  sleep(500);

  return 0;
}

Pages: [1]
anything