mystery/src/graphics/shader.cpp
// generates a program for the vertex and fragment shaders provided
generates a program for the vertex and fragment shaders provided
generates a program for the vertex and fragment shaders provided
unsigned int Shader::CreateShader(const std::string& src_vertex_shader, const std::string& src_fragment_shader) {
			unsigned int program = glCreateProgram();
			unsigned int vertex_shader = CompileShader(GL_VERTEX_SHADER, src_vertex_shader);
			unsigned int fragment_shader = CompileShader(GL_FRAGMENT_SHADER, src_fragment_shader);
			glAttachShader(program, vertex_shader);
			glAttachShader(program, fragment_shader);
			glLinkProgram(program);
			glValidateProgram(program);
			glDeleteShader(vertex_shader);
			glDeleteShader(fragment_shader);
			return program;
		}
unsigned int Shader :: CreateShader ( const std :: string & src_vertex_shader , const std :: string & src_fragment_shader ) { unsigned int program = glCreateProgram ( ) ; unsigned int vertex_shader = CompileShader ( GL_VERTEX_SHADER , src_vertex_shader ) ; unsigned int fragment_shader = CompileShader ( GL_FRAGMENT_SHADER , src_fragment_shader ) ; glAttachShader ( program , vertex_shader ) ; glAttachShader ( program , fragment_shader ) ; glLinkProgram ( program ) ; glValidateProgram ( program ) ; glDeleteShader ( vertex_shader ) ; glDeleteShader ( fragment_shader ) ; return program ; }
generates a program for the vertex and fragment shaders provided
generates a program for the vertex and fragment shaders provided