Backported commits 145524a and 7785b4b from minor into default (Added SpriteBatch:flush, deprecated SpriteBatch:bind/unbind, SpriteBatch:flush is called implicitly when the spritebatch is drawn.)

This commit is contained in:
Alex Szpakowski
2014-06-17 21:52:56 -03:00
parent b9cd93e071
commit f0fa63ba47
6 changed files with 104 additions and 84 deletions
+14 -4
View File
@@ -28,6 +28,9 @@
// OpenGL
#include "OpenGL.h"
// C
#include <stddef.h>
namespace love
{
namespace graphics
@@ -152,8 +155,12 @@ public:
* when used to draw elements.
*
* The VertexBuffer must be bound to use this function.
*
* @param usedOffset The offset into the mapped buffer indicating the
* sub-range of data modified. Optional.
* @param usedSize The size of the sub-range of modified data. Optional.
*/
virtual void unmap() = 0;
virtual void unmap(size_t usedOffset = 0, size_t usedSize = -1) = 0;
/**
* Bind the VertexBuffer to its specified target.
@@ -294,7 +301,7 @@ public:
// Implements VertexBuffer.
virtual void *map();
virtual void unmap();
virtual void unmap(size_t usedOffset = 0, size_t usedSize = -1);
virtual void bind();
virtual void unbind();
virtual void fill(size_t offset, size_t size, const void *data);
@@ -328,7 +335,7 @@ public:
// Implements VertexBuffer.
virtual void *map();
virtual void unmap();
virtual void unmap(size_t usedOffset = 0, size_t usedSize = -1);
virtual void bind();
virtual void unbind();
virtual void fill(size_t offset, size_t size, const void *data);
@@ -355,12 +362,15 @@ private:
*/
void unload(bool save);
void unmapStatic(size_t offset, size_t size);
void unmapStream();
// The VBO identifier. Assigned by OpenGL.
GLuint vbo;
// A pointer to mapped memory. Will be inialized on the first
// call to map().
void *memory_map;
char *memory_map;
// Set if the buffer was modified while operating on gpu memory
// and needs to be synchronized.