title: SFML Fill Image pixel by pixel
body: <p>The function computePixelColor returns 0xFFFFFF.</p>
  
  <p>It should be white but it is black.</p>
  
  <p>_window is a sf::RenderWindow.</p>
  
  <p>I've read that the texture object stores the color as RGBA.</p>
  
  <p>I can't find what is the error in my following code, any help would be appreciated:</p>
  
  <pre><code>void Window::run(const Parser &amp;parser) {
    sf::Event event;
    sf::Texture texture;
    sf::Vector2u size = _window.getSize();
    std::uint8_t *pixels = new std::uint8_t[4 * size.y * size.x];
    texture.create(size.x, size.y);
    sf::Sprite sprite(texture);
  
    Rt rt(parser.getCamera(), parser.getObjects());
    unsigned int color;
    unsigned int pos;
  
    while (_window.isOpen()) {
      _window.clear();
      pos = 0;
      while (_window.pollEvent(event)) {
        if (event.type == sf::Event::Closed)
          _window.close();
      }
      for (unsigned int y = 0; y &lt; size.y; ++y) {
        for (unsigned int x = 0; x &lt; size.x; ++x) {
          color = rt.computePixelColor(x, y);
          pixels[4 * pos] = (color &gt;&gt; 4) &amp; 0xFF;
          pixels[4 * pos + 1] = (color &gt;&gt; 2) &amp; 0xFF;
          pixels[4 * pos + 2] = color &amp; 0xFF;
          pixels[4 * pos + 3] = 0;
          ++pos;
        }
      }
      texture.update(pixels);
      _window.draw(sprite);
      _window.display();
    }
  }
  </code></pre>