SFML community forums

Help => General => Topic started by: Lodea on August 06, 2018, 10:47:20 pm

Title: Trying to get pixe colors of textures
Post by: Lodea on August 06, 2018, 10:47:20 pm
SFML community, hello.

I'm trying to distort an image (not only scale or rotate).
I thought to do so by getting the colors of pixels of a texture and print them to the screen one by one, though I couldn't figure out how to get the colors of pixels from a texture.
I'd love to know if there's a way to do so, or even preferably if there's another, better way of drawing a distorted image to the screen.

Thanks in advance.
Title: Re: Trying to get pixe colors of textures
Post by: Laurent on August 06, 2018, 10:58:21 pm
A shader would be the best option. See the "shader" example of SFML, it has effects that may inspire you.
Title: Re: Trying to get pixe colors of textures
Post by: barnack on August 07, 2018, 07:19:31 pm
Generally speaking, to access pixels you should use sf::Image, not sf::Texture. That said, runtime image manipulations are a job for your graphics card, hence as Laurent said, use shaders for that.