SFML community forums
Help => General => Topic started by: Jallen on January 22, 2010, 01:06:15 pm
-
Hello.
I've been using SFML for some time now but I'd like a way to start making things like ray tracers and other things which are made by manually accessing and setting the values of pixels in the window.
So really what I want is something like
sf::Color GetPixel(int x, int y);
And
void SetPixel(int x, int y, sf::Color colour);
Is there anything like that?
Many thanks in advance.
-
You have these functions in sf::Image. Then all you have to do is to display your image on screen with a sprite.
If it is not fast enough, the best technique would be to work on your own array of pixels, and update the entire image with a single call to Image::LoadFromPixels (SFML 1.x) or Image::UpdatePixels (SFML 2).
-
Right ok cool, thats the information I needed.
Thanks :D
-
wouldn't it be better to use shaders? Well depends on the effects you're truing to archive I guess