bool WShaderProgram::isValid() const
{
    GLint validated;
	glValidateProgramARB( programId() );
    glGetObjectParameterivARB( programId(), GL_OBJECT_VALIDATE_STATUS_ARB, &validated );
	return validated != 0;
}
void WShaderProgram::setValue1i( const char *name, int v1 )
{
	GLint loc = glGetUniformLocationARB( programId(), name );
	glUniform1iARB( loc, v1 );
	GLenum err = glGetError();
	const GLubyte *msg = gluErrorString( err );
}
void WShaderProgram::setValue3f( const char *name, float v1,float v2, float v3 )
{
	GLint loc = glGetUniformLocationARB( programId(), name );
	glUniform3fARB( loc, v1, v2, v3 );
}
void WShaderProgram::getValue1i( const char *name, int &v1 )
{
	GLint loc = glGetUniformLocationARB( programId(), name );
	glGetUniformivARB( programId(), loc, &v1 );
}
std::string WShaderProgram::log() const
{
	GLcharARB infoLog[1024] = "";
	glGetInfoLogARB( programId(), sizeof(infoLog), NULL, infoLog );
	return std::string( infoLog );
}
bool WShaderProgram::isLinked() const
{
	GLint linkStatus;
    glGetObjectParameterivARB( programId(), GL_OBJECT_LINK_STATUS_ARB, &linkStatus );
    return linkStatus != 0;
}
bool WShaderProgram::link()
{
	if( !programId() ) return false;
	glLinkProgramARB( programId() );
	return isLinked();
}
bool WShaderProgram::addShader( const WShader* shader )
{
	if( !programId() || !shader || !shader->shaderId() ) return false;
	glAttachObjectARB( programId(), shader->shaderId() );
	return true;
}
Beispiel #9
0
void Z3DShaderProgram::bindFragDataLocation(GLuint colorNumber, const QString &name)
{
  if (GLEW_VERSION_3_0) {
    glBindFragDataLocation(programId(), colorNumber, name.toLocal8Bit().constData());
  }
}