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

Pages: [1]
1
Graphics / Re: Large arrays of sprites crashing
« on: July 29, 2014, 03:53:00 pm »
Where do you load your textures btw? Doesn't setTexture throw exception when texture size is 0x0?

I wasn't getting any exceptions, but I do have a texture loader, just didn't need it in my example.

2
Graphics / Re: Large arrays of sprites crashing
« on: July 29, 2014, 03:51:33 pm »
I'd use vector, but I was actually using a multidimensional array originally for basing coordinates off of. I could write a struct wrapper with coords and a sprite, and put that in the vector, but I'd rather keep it simple.

After looking at my code a bit more, I won't actually be needing a full 7000+ sprites at any time, so I can work just fine within the limitations. Raising the stack size in MinGW did fix the issue though.

3
Graphics / Re: Large arrays of sprites crashing
« on: July 29, 2014, 03:06:44 pm »
The stack has a (very) limited memory size.

Is that a limitation of SFML, or simply a limit of C++?

It's been a while since I've done much C++ work.

4
Graphics / Large arrays of sprites crashing
« on: July 29, 2014, 02:41:22 pm »
While playing with multidimensional arrays of sprites, I began having unexpected crashing. After poking at it for a bit, I discovered that having an array of sprites over 7000 or so crashes my program immediately. Oddly, this behavior is completely reproducible on another machine, but the number of sprites required to crash is a few hundred higher.

The sprites are empty, with no data assigned.

With high working values, I see that this code is only taking about 25MB of ram, so I can't figure why I'm having issues.

SFML Version is the "GCC 4.7 MinGW (DW2) - 32 bits" version of SFML 2.1, latest stable.

I just noticed that my compiler version is GCC 4.8.1 rather than 4.7. Could this be the issue?

EDIT: Just rolled back to 4.7.2, and it's not the issue.
Also forgot to give my OS. Oops...

OS: Windows 7 S1 Professional 64-bit

I'll see if I can try to recreate on linux here in a bit.

The code to produce is the following:

int main(){

        sf::RenderWindow window(sf::VideoMode(200, 200), "Test");
        sf::Texture textures[10];

        sf::Sprite sprites[7200]; //setting this to 7100 still runs
        sprites[0].setTexture(textures[0]);

        while (window.isOpen()){
                sf::Event event;

                while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

                window.clear();
                window.draw(sprites[0]);
                window.display();
        }

        return 0;
}

5
Graphics / Looking for the proper way to tile an animated sprite
« on: April 10, 2014, 05:08:04 pm »
Pretty much what the title says, just looking for the proper way to tile an animated sprite.

I have a 4 frame image I'm looking to tile as a background, stored as a 16x64 png.

As is, I can animate a single instance of it just fine, using sprite.setTextureRect(). However, I'm not sure of the proper way to repeatedly tile the sprite across the background.

Also, I'm using JSFML if it makes a difference.

Any suggestions?

Pages: [1]