#include "fragmentshader.h"
#include <string.h>
#include "mmap.h"
#include "m3derror.h"

namespace M3D {

FragmentShader::FragmentShader()
 : Shader()
{
}


FragmentShader::~FragmentShader()
{
}
void FragmentShader::load(const char *shader_source)
{
	_shader_id_ = glCreateShader(GL_FRAGMENT_SHADER);
	glShaderSource( _shader_id_, 1, (const GLchar**) &shader_source, NULL);
	glCompileShader(_shader_id_);
	GLint status;
	glGetShaderiv(_shader_id_, GL_COMPILE_STATUS, &status);
	if (!status) {
		char error_buf[2048];
		int size = 2048;
		glGetShaderInfoLog(_shader_id_, 2048, &size, error_buf);
		THROW(error_buf);
	}
}

}
