Made the management of the "current shader" more consistent
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1366 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
4eed417158
commit
5a0feadb8f
@ -110,6 +110,7 @@ void Shader::SetParameter(const std::string& name, float x)
|
|||||||
if (myShaderProgram)
|
if (myShaderProgram)
|
||||||
{
|
{
|
||||||
// Enable program
|
// Enable program
|
||||||
|
GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
|
||||||
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
||||||
|
|
||||||
// Get parameter location and assign it new values
|
// Get parameter location and assign it new values
|
||||||
@ -120,7 +121,7 @@ void Shader::SetParameter(const std::string& name, float x)
|
|||||||
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
||||||
|
|
||||||
// Disable program
|
// Disable program
|
||||||
GLCheck(glUseProgramObjectARB(0));
|
GLCheck(glUseProgramObjectARB(program));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,6 +132,7 @@ void Shader::SetParameter(const std::string& name, float x, float y)
|
|||||||
if (myShaderProgram)
|
if (myShaderProgram)
|
||||||
{
|
{
|
||||||
// Enable program
|
// Enable program
|
||||||
|
GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
|
||||||
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
||||||
|
|
||||||
// Get parameter location and assign it new values
|
// Get parameter location and assign it new values
|
||||||
@ -141,7 +143,7 @@ void Shader::SetParameter(const std::string& name, float x, float y)
|
|||||||
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
||||||
|
|
||||||
// Disable program
|
// Disable program
|
||||||
GLCheck(glUseProgramObjectARB(0));
|
GLCheck(glUseProgramObjectARB(program));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +154,7 @@ void Shader::SetParameter(const std::string& name, float x, float y, float z)
|
|||||||
if (myShaderProgram)
|
if (myShaderProgram)
|
||||||
{
|
{
|
||||||
// Enable program
|
// Enable program
|
||||||
|
GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
|
||||||
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
||||||
|
|
||||||
// Get parameter location and assign it new values
|
// Get parameter location and assign it new values
|
||||||
@ -162,7 +165,7 @@ void Shader::SetParameter(const std::string& name, float x, float y, float z)
|
|||||||
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
||||||
|
|
||||||
// Disable program
|
// Disable program
|
||||||
GLCheck(glUseProgramObjectARB(0));
|
GLCheck(glUseProgramObjectARB(program));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +176,7 @@ void Shader::SetParameter(const std::string& name, float x, float y, float z, fl
|
|||||||
if (myShaderProgram)
|
if (myShaderProgram)
|
||||||
{
|
{
|
||||||
// Enable program
|
// Enable program
|
||||||
|
GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
|
||||||
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
GLCheck(glUseProgramObjectARB(myShaderProgram));
|
||||||
|
|
||||||
// Get parameter location and assign it new values
|
// Get parameter location and assign it new values
|
||||||
@ -183,7 +187,7 @@ void Shader::SetParameter(const std::string& name, float x, float y, float z, fl
|
|||||||
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
std::cerr << "Parameter \"" << name << "\" not found in shader" << std::endl;
|
||||||
|
|
||||||
// Disable program
|
// Disable program
|
||||||
GLCheck(glUseProgramObjectARB(0));
|
GLCheck(glUseProgramObjectARB(program));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +326,7 @@ bool Shader::CompileProgram()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy effect program if it was already created
|
// Destroy the shader if it was already created
|
||||||
if (myShaderProgram)
|
if (myShaderProgram)
|
||||||
GLCheck(glDeleteObjectARB(myShaderProgram));
|
GLCheck(glDeleteObjectARB(myShaderProgram));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user