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

Defines a binding between the vertex layout of a Mesh and the vertex input attributes of a vertex shader (Effect). More...

Inherits Ref.

Public Member Functions

void bind ()
 Binds this vertex array object.
 
void unbind ()
 Unbinds this vertex array object.
 
uint32_t getVertexAttribsFlags () const
 Returns the vertex attrib flags verteix attributes flag.
 
- 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 VertexAttribBindingcreate (MeshIndexData *meshIndexData, GLProgramState *glProgramState)
 Creates a new VertexAttribBinding between the given MeshVertexData and GLProgramState. More...
 
local create ( local meshIndexData, local glProgramState)
 Creates a new VertexAttribBinding between the given MeshVertexData and GLProgramState. More...
 

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

Defines a binding between the vertex layout of a Mesh and the vertex input attributes of a vertex shader (Effect).

In a perfect world, this class would always be a binding directly between a unique VertexFormat and an Effect, where the VertexFormat is simply the definition of the layout of any anonymous vertex buffer. However, the OpenGL mechanism for setting up these bindings is Vertex Array Objects (VAOs). OpenGL requires a separate VAO per vertex buffer object (VBO), rather than per vertex layout definition. Therefore, although we would like to define this binding between a VertexFormat and Effect, we are specifying the binding between a Mesh and Effect to satisfy the OpenGL requirement of one VAO per VBO.

Note that this class still does provide a binding between a VertexFormat and an Effect, however this binding is actually a client-side binding and should only be used when writing custom code that use client-side vertex arrays, since it is slower than the server-side VAOs used by OpenGL (when creating a VertexAttribBinding between a Mesh and Effect).

Member Function Documentation

static VertexAttribBinding* create ( MeshIndexData meshIndexData,
GLProgramState glProgramState 
)
static

Creates a new VertexAttribBinding between the given MeshVertexData and GLProgramState.

If a VertexAttribBinding matching the specified MeshVertexData and GLProgramState already exists, it will be returned. Otherwise, a new VertexAttribBinding will be returned. If OpenGL VAOs are enabled, the a new VAO will be created and stored in the returned VertexAttribBinding, otherwise a client-side array of vertex attribute bindings will be stored. The mesh index data. The gl program state object. A VertexAttribBinding for the requested parameters.

var create ( var  meshIndexData,
var  glProgramState 
)
static

Creates a new VertexAttribBinding between the given MeshVertexData and GLProgramState.

If a VertexAttribBinding matching the specified MeshVertexData and GLProgramState already exists, it will be returned. Otherwise, a new VertexAttribBinding will be returned. If OpenGL VAOs are enabled, the a new VAO will be created and stored in the returned VertexAttribBinding, otherwise a client-side array of vertex attribute bindings will be stored. The mesh index data. The gl program state object. A VertexAttribBinding for the requested parameters.

local create ( local  meshIndexData,
local  glProgramState 
)
static

Creates a new VertexAttribBinding between the given MeshVertexData and GLProgramState.

If a VertexAttribBinding matching the specified MeshVertexData and GLProgramState already exists, it will be returned. Otherwise, a new VertexAttribBinding will be returned. If OpenGL VAOs are enabled, the a new VAO will be created and stored in the returned VertexAttribBinding, otherwise a client-side array of vertex attribute bindings will be stored. The mesh index data. The gl program state object. A VertexAttribBinding for the requested parameters.


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