/* ==================== Load ==================== */ VOID IndexBuffer::Load(U32 count, U32 stride, VOID* data) { CHECK(data); // store the info mCount = count; mStride = stride; if(mObject == 0) { // generate the buffer object glGenBuffers(1, &mObject); CHECK(mObject); // bind the buffer object BindIndexBuffer(mObject); // commit the data to the gpu memory glBufferData(GL_ELEMENT_ARRAY_BUFFER, mCount*mStride, data, GL_STATIC_DRAW); } else { // bind the buffer object BindIndexBuffer(mObject); // commit the data to the gpu memory glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, mCount*mStride, data); } }
void RendererBase::PostRender() { if (pimpl->bound_layout) { pimpl->bound_layout->End(); } BindIndexBuffer(0); BindVertexBuffer(0); BindShaderProgram(0); glFlush(); }
/* ==================== Bind ==================== */ VOID IndexBuffer::Bind() { // bind the buffer object BindIndexBuffer(mObject); }