22 #ifndef INCLUDED_VERTEXBUFFER 23 #define INCLUDED_VERTEXBUFFER 91 CVertexBuffer(
size_t vertexSize, GLenum usage, GLenum target);
136 VBChunk*
Allocate(
size_t vertexSize,
size_t numVertices, GLenum usage, GLenum target,
void* backingStore);
size_t GetVertexSize() const
Definition: VertexBuffer.h:110
size_t m_Index
Start index of this chunk in owner.
Definition: VertexBuffer.h:67
static bool UseStreaming(GLenum usage)
Given the usage flags of a buffer that has been (or will be) allocated:
Definition: VertexBuffer.cpp:352
void DumpStatus()
Definition: VertexBuffer.cpp:338
void PrepareForRendering(VBChunk *chunk)
Make the vertex data available for the next call to Bind()
Definition: VertexBuffer.h:105
bool m_Needed
If true, we have been told this chunk is going to be used for rendering in the next bind phase and wi...
Definition: VertexBuffer.h:79
std::list< VBChunk * > m_AllocList
List of allocated chunks.
Definition: VertexBuffer.h:150
friend class CVertexBuffer
Definition: VertexBuffer.h:84
VBChunk()
Definition: VertexBuffer.h:85
Definition: VertexBufferManager.h:30
VBChunk * Allocate(size_t vertexSize, size_t numVertices, GLenum usage, GLenum target, void *backingStore)
Try to allocate a buffer of given number of vertices (each of given size), and with the given type - ...
Definition: VertexBuffer.cpp:102
u8 * Bind()
Bind to this buffer; return pointer to address required as parameter to glVertexPointer ( + etc) call...
Definition: VertexBuffer.cpp:228
size_t GetBytesReserved() const
Definition: VertexBuffer.cpp:328
GLenum m_Usage
Usage type of the buffer (GL_STATIC_DRAW etc)
Definition: VertexBuffer.h:158
VBChunk: describes a portion of this vertex buffer.
Definition: VertexBuffer.h:62
uint8_t u8
Definition: types.h:37
GLenum m_Target
Buffer target (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER)
Definition: VertexBuffer.h:160
CVertexBuffer: encapsulation of ARB_vertex_buffer_object, also supplying some additional functionalit...
Definition: VertexBuffer.h:55
u8 * GetBindAddress()
Get the address that Bind() will return, without actually binding.
Definition: VertexBuffer.cpp:311
u8 * m_SysMem
Raw system memory for systems not supporting VBOs.
Definition: VertexBuffer.h:156
std::list< VBChunk * > m_FreeList
List of free chunks in this buffer.
Definition: VertexBuffer.h:148
size_t m_FreeVertices
Available free vertices - total of all free vertices in the free list.
Definition: VertexBuffer.h:152
NONCOPYABLE(CVertexBuffer)
~VBChunk()
Definition: VertexBuffer.h:86
void UpdateChunkVertices(VBChunk *chunk, void *data)
Update vertex data for given chunk. Transfers the provided data to the actual OpenGL vertex buffer...
Definition: VertexBuffer.cpp:197
void Release(VBChunk *chunk)
Return given chunk to this buffer.
Definition: VertexBuffer.cpp:160
size_t m_Count
Number of vertices used by chunk.
Definition: VertexBuffer.h:69
size_t m_MaxVertices
Number of vertices of above size in this buffer.
Definition: VertexBuffer.h:146
CVertexBuffer * m_Owner
Owning (parent) vertex buffer.
Definition: VertexBuffer.h:65
size_t GetBytesAllocated() const
Definition: VertexBuffer.cpp:333
GLuint m_Handle
Handle to the actual GL vertex buffer object.
Definition: VertexBuffer.h:154
size_t m_VertexSize
Vertex size of this vertex buffer.
Definition: VertexBuffer.h:144
bool CompatibleVertexType(size_t vertexSize, GLenum usage, GLenum target)
Returns true if this vertex buffer is compatible with the specified vertex type and intended usage...
Definition: VertexBuffer.cpp:90
void * m_BackingStore
If UseStreaming() is true, points at the data for this chunk.
Definition: VertexBuffer.h:71
bool m_Dirty
If true, the VBO is not consistent with the chunk's backing store (and will need to be re-uploaded be...
Definition: VertexBuffer.h:75
static void Unbind()
Unbind any currently-bound buffer, so glVertexPointer etc calls will not attempt to use it...
Definition: VertexBuffer.cpp:319
~CVertexBuffer()
Definition: VertexBuffer.cpp:74