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

Pages: [1]
1
Graphics / Confusion concerning sf::Image pointers
« on: February 28, 2010, 06:59:29 am »
My current project is crashing at exit, complaining about corruption of the heap.
It seems to me that the problem is my image objects are being deleted a second time on exit! The crashing/heap problem goes away if I just remove the line where I manually delete my image.

Here's some code, try it for yourself (I'm using SFML2 revision 1429, Visual C++ 2008 Express). Put a breakpoint in Image::~Image in Image.cpp, and run this code. It breaks twice: once on my delete and another at the end of the program.

Code: [Select]
#include <SFML/Graphics.hpp>

sf::Image* Image;

int main()
{
Image = new sf::Image;
delete Image;

    return 0;
}


Is this standard behaviour for SFML?

2
Graphics / Drawing Large Numbers of Shapes Efficiently
« on: February 21, 2010, 09:44:10 am »
I have approximately 100,000 shapes, each with its own color and size.
They are going to be moving objects, so I must redraw them all each frame. They are all visible on the screen every frame.

Currently I'm rendering like this each loop:
Code: [Select]
App.Clear();
for (std::vector<sf::Shape>::iterator i = shapes.begin(); i != shapes.end(); i++)
{
App.Draw(*i);
}
App.Display();


I'm getting around 2 frames per second, which is obviously no good.
How can I significantly improve my rendering speed?

Pages: [1]
anything