Original Post
hello, My goal is to have two threads. One to handle the main program, and the other one to load textures. But i fail to apply the texture i had loaded to the triangle i draw. here the first thread : and the second thread : if i put everything in the same thread, the program work well, but when i put the texture loading's part in the second thread, the triangle stay white, i suppose there is a problem on how to share the texture. Thanks in advance for your help ! [Edited by - cbastien on June 18, 2007 7:49:35 AM]
glutInit(&iii, c);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("test");
glutDisplayFunc(window_display);
glutIdleFunc(window_display);
glutReshapeFunc(window_reshape);
glutMainLoop();
GLubyte Texture[16] =
{
0xCC,0xCC,0xCC,0xCC, 0xCC,0xCC,0xCC,0xCC,
0xCC,0xCC,0xCC,0xCC, 0xCC,0xCC,0xCC,0xCC
};
glClearColor(.5,.5,.5,0); //Change la couleur du fond
glEnable(GL_DEPTH_TEST); //Active le depth test
glEnable(GL_TEXTURE_2D); //Active le texturing
glGenTextures(1, &g_Texture[num_texture] );
glBindTexture( GL_TEXTURE_2D, g_Texture[num_texture] );
glTexImage2D (
GL_TEXTURE_2D, //Type : texture 2D
0, //Mipmap : aucun
4, //Couleurs : 4
2, //Largeur : 2
2, //Hauteur : 2
0, //Largeur du bord : 0
GL_RGBA, //Format : RGBA
GL_UNSIGNED_BYTE, //Type des couleurs
Texture //Addresse de l'image
);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);