#pragma once
#include "Surface.h"
#include "3D/VertexBuffer.h"

#ifdef GUI_GTK

namespace gui {

	/**
	 * Data for vertex buffers (maybe shared with index buffers later).
	 */
	class GLBuffer {
	public:
		// Create.
		GLBuffer(GLSurface &surface, VertexBufferBase *buffer);
		GLBuffer(GLSurface &surface, IndexBufferBase *buffer);

		// Destroy.
		~GLBuffer();

		// The buffer.
		GLuint buffer;

		// Element size of the buffer.
		size_t elementSize;

		// Current size of the buffer in elements.
		size_t currentCount;

		// Current buffer usage.
		BufferUsage usage;

		// Surface.
		GLSurface &surface;

		// Destroy.
		static void destroy(void *me) {
			delete (GLBuffer *)me;
		}

		// Update contents.
		void update(VertexBufferBase *buffer, const DirtyRange &dirty);
		void update(IndexBufferBase *buffer, const DirtyRange &dirty);

	};


}

#endif
