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

Author Topic: Can you loadFromImage to RenderTexture?  (Read 315 times)

0 Members and 1 Guest are viewing this topic.

LordNani

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Can you loadFromImage to RenderTexture?
« on: May 28, 2019, 11:54:51 am »
image.create(windowWidth, windowHeight, sf::Color::White);
sf::RenderTexture canvas;
sf::IntRect area = sf::IntRect(0, 0, image.getSize.x, image.getSize.y);
canvas.getTexture().loadFromImage(image,area);

I need it so I can open and edit images.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32418
    • View Profile
    • SFML's website
    • Email
Re: Can you loadFromImage to RenderTexture?
« Reply #1 on: May 28, 2019, 12:50:11 pm »
The texture of the RT cannot be accessed like this, it's read-only. Instead, load the image into a texture and draw it to your RT with a sprite.
Laurent Gomila - SFML developer