1
Graphics / creating a texture through code
« on: January 13, 2021, 04:44:04 am »
is there a way to create a blank texture with a set size, then access the pixels in the texture to set them?
something similar to the fallowing. (I specifically need the texture to be a pointer)
sf::Texture* texture;
texture = new sf::Texture;
texture->setSize(100, 100);
for (int y = 0; y < 100; y++)
{
for (int x = 0; x < 100; x++)
{
texture->setPixel(sf::Color(127, 127, 127);
}
}
something similar to the fallowing. (I specifically need the texture to be a pointer)
sf::Texture* texture;
texture = new sf::Texture;
texture->setSize(100, 100);
for (int y = 0; y < 100; y++)
{
for (int x = 0; x < 100; x++)
{
texture->setPixel(sf::Color(127, 127, 127);
}
}