Cocos2d-x  v3.17
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
VertexBuffer Class Reference

VertexBuffer is an abstraction of low level openGL Vertex Buffer Object. More...

Inherits Ref.

Public Member Functions

int getSizePerVertex () const
 Get the size in bytes of one vertex. More...
 
int getVertexNumber () const
 Get the number of vertices. More...
 
bool updateVertices (const void *verts, int count, int begin)
 Update all or part of vertices data, if the range specified exceeds the vertex buffer, it will be clipped. More...
 
local updateVertices ( local verts, local count, local begin)
 Update all or part of vertices data, if the range specified exceeds the vertex buffer, it will be clipped. More...
 
int getSize () const
 Get the size of the vertex array in bytes, equals getSizePerVertex() * getVertexNumber().
 
GLuint getVBO () const
 Get the internal openGL handle.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
local 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. More...
 

Static Public Member Functions

static VertexBuffercreate (int sizePerVertex, int vertexNumber, GLenum usage=GL_STATIC_DRAW)
 Create an instance of VertexBuffer. More...
 
local create ( local sizePerVertex, local vertexNumber, local GL_STATIC_DRAW)
 Create an instance of VertexBuffer. More...
 
static bool isShadowCopyEnabled ()
 Static getter for shadowCopy.
 
local isShadowCopyEnabled ()
 Static getter for shadowCopy.
 
static void enableShadowCopy (bool 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.
 

Detailed Description

VertexBuffer is an abstraction of low level openGL Vertex Buffer Object.

It is used to save an array of vertices.

Member Function Documentation

static VertexBuffer* create ( int  sizePerVertex,
int  vertexNumber,
GLenum  usage = GL_STATIC_DRAW 
)
static

Create an instance of VertexBuffer.

Parameters
sizePerVertexSize in bytes of one vertex.
vertexNumberThe number of vertex.
usageA hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it.
local create ( local  sizePerVertex,
local  vertexNumber,
local  usage = GL_STATIC_DRAW 
)
static

Create an instance of VertexBuffer.

Parameters
sizePerVertexSize in bytes of one vertex.
vertexNumberThe number of vertex.
usageA hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it.
int getSizePerVertex ( ) const

Get the size in bytes of one vertex.

local getSizePerVertex ( )

Get the size in bytes of one vertex.

int getVertexNumber ( ) const

Get the number of vertices.

local getVertexNumber ( )

Get the number of vertices.

bool updateVertices ( const void *  verts,
int  count,
int  begin 
)

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

Parameters
vertsThe pointer of the vertex data.
countThe number of vertices to update.
beginThe first vertex to update.
local updateVertices ( local  verts,
local  count,
local  begin 
)

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

Parameters
vertsThe pointer of the vertex data.
countThe number of vertices to update.
beginThe first vertex to update.

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