SFML community forums

Help => General => Topic started by: LordNani on May 28, 2019, 11:54:51 am

Title: Can you loadFromImage to RenderTexture?
Post by: LordNani 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.
Title: Re: Can you loadFromImage to RenderTexture?
Post by: Laurent 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.