Hi,
I'm new to SFML and I got some unexpected results running my first test code:
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
const unsigned int width = 200;
const unsigned int height = width;
RenderWindow app(VideoMode(width, height, 32), "");
Image image(width, height);
Sprite sprite(image);
const unsigned int step = 2;
for (unsigned int y = 0; y <= height - step; y += step)
{
for (unsigned int x = 0; x <= width - step; x += step)
{
image.SetPixel(x, y, Color::White);
}
}
app.Draw(sprite);
app.Display();
while (app.IsOpened())
{
Event event;
while (app.GetEvent(event))
{
if (event.Type == Event::Closed)
{
app.Close();
}
}
}
return EXIT_SUCCESS;
}
The resulting image is not what I would expect: the pixels become gray and blurry towards the edges of the image. What is causing this and how can I prevent it? I'm using SFML version 1.5 under Windows 7 64 bit with an ATI Radeon 5770 graphics card with the latest display drivers.
I would like to mix drawing shapes (using sf::Shape::Line, sf::Shape::Circle and sf::Shape::Rectangle) and pixels: draw some shapes, then draw some pixels, draw some more shapes, etc, and then display the results. What is a good approach to draw the pixels in this case?