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 - deepukps

Pages: [1]
1
Graphics / unable to open file , read details please.[Linux]
« on: June 29, 2016, 12:12:42 pm »
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?

Pages: [1]
anything