bool SProgram::CompositeProgram()
{
	m_programID = glCreateProgram();

	m_vertShader->AttachToProgram(m_programID);
	m_fragShader->AttachToProgram(m_programID);
	m_geomShader->AttachToProgram(m_programID);
	m_tessCShader->AttachToProgram(m_programID);
	m_tessEShader->AttachToProgram(m_programID);

	glLinkProgram(m_programID);

	if (!CheckProgramStatus(m_programID))
	{
		Console::Log(C_LOG_TYPE::LOG_ERROR, "%s PROGRAM FAILED TO INIT\n", m_programName);
		return false;
	}

	m_vertShader->CleanUp();
	m_fragShader->CleanUp();
	m_geomShader->CleanUp();
	m_tessCShader->CleanUp();
	m_tessEShader->CleanUp();

	Console::Log(C_LOG_TYPE::LOG_SUCCESS, "%s PROGRAM SUCCESSFULL TO INIT\n", m_programName);
	return true;
}
示例#2
0
void Shader::LoadShaders(char* vertexFile, char* fragmentFile)
{
	GLuint vertexShader=glCreateShader(GL_VERTEX_SHADER);
	GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
	

	const char* shaderSource;
	shaderSource = ReadFile(vertexFile);
	
	glShaderSource(vertexShader, 1, &shaderSource, 0);
	
	shaderSource = ReadFile(fragmentFile);
	glShaderSource(fragmentShader, 1, &shaderSource, 0);
	
	glCompileShader(vertexShader);
	glCompileShader(fragmentShader);

	if (!CheckShaderStatus(vertexShader) || !CheckShaderStatus(fragmentShader))
	{
		system("pause");
	}

	programID = glCreateProgram();

	glAttachShader(programID, vertexShader);
	glAttachShader(programID, fragmentShader);

	glLinkProgram(programID);

	if (!CheckProgramStatus(programID))
	{
		return;
	}

}