SFML community forums

Help => Graphics => Topic started by: Tom Clabault on March 03, 2019, 02:42:32 pm

Title: VertexArray and transparent texture
Post by: Tom Clabault on March 03, 2019, 02:42:32 pm
Hi!
I'm in front of a problem that doesn't seem to be that of a challenge but still, I'm stuck with it
I've a Quads vertexArray and I've a .png with transparency in it.
The problem is that when displaying the vertices with the texCoords of the image, it shows black instead of transpanrecy

Here's my .png:
(https://i.ibb.co/3FfBy0j/Zeus.png) (https://imgbb.com/)

I'm defining the vertices' texCoords as follows:
levelVertex[0].texCoords = CORNER_UP_LEFT_TEXTURE;
levelVertex[1].texCoords = CORNER_UP_RIGHT_TEXTURE;
levelVertex[2].texCoords = CORNER_BOTTOM_RIGHT_TEXTURE;
levelVertex[3].texCoords = CORNER_BOTTOM_LEFT_TEXTURE;
 

When displaying, here's what I get:
(https://i.ibb.co/09fR4MK/Untitled-1.png) (https://imgbb.com/)

I tried to set the four vertices' color to sf::Color::Transparent but with that done, it displays a full black Quad

Any thoughts about that?
Title: Re: VertexArray and transparent texture
Post by: NGM88 on March 03, 2019, 02:52:58 pm
What's behind it?
Title: Re: VertexArray and transparent texture
Post by: Tom Clabault on March 03, 2019, 03:35:32 pm
Hum, I think you found the problem

Behind it is supposed to stand the sky but the sky is also a Quad belonging to the same vertexArray.
I'll try some things and I'll tell you

EDIT: Done, I used a Sprite instead of vertices, it worked. Thanks for pointing me in the direction