This is my code for drawing a circle with a texture loaded from file .
#include<SFML/Graphics.hpp>
#include<SFML/Window.hpp>
int main()
{
sf::ContextSettings settings ;
settings.antialiasingLevel = 8 ;
sf::RenderWindow window(sf::VideoMode(800,600) , "Shapes" , sf::Style::Default , settings) ;
sf::CircleShape circle ;
circle.setRadius(80) ;
circle.setPointCount(200) ;
sf::Texture texture ;
texture.loadFromFile("/home/deepukps/Downloads/texture.jpg") ;
circle.setTexture(&texture) ;
while (window.isOpen())
{
sf::Event event ;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close() ;
}
window.clear() ;
window.draw(circle) ;
window.display() ;
}
return 0 ;
}
And this is how I linked the linked the libraries after compiling my code -
g++ shape.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
This is the error message I get - Failed to load image "/home/deepukps/Downloads/texture.jpg". Reason: Unable to open file
What exactly am I doing wrong?