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

Author Topic: Image set pixel & Texture update - Nothing happens?  (Read 1322 times)

0 Members and 1 Guest are viewing this topic.

terabin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Image set pixel & Texture update - Nothing happens?
« on: May 23, 2018, 10:24:31 pm »
I'm trying to edit the pixels of a particular image, but the image does not change, it remains the same.

                sf::Vector2u size = internalImage[i].image->getSize();

                for (int x = 0; x < size.x; x++) {
                        for (int y = 0; y < size.y; y++) {
                                internalImage[i].image->setPixel(x, y, sf::Color(0, 0, 0, 255));;
                        }
                }

                internalTexture[t].texture->update(*internalImage[i].image);

Any tips or alternative method?
« Last Edit: May 23, 2018, 10:53:34 pm by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Image set pixel & Texture update - Nothing happens?
« Reply #1 on: May 23, 2018, 10:54:50 pm »
You're setting the image to black and it's not changing to black?

Use a debugger and check that you're picking the right image and texture and render the correct texture, etc.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything