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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - JonnyLaw

Pages: [1]
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);
    }
}

Pages: [1]
anything