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

Pages: [1]
1
General / sf::RenderTexture in a thread
« on: December 18, 2013, 02:22:03 am »
Hi,

I've created a thread wich handles the graphic part of my program.
But I want to create a sf::RenderTexture in the main thread. I read in SFML tutorial that if we want to load texture in another thread we can do it by instanciating a sf::Context in the scope. When I want to call the "create" function of my renderTexture I have an openGL error.

What could be the error ?

2
General / Issues with loadFromFiles() Methods.
« on: October 16, 2013, 11:28:31 pm »
Hi,

I'm having issues in a project using sfml 2.1.

I've made a clone of pacman. The game is working fine and all, but I always played it using Visual Studio 2012.

Some hours ago I tried to launch it using the binary, what was my surprise when I saw an error.

"Pacman has stopped working"...

I've fixed some bugs on some STL containers but now the game crashes randomly during the construction of my main class.
Sometimes it also generates everything and the game launches.

I really don't understand where the bug is from, maybe an heap corruption ?

        msvcr110.dll!malloc(unsigned int size) Ligne 91 C
        msvcr110.dll!operator new(unsigned int size) Ligne 59   C++

here is a part of the call stack, it shows a call to new then to malloc. I actually don't do any new in the constructor except for an sf::Texture, so I assume it's the calls into loadFromFile()... ? And even so, I made a project yesterday using the same functions in the SFML and I didn't get errors.

What could raise those errors ?

I'm also using windows 8.1 RTM, I don't think the SFML has issues with it :o

        this->_tileset.loadFromFile("./pacman_sprites.png");



        this->_font.loadFromFile("./font.ttf");

        this->_highScoreText.setFont(this->_font);
        this->_highScoreText.setString("HIGHSCORE");
        this->_highScoreText.setCharacterSize(16);
        this->_highScoreText.setColor(sf::Color::White);
        this->_highScoreText.setPosition(72, -8);

        this->_score.setFont(this->_font);
        this->_score.setString("0");
        this->_score.setCharacterSize(16);
        this->_score.setColor(sf::Color::White);
        this->_score.setPosition(56, 0);

        this->_start.setFont(this->_font);
        this->_start.setString("GET READY");
        this->_start.setCharacterSize(32);
        this->_start.setColor(sf::Color::White);
        int tmpStart = this->_win.getSize().x - this->_start.getGlobalBounds().width;
        this->_start.setPosition(tmpStart / 2, this->_win.getSize().y / 2 - this->_start.getGlobalBounds().height);

        sf::Texture *tmp = new sf::Texture();
        tmp->loadFromFile("./pacman_animations.png");
        this->_pacman.setPos(std::pair<float, float>(102, 180));
        this->_pacman.init(tmp);

That's the code written in the constructor, I don't see any weird settings. I've also made sure all the dependencies are in the good folders.

Do someone ever had this king of issues ?

Thanks !

3
Graphics / Size max of an sf::Image
« on: October 02, 2013, 11:29:46 am »
Hi,

I'm using the sf::Image to create an image of a map I've generated, the problem is that the map can be very huge (like 2000000px * 2000000px). But the size max of an sf::Image on my pc is 8192 * 8192.

I've decided to cut the map into different chunks so I can create Image of a smaller size.

But my pc has a "recent" graphic card, so I can do Images of 8192*8192, my question is, can I base the size of the chunk with the resolution of the user ?

For example, my resolution is 1920*1080, so I'll cut my chunks with this size, if a user has a resolution of 800*600, can I conclude I can do sf::Image of size 800*600 without having issues ?

Thanks !

Pages: [1]