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.


Messages - xion911

Pages: [1]
1
Graphics / Re: Texture Alpha Channel Transparency
« on: July 15, 2015, 09:19:04 am »
Just set up this quick test and got the same result. I must be missing something. Here is the image I am using in case that helps. https://www.dropbox.com/s/u2sqtf73hpvx3k0/alphaTest.png?dl=0
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
        sf::RenderWindow App(sf::VideoMode(1920, 1080), "Test");

        sf::Texture image;
        sf::Sprite logo;

        if (!image.loadFromFile("assets/images/alphaTest.png"))
        {
                std::cerr << "Error loading image" << std::endl;
                return (-1);
        }

        logo.setTexture(image);

        App.clear();

        while (App.isOpen())
        {
                sf::Event e;
                while (App.pollEvent(e))
                        if (e.type == sf::Event::Closed)
                                App.close();

                App.draw(logo);
                App.display();
        }
        return (-1);
}

EDIT: I'm an idiot. I moved App.clear(); inside the while loop and now it works.

2
Graphics / Texture Alpha Channel Transparency
« on: July 15, 2015, 07:45:39 am »
Does SFML support semi-transparent values in textures? For example, here is a gradient displayed with SFML: http://bit.ly/1Gl7FKJ
And this is what it should look like: http://bit.ly/1Gl7AGS

So it seems like the alpha channel is being rounded to either 0 or 255 at some point. This makes semi-transparent edges become jagged. example: http://bit.ly/1Gl81Rt
should be smooth like this: http://bit.ly/1Gl87sp

I have tried setSmooth but that seems to make no difference. I also tried loading the image as an sf::Image and using the alpha channel with createMaskFromColor.  Has anyone else experienced this, or found a solution?

Pages: [1]
anything