Ejemplo n.º 1
0
cShaderProgram::cShaderProgram( const std::vector<cShader*>& Shaders, const std::string& name ) :
	mHandler(0),
	mId(0)
{
	AddToManager( name );
	Init();

	AddShaders( Shaders );

	Link();
}
Ejemplo n.º 2
0
void	initTessexample(){

    //test_tcs.glsl Tessellation Control Shader
    // test_tes.glsl Tesselation Evaluation Shader
    shaderProgram = AddShaders("test_vs.glsl", "test_fs.glsl", NULL, NULL, "test_tcs.glsl", "test_tes.glsl", NULL);

	glEnable(GL_DEPTH_TEST); // enable depth-testing
	glDepthFunc(GL_LESS); // depth-testing interprets a smaller value as "closer"
	glClearColor(0.2, 0.2, 0.2, 1.0);

	/* i've made the mesh 2 triangles, to help illustrate the numbers used for
	patch size versus points to draw */
	GLfloat points[] = {
		0.0f, 0.75f, 0.0f,
		0.5f, 0.25f, 0.0f,
		-0.5f, 0.25f, 0.0f,
		0.5f, -0.25f, 0.0f,
		0.0f, -0.75f, 0.0f,
		-0.5f, -0.25f, 0.0f
	};


	glGenBuffers(1, &tvbo);
	glBindBuffer(GL_ARRAY_BUFFER, tvbo);
	glBufferData(GL_ARRAY_BUFFER, sizeof(points), points, GL_STATIC_DRAW);

	glGenVertexArrays(1, &tvao);
	glBindVertexArray(tvao);
	glBindBuffer(GL_ARRAY_BUFFER, tvbo);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
	glEnableVertexAttribArray(0);


	

}