Bonjour,
J'essaye de créer une texture transparente pour le feuillage de mes arbres. Voici les instructions :
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
 
data = (GLuint *)calloc( 1, ((width * height)* 4 * sizeof(GLuint)) );
 
...
glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
 
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
...
glViewport(0,0,width,height);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
...
glBindTexture(GL_TEXTURE_2D, texture_id);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, width, height, 0);
Mon problème c'est que quand j'utilise la texture elle est sur fond noir et non transparent ... Quelqu'un sait-il pourquoi?

Merci d'avance.