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

Pages: [1]
1
Graphics / Re: Strange error when trying to loadFromFile
« on: August 31, 2013, 04:29:52 pm »
Oh, oh oh! I get it. That fixed it for me, thanks. :)

I didn't know you could build in relase/debug, I was fixed on the lib files. I guess you learn new things everyday. Thanks again!

2
Graphics / Re: Strange error when trying to loadFromFile
« on: August 31, 2013, 04:22:03 pm »
Oh alright thanks for the info.

The dependencies I use are these:

sfml-graphics.lib
sfml-window.lib
sfml-system.lib

Which are release libraries right?

3
Graphics / Re: Strange error when trying to loadFromFile
« on: August 31, 2013, 04:08:50 pm »
Quote
but bugs in the image loading old C code that SFML uses are not unheard of

Thanks but what do you mean by this?

Also, I attached the image, which is simply a 50 by 50 .png.

4
Graphics / Re: Strange error when trying to loadFromFile
« on: August 31, 2013, 03:58:18 pm »
Thanks for the fast reply!


Quote
That code shouldn't fail, you must be doing something else wrong.
That's what I figured as well, but I was unsure as to where to look for the source of the problem.

My OS is Win7 64x
I'm compiling using VS12 and the version of SFML I downloaded was "Visual C++ 11 (2012) - 32 bits", which I guess is the right one, because I want to compile for 32x and not 64x.

Oh and he line that fails is:
if (!texture.loadFromFile("image.png"))

The error I get says:
Quote
Unhandled exception at 0x738BDEF8 (msvcr110.dll) in SFML_test.exe: 0xC0000005: Access violation reading location 0x00273000.

btw, does it matter what settings I use to save .png's? In case the file I try to open is problem.

5
Graphics / Strange error when trying to loadFromFile
« on: August 31, 2013, 03:39:22 pm »
Hi! I'm new to SFML (and a bit of newbie at programming), and I'm currently reading the tutorials. I'm on the sprites tutorial and I'm stuck on the first example, it says:

sf::Texture texture;
if (!texture.loadFromFile("image.png"))
{
    // error...
}

So I drew an image, named it image.png, saved it in the project folder and wrote this in my .cpp file:

#include <iostream>
#include <SFML\Graphics.hpp>

int main()
{
        // create render window
        sf::RenderWindow rmain(sf::VideoMode(800, 600), "My Window");
        rmain.setFramerateLimit(30);

        sf::Texture texture;
        if (!texture.loadFromFile("image.png"))
        {
                std::cout << "Unable to load image from file" << std::endl;
        }

        // run program as long as windos is open
        while (rmain.isOpen())
        {
                // check all the window's events that were triggered since the last iteration of loop
                sf::Event event;
                while (rmain.pollEvent(event))
                {
                        // "close requested" event, close the windoe
                        if (event.type == sf::Event::Closed)
                                rmain.close();
                }

                // clear the window with black color
                rmain.clear(sf::Color::Black);

                // draw stuff here
                // windoe.draw(..);

                // end current frame
                rmain.display();

        }

        return 0;
}

The error that I get is pretty crazy, it makes the console go all nuts while blips and bloops spill out from my computers alarm and I have no idea why this happens, the image is on the right place, I even moved it around the project folder in case it was misplaced, but to no avail.

Can someone please help me identify the problem and perhaps guide me through the proces of fixing it? Thanks.

Also, I did a search on the forums but I got errors every time I tried, so very sorry if this have been brought up times before.

Elias

Pages: [1]