Closed Nathan-M-code closed 2 months ago
I'll look into it at some point, as I too don't have much time atm. Is it only Sprite + VertexBuffer? Since I know I mix RectangleShape and VertexBuffer in my game which uses this branch and everything works fine. Also, I renamed this GLES2 branch to SFML-2.6.x-GLES2 as it is SFML 2.
And technically, I use the now-called SFML-2.6.x-GLES2-FixedResolutions which has one additional commit over SFML-2.6.x-GLES2 and it just makes VideoMode::getDesktopMode() on Android return full device screen resolution compared to how SFML does it currently which returns a slightly smaller resolution on devices with a hole punch/notch and then a Event::Resize happens at some point in the beginning which makes my life more difficult. Other than that, these 2 branches are identical.
Thank you for your quick answer. I have the same behavior with RectangleShape (pointing to the same texture as the sprite) There is the minimal code :
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Test", sf::Style::Fullscreen);
sf::Texture t;
t.loadFromFile("image.png");
sf::Sprite sprite(t);
sf::RectangleShape rs;
rs.setTexture(&t);
rs.setSize({400,400});
rs.setPosition(800,0);
sf::Vertex vertices[3] = {
sf::Vertex({10,10}, {255,0,0}),
sf::Vertex({50,10}, {255,0,0}),
sf::Vertex({25,50}, {255,0,0})
};
sf::VertexBuffer vb(sf::Triangles);
vb.create(3);
vb.update(vertices);
bool vbDrawn = false;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed) window.close();
if (event.type == sf::Event::TouchBegan) vbDrawn = true;
}
window.clear();
if(vbDrawn) window.draw(vb);
window.draw(sprite);
window.draw(rs);
window.display();
}
return EXIT_SUCCESS;
}
Yup, that is strange, probably something wrong with the default nontexture shader considering that if you add a texture to the vertex buffer it works fine if(vbDrawn) window.draw(vb, &t);
Will check what is up with that, thanks for reporting!
Prerequisite Checklist
Describe your issue here
No error message. All sfml sprites are white after drawing sf::VertexBuffer, but the vertexbuffer itself is drawn. After replacing VertexBuffer for VertexArray, everything is normal again. I absolutely don't have a clue of what might be the problem. I checked the texture pointer of each sprites and I seemed ok. I didn't to dive into the sfml code.
It doesnt affect me much, as using vertexarray is also good to me. Just want to let you know.
Your Environment
Steps to reproduce
Expected behavior
normal sprite drawing
Actual behavior
white sprites