本文整理汇总了C++中ShaderProgram::GetUniformVariableIDFromName方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderProgram::GetUniformVariableIDFromName方法的具体用法?C++ ShaderProgram::GetUniformVariableIDFromName怎么用?C++ ShaderProgram::GetUniformVariableIDFromName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram::GetUniformVariableIDFromName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetProjectionMatrixUniform
//-----------------------------------------------------------------------------------------------
inline bool Material::SetProjectionMatrixUniform( const std::string& uniformName )
{
int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
if( uniformID == -1 )
return false;
m_projectionMatrixUniformLocation = uniformID;
return true;
}
示例2: SetIntegerUniform
//-----------------------------------------------------------------------------------------------
inline bool Material::SetIntegerUniform( const std::string& uniformName, int value )
{
int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
if( uniformID == -1 )
return false;
Renderer* renderer = Renderer::GetRenderer();
renderer->SetUniformVariable( uniformID, value );
return true;
}
示例3: SetFloatUniform
//-----------------------------------------------------------------------------------------------
inline bool Material::SetFloatUniform( const std::string& uniformName, const FloatVector4& vector )
{
int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
if( uniformID == -1 )
return false;
Renderer* renderer = Renderer::GetRenderer();
renderer->SetUniformVariable( uniformID, vector );
return true;
}
示例4: SetTextureUniform
//-----------------------------------------------------------------------------------------------
inline bool Material::SetTextureUniform( const std::string& uniformName, int textureUnitID, const std::string& textureFileLocation )
{
int uniformID = m_program->GetUniformVariableIDFromName( uniformName );
if( uniformID == -1 )
return false;
Renderer* renderer = Renderer::GetRenderer();
TextureInfo texInfo;
texInfo.textureUnitID = textureUnitID;
renderer->SetActiveTextureUnit( textureUnitID );
texInfo.texture = Texture::CreateOrGetTexture( textureFileLocation, Texture::linearInterpolation, Texture::clampToEdge );
renderer->SetUniformVariable( uniformID, textureUnitID );
texInfo.samplerUniformID = uniformID;
m_infoForTextures.push_back( texInfo );
return true;
}