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

Author Topic: Trying to get pixe colors of textures  (Read 1017 times)

0 Members and 1 Guest are viewing this topic.

Lodea

  • Newbie
  • *
  • Posts: 4
    • View Profile
Trying to get pixe colors of textures
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Trying to get pixe colors of textures
« Reply #1 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.
Laurent Gomila - SFML developer

barnack

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: Trying to get pixe colors of textures
« Reply #2 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.

 

anything