#include <stdexcept>
-#include <msp/core/raii.h>
-#include <msp/gl/extensions/arb_direct_state_access.h>
#include "buffer.h"
#include "bufferable.h"
+#include "error.h"
using namespace std;
namespace Msp {
namespace GL {
-Bufferable::Bufferable():
- buffer(0),
- offset(0),
- next_in_buffer(0),
- prev_in_buffer(0),
- location_dirty(false),
- dirty(false)
-{ }
-
Bufferable::~Bufferable()
{
unlink_from_buffer();
return last->offset+last->get_data_size();
}
-Bufferable::AsyncUpdater *Bufferable::refresh_async() const
-{
- return dirty ? new AsyncUpdater(*this) : 0;
-}
-
void Bufferable::unlink_from_buffer()
{
if(prev_in_buffer)
void Bufferable::upload_data(char *target) const
{
+ if(!buffer)
+ throw invalid_operation("Bufferable::upload_data");
+
unsigned data_size = get_data_size();
if(location_dirty)
{
buffer->require_size(offset+data_size);
- location_changed(buffer, offset, data_size);
location_dirty = false;
}