31
Graphics / Divide By Zero When Drawing
« on: July 05, 2012, 04:54:15 pm »
I don't think it's normal to get a divide by zero error when drawing a sprite. Haha.
Check this out...
I ran through the code a lot and isolated the error to this section of the code.... drawing my sprites. The output of the program into the console shows that its the drawing that causes the error.
The output is as follows (verbatum):
Windows 7
SFML 2.0
Check this out...
for (unsigned i = 0; i < tiles.size(); ++i)
if (tiles[i]->GetSprites().size() > 0) {
cout << "Error ";
cout << tiles[i]->GetSprites()[0].getPosition().x;
_window->draw(tiles[i]->GetSprites().at(0));
/// The only thing Tile::GetSprites() does is return the vector of sprites for the tile.
/// I'm only using the first sprite though.
cout << " Here!" << endl;
}
if (tiles[i]->GetSprites().size() > 0) {
cout << "Error ";
cout << tiles[i]->GetSprites()[0].getPosition().x;
_window->draw(tiles[i]->GetSprites().at(0));
/// The only thing Tile::GetSprites() does is return the vector of sprites for the tile.
/// I'm only using the first sprite though.
cout << " Here!" << endl;
}
I ran through the code a lot and isolated the error to this section of the code.... drawing my sprites. The output of the program into the console shows that its the drawing that causes the error.
The output is as follows (verbatum):
Quote
Error 32 Here!As you can see, it successfully accesses the sprites in the vector well enough to output their position, but I get this error only on ONE of these sprites... Any idea what this might be?
Error 64 Here!
Error 96 Here!
Error 128 Here!
Error 160 Here!
Error 192 Here!
Error 224 Here!
Error 256
Unhandled exception at 0x0f6d2382 in TheReverendGUI.exe: 0xC0000094: Integer division by zero.
Windows 7
SFML 2.0