Back to class index

Class IndexBuffer

Summary

Stores a CPU and/or GPU side array of geometry index data.

Member Reference

IndexBufferStores a CPU and/or GPU side array of geometry index data.
indexDataIf this IndexBuffer has cpu-side memory present, this field points to the cpu-side data.
indexDataBytesSpecifes the number of bytes allocated to indexData on the CPU side.
numIndicesNumber of indices logically used in this index buffer.
gpuIndexDataBytesNumber of indices allocated to the GPU side index buffer.
indexTypeSpecifies whether we have 8-, 16- or 32-bit indices.
primTypeSpecifies what kind of primitives will be used in rendering.
indexBufferA GLES2 handle to the index buffer object.
name
ctor
~dtor
ctor
operator=(rhs)
Create(...) (+1 overload)Constructs a new index buffer with the given parameters.
Deinit()Frees up all resources used by this IndexBuffer and makes it null.
SetIndex(n,vertexIndex)Sets the Nth element of this index buffer to point to the given vertex index.
GetIndex(n)[const]Returns the vertex index addressed at the Nth index of this index buffer.
GetPointer(n) (+1 overload)Returns a raw pointer to the cpu-side index buffer at the given element.
GetOffset(n)[const]Returns the byte offset from the beginning of the index buffer to the start of the Nth element.
AllocateCpuMemory()Creates the CPU-side data array for this index buffer, if one did not yet exist.
AllocateGpuMemory()Creates the GPU-side data array for this index buffer, if one did not yet exist.
UpdateToGpu()Copies the CPU-side index buffer data to the GPU memory.
HasCpuMemory()[const]Returns true if this index buffer has CPU-side data.
CpuSizeBytes()[const]Returns the number of bytes in the cpu-side data array of this index buffer.
HasGpuMemory()[const]Returns true if this index buffer has GPU-side data allocated.
GpuSizeBytes()[const]Returns the number of bytes of GPU memory consumed by this index buffer.
FreeCpuMemory()Destroys the CPU-side index buffer memory, if that existed.
FreeGpuMemory()Destroys the GPU-side index buffer memory, if that existed.
CpuPtr() (+1 overload)Returns a pointer to the CPU-side array of index data, or null if no CPU-side data is present.
SetNumIndices(size)Reallocates this index buffer to the given number of elements.
NumIndices()[const]Returns the number of elements logically in use in this index buffer.
NumPrimitives()[const]Returns the number of primitives (lines, triangles, etc.) this index buffer represents.
UsedSizeBytes()[const]Returns the number of bytes 'logically' used by this IndexBuffer.
IndexSizeBytes()[const]Returns the size of a single index in bytes (1,2 or 4, depending on indexType).
SaveToFile(handle)Saves the contents of this index buffer to a file.
LoadFromFile(...)Loads the contents of this index buffer from a file.
OptimizeForVertexCaches()Reorders the triangles in this index buffer in-place, to optimize for GPU post-transform vertex caches.
CompressIndices(allow8BitIndices)Reallocates this IndexBuffer to minimize the number of bytes per index.
Name()[const]
NumIndicesNeededToRenderNPrimitives(...)[static]A helper to calculate the number of indices that are required to render the given number of primitives of the given type.
NumPrimivivesFromNIndices(...)[static]A helper to calculate the number of primitives of the given type that the given number of indices make up.
Back to class index