Bonjour,

Je voulais savoir comment faire pour appliquer 2 shaders l'un à la suite de l'autre.

Voila la description en image :

Effet phong


Création des trou dans la boules :


Ces 2 effets étant réalisés par 2 shaders différents.

Dans mon code je ne sais pas malheureusement comment les combiner.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
 
void Plateform::render() {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
 
	glUseProgram(program);
	float minR = glGetUniformLocation(program,"minRadius");
	glUniform1f(minR,0.55);
 
	glEnable(GL_ALPHA_TEST);
	glAlphaFunc(GL_GREATER, 0.0f);
 
        glUseProgram(phongProgram);
	int nbLight = glGetUniformLocation(phongProgram,"numLights");
	glUniform1i(nbLight,1);	
 
 
	glColor3f(1.0,0.0,0.0);
	glMaterialfv(GL_FRONT, GL_AMBIENT, ambiantMt);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseMt);
	glMaterialfv(GL_FRONT, GL_SPECULAR, specularMt);
	glMaterialf(GL_FRONT, GL_SHININESS, 25.0);
	glPushMatrix();
		//glTranslatef(0.0,0.0,0.0);
		gluSphere(openGLSphere,1.0,24,24);
	glPopMatrix();
 
	glUseProgram(0);
 
	glColor3f(1.0,1.0,1.0);
	/*glPushMatrix();
		//glTranslatef(0.0,0.0,0.0);
		gluSphere(openGLSphere,0.3,24,24);
	glPopMatrix();*/
 
	/* Dessin du sprite avec transparence */
	glDisable(GL_ALPHA_TEST);
	glColor3f(1.0,1.0,1.0);
	glutSwapBuffers();
	glutPostRedisplay();
}