Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
IndexBuffer Class Reference

IndexBuffer is an abstraction of low level openGL Buffer Object. More...

Inherits Ref.

Public Types

enum  IndexType { INDEX_TYPE_SHORT_16, INDEX_TYPE_UINT_32 }
 Enum for the type of index, short indices and int indices could be used. More...
 

Public Member Functions

IndexType getType () const
 Getter for type of indices.
 
int getSizePerIndex () const
 Get the size in bytes for one index, will be 2 for INDEX_TYPE_SHORT_16 and 4 for INDEX_TYPE_UINT_32.
 
int getIndexNumber () const
 Get the number of indices.
 
bool updateIndices (const void *indices, int count, int begin)
 Update all or part of indices data, if the range specified exceeds the vertex buffer, it will be clipped. More...
 
int getSize () const
 Get the size in bytes of the array of indices.
 
GLuint getVBO () const
 Get the openGL handle for index buffer.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Static Public Member Functions

static IndexBuffercreate (IndexType type, int number, GLenum usage=GL_STATIC_DRAW)
 Create an instance of IndexBuffer. More...
 
local create ( local type, local number, local GL_STATIC_DRAW)
 Create an instance of IndexBuffer. More...
 
static bool isShadowCopyEnabled ()
 Static getter for shadowCopy.
 
local isShadowCopyEnabled ()
 Static getter for shadowCopy.
 
static void enableShadowCopy (bool enabled)
 Static setter for shadowCopy.
 
local enableShadowCopy ( local enabled)
 Static setter for shadowCopy.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

IndexBuffer is an abstraction of low level openGL Buffer Object.

It used to save an array of indices.

Member Function Documentation

static IndexBuffer* create ( IndexType  type,
int  number,
GLenum  usage = GL_STATIC_DRAW 
)
static

Create an instance of IndexBuffer.

type of index. The number of indices. A hint to indicate whether the indexBuffer are updated frequently or not to let GL optimise it.

local create ( local  type,
local  number,
local  usage = GL_STATIC_DRAW 
)
static

Create an instance of IndexBuffer.

type of index. The number of indices. A hint to indicate whether the indexBuffer are updated frequently or not to let GL optimise it.

bool updateIndices ( const void *  indices,
int  count,
int  begin 
)

Update all or part of indices data, if the range specified exceeds the vertex buffer, it will be clipped.

The pointer of the index data. The number of indices to update. The start index to update.

local updateIndices ( local  indices,
local  count,
local  begin 
)

Update all or part of indices data, if the range specified exceeds the vertex buffer, it will be clipped.

The pointer of the index data. The number of indices to update. The start index to update.


The documentation for this class was generated from the following file: