+ if(size>0)
+ throw invalid_operation("Buffer::storage");
+ if(sz==0)
+ throw invalid_argument("Buffer::storage");
+
+ size = sz;
+ if(ARB_buffer_storage)
+ {
+ static const int flags = GL_MAP_READ_BIT|GL_MAP_WRITE_BIT|GL_DYNAMIC_STORAGE_BIT;
+ if(ARB_direct_state_access)
+ glNamedBufferStorage(id, size, 0, flags);
+ else
+ {
+ BindRestore _bind(this, type);
+ glBufferStorage(type, size, 0, flags);
+ }
+ }
+}
+
+void Buffer::set_usage(BufferUsage)
+{
+}
+
+void Buffer::data(const void *d)
+{
+ if(size==0)
+ throw invalid_operation("Buffer::data");
+
+ if(ARB_buffer_storage)
+ return sub_data(0, size, d);
+
+ if(ARB_direct_state_access)
+ glNamedBufferData(id, size, d, STATIC_DRAW);
+ else
+ {
+ BindRestore _bind(this, type);
+ glBufferData(type, size, d, STATIC_DRAW);
+ }