public GLESHardwareIndexBuffer(HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer)
: base(manager, type, numIndices, usage, false, useShadowBuffer)
{
if (type == IndexType.Size32)
{
throw new AxiomException("32 bit hardware buffers are not allowed in OpenGL ES.");
}
if (!useShadowBuffer)
{
throw new AxiomException("Only support with shadowBuffer");
}
OpenGL.GenBuffers(1, ref this._bufferId);
GLESConfig.GlCheckError(this);
if (this._bufferId == 0)
{
throw new AxiomException("Cannot create GL index buffer");
}
OpenGL.BindBuffer(All.ElementArrayBuffer, this._bufferId);
GLESConfig.GlCheckError(this);
OpenGL.BufferData(All.ElementArrayBuffer, new IntPtr(sizeInBytes), IntPtr.Zero, GLESHardwareBufferManager.GetGLUsage(usage));
GLESConfig.GlCheckError(this);
}