UltimateZoneBuilder/Source/Native/IndexBuffer.cpp
2019-12-22 23:44:58 +01:00

37 lines
536 B
C++

#include "Precomp.h"
#include "IndexBuffer.h"
#include "RenderDevice.h"
IndexBuffer::~IndexBuffer()
{
if (Device && mBuffer != 0)
{
glDeleteBuffers(1, &mBuffer);
mBuffer = 0;
}
}
GLuint IndexBuffer::GetBuffer()
{
if (mBuffer == 0)
glGenBuffers(1, &mBuffer);
return mBuffer;
}
/////////////////////////////////////////////////////////////////////////////
extern "C"
{
IndexBuffer* IndexBuffer_New()
{
return new IndexBuffer();
}
void IndexBuffer_Delete(IndexBuffer* buffer)
{
RenderDevice::DeleteObject(buffer);
}
}