Right, so I'm very new to sfml and computer graphics in general. I tired my hand at OpenGL a while ago and that experience sort of put me off OpenGL for a while, which is why I've been playing around with SFML recently.
What I'm trying to do is to create my own render queue, which can then render all of it's drawables to any RenderTarget:
#include "RenderQ.h"
namespace game {
namespace renderer {
RenderQ::RenderQ()
{
_queue = std::vector<sf::Drawable *>();
}
void RenderQ::submit(sf::Drawable * drawable)
{
_queue.push_back(drawable);
}
void RenderQ::clear()
{
_queue.clear();
}
void RenderQ::drawAll(sf::RenderTarget& target)
{
for (int i = 0; i < _queue.size(); i++) {
target.draw( *_queue[i] );
}
}
}
}
I can submit to the queue just fine. The problem comes when I call drawAll.
I'm not entirely certain what happens or why it breaks, but it throws this error at me and I've unsuccessfully spent a couple of hour trying to figure out where it comes from:
Exception thrown at 0x000007FEE184894B (sfml-graphics-2.dll) in SFML.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
I'm not entirely certain what sort of information I can get from the error. It's not very descriptive, and I'm not entirely certain on how to do proper error handling ( or in fact, catching ) with SFML. Any sort of help would be greatly appreciated.
Thanks in advance!