Cocos2d-x  4.0.0
Public Member Functions | List of all members
ProgramGL Class Reference

An OpenGL program. More...

Inherits Program.

Public Member Functions

 ProgramGL (const std::string &vertexShader, const std::string &fragmentShader)
 
const std::vector
< AttributeInfo > & 
getAttributeInfos () const
 Get attribute informations.
 
GLuint getHandler () const
 Get program object.
 
void computeAttributeInfos (const RenderPipelineDescriptor &descriptor)
 Calculate attribute information according to vertex layout.
 
virtual UniformLocation getUniformLocation (const std::string &uniform) const override
 Get uniform location by name.
 
virtual UniformLocation getUniformLocation (backend::Uniform name) const override
 Get uniform location by engine built-in uniform enum name.
 
virtual int getAttributeLocation (const std::string &name) const override
 Get attribute location by attribute name.
 
virtual int getAttributeLocation (Attribute name) const override
 Get attribute location by engine built-in attribute enum name.
 
virtual int getMaxVertexLocation () const override
 Get maximum vertex location.
 
virtual int getMaxFragmentLocation () const override
 Get maximum fragment location.
 
virtual const
std::unordered_map
< std::string,
AttributeBindInfo > 
getActiveAttributes () const override
 Get active vertex attributes.
 
virtual std::size_t getUniformBufferSize (ShaderStage stage) const override
 Get uniform buffer size in bytes that can hold all the uniforms.
 
virtual const UniformInfo & getActiveUniformInfo (ShaderStage stage, int location) const override
 Get a uniformInfo in given location from the specific shader stage.
 
virtual const
std::unordered_map
< std::string, UniformInfo > & 
getAllActiveUniformInfo (ShaderStage stage) const override
 Get all uniformInfos.
 
- Public Member Functions inherited from Program
const std::string & getVertexShader () const
 Get vertex shader.
 
const std::string & getFragmentShader () const
 Get fragment shader.
 
ProgramType getProgramType () const
 Get engine built-in program type.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership.
 
void release ()
 Releases the ownership immediately.
 
Refautorelease ()
 Releases the ownership sometime soon automatically.
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count.
 
virtual ~Ref ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from Program
static ProgramgetBuiltinProgram (ProgramType type)
 Get engine built-in program.
 
- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

An OpenGL program.

Constructor & Destructor Documentation

ProgramGL ( const std::string &  vertexShader,
const std::string &  fragmentShader 
)
Parameters
vertexShaderSpecifes the vertex shader source.
fragmentShaderSpecifes the fragment shader source.

Member Function Documentation

const std::vector<AttributeInfo>& getAttributeInfos ( ) const
inline

Get attribute informations.

Returns
Attribute informations.
GLuint getHandler ( ) const
inline

Get program object.

Returns
Program object.
virtual UniformLocation getUniformLocation ( const std::string &  uniform) const
overridevirtual

Get uniform location by name.

Parameters
uniformSpecifies the uniform name.
Returns
The uniform location.

Implements Program.

virtual UniformLocation getUniformLocation ( backend::Uniform  name) const
overridevirtual

Get uniform location by engine built-in uniform enum name.

Parameters
nameSpecifies the engine built-in uniform enum name.
Returns
The uniform location.

Implements Program.

virtual int getAttributeLocation ( const std::string &  name) const
overridevirtual

Get attribute location by attribute name.

Parameters
nameSpecifies the attribute name.
Returns
The attribute location.

Implements Program.

virtual int getAttributeLocation ( Attribute  name) const
overridevirtual

Get attribute location by engine built-in attribute enum name.

Parameters
nameSpecifies the engine built-in attribute enum name.
Returns
The attribute location.

Implements Program.

virtual int getMaxVertexLocation ( ) const
overridevirtual

Get maximum vertex location.

Returns
Maximum vertex locaiton.

Implements Program.

virtual int getMaxFragmentLocation ( ) const
overridevirtual

Get maximum fragment location.

Returns
Maximum fragment location.

Implements Program.

virtual const std::unordered_map<std::string, AttributeBindInfo> getActiveAttributes ( ) const
overridevirtual

Get active vertex attributes.

Returns
Active vertex attributes. key is active attribute name, Value is corresponding attribute info.

Implements Program.

virtual std::size_t getUniformBufferSize ( ShaderStage  stage) const
overridevirtual

Get uniform buffer size in bytes that can hold all the uniforms.

Parameters
stageSpecifies the shader stage. The symbolic constant can be either VERTEX or FRAGMENT.
Returns
The uniform buffer size in bytes.

Implements Program.

virtual const UniformInfo& getActiveUniformInfo ( ShaderStage  stage,
int  location 
) const
overridevirtual

Get a uniformInfo in given location from the specific shader stage.

Parameters
stageSpecifies the shader stage. The symbolic constant can be either VERTEX or FRAGMENT.
locationSpecifies the uniform locaion.
Returns
The uniformInfo.

Implements Program.

virtual const std::unordered_map<std::string, UniformInfo>& getAllActiveUniformInfo ( ShaderStage  stage) const
overridevirtual

Get all uniformInfos.

Returns
The uniformInfos.

Implements Program.


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