Shaders can handle integer parameters (uniforms).
This commit is contained in:
parent
97f914ccb3
commit
fe6c901a9f
|
@ -117,7 +117,7 @@ bool SHADER::Link()
|
|||
}
|
||||
|
||||
|
||||
void SHADER::AddParameter( const std::string& aParameterName )
|
||||
int SHADER::AddParameter( const std::string& aParameterName )
|
||||
{
|
||||
GLint location = glGetUniformLocation( programNumber, aParameterName.c_str() );
|
||||
|
||||
|
@ -125,15 +125,23 @@ void SHADER::AddParameter( const std::string& aParameterName )
|
|||
{
|
||||
parameterLocation.push_back( location );
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
void SHADER::SetParameter( int parameterNumber, float value )
|
||||
void SHADER::SetParameter( int parameterNumber, float value ) const
|
||||
{
|
||||
glUniform1f( parameterLocation[parameterNumber], value );
|
||||
}
|
||||
|
||||
|
||||
void SHADER::SetParameter( int parameterNumber, int value ) const
|
||||
{
|
||||
glUniform1i( parameterLocation[parameterNumber], value );
|
||||
}
|
||||
|
||||
|
||||
int SHADER::GetAttribute( std::string aAttributeName ) const
|
||||
{
|
||||
return glGetAttribLocation( programNumber, aAttributeName.c_str() );
|
||||
|
|
|
@ -141,8 +141,9 @@ public:
|
|||
* method using the queue position.
|
||||
*
|
||||
* @param aParameterName is the name of the parameter.
|
||||
* @return the added parameter location.
|
||||
*/
|
||||
void AddParameter( const std::string& aParameterName );
|
||||
int AddParameter( const std::string& aParameterName );
|
||||
|
||||
/**
|
||||
* @brief Set a parameter of the shader.
|
||||
|
@ -150,7 +151,8 @@ public:
|
|||
* @param aParameterNumber is the number of the parameter.
|
||||
* @param aValue is the value of the parameter.
|
||||
*/
|
||||
void SetParameter( int aParameterNumber, float aValue );
|
||||
void SetParameter( int aParameterNumber, float aValue ) const;
|
||||
void SetParameter( int aParameterNumber, int aValue ) const;
|
||||
|
||||
/**
|
||||
* @brief Gets an attribute location.
|
||||
|
|
Loading…
Reference in New Issue