Hello everybody,

I don't succeed in finding solution in following problem:

I know renderPixmap use initializeGL(), resizeGL(), and paintGL() in a new context.
So I do test with only one triangle textured. the list is creat with it's texture in initializeGL()
Result is good in window OpenGL but when I use renderPixmap, I got my triangle without image texture.

Here example code use in initializeGL() :
Qt Code:
  1. void ViewerOGL::initializeGL(){
  2. glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Efface en noir
  3. glClearDepth(1.0f);
  4. glEnable(GL_DEPTH_TEST ); // Autorise le test de profondeur
  5. glDepthFunc(GL_LEQUAL);
  6. glFrontFace(GL_CCW ); // Normale dans le sens horaire
  7. glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
  8. glShadeModel(GL_SMOOTH); // Autorise anti-aliasing
  9. glEnable(GL_CULL_FACE ); // Face arriere cache
  10. glEnable(GL_LIGHT0); // Active la 1ere lampe
  11. glEnable(GL_COLOR_MATERIAL); // Autorise les materiaux
  12. glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); // Autorise l'affichage
  13.  
  14. glNewList(1, GL_COMPILE);
  15. QImage img("C:\\test.png");
  16. QImage tex;
  17. tex = QGLWidget::convertToGLFormat(img);
  18. GLuint nuId;
  19. glGenTextures(1, &nuId); // ID OpenGL sur la texture
  20. glBindTexture(GL_TEXTURE_2D, nuId);
  21. glTexImage2D(GL_TEXTURE_2D, 0, 4, tex.width(), tex.height(), 0, GL_RGBA,GL_UNSIGNED_BYTE, tex.bits());
  22. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  23. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  24. glEnable(GL_TEXTURE_2D);
  25. glBegin(GL_TRIANGLES);
  26. glTexCoord2f(0, 0);
  27. glNormal3f(0, 0, 1);
  28. glVertex3f(0, 0, 0);
  29. glTexCoord2f(1, 0);
  30. glNormal3f(0, 0, 1);
  31. glVertex3f(200, 0, 0);
  32. glTexCoord2f(0.5, 1);
  33. glNormal3f(0, 0, 1);
  34. glVertex3f(100, 200, 0);
  35. glEnd();
  36. glDisable(GL_TEXTURE_2D);
  37. glEndList();
  38. }
To copy to clipboard, switch view to plain text mode 

Perhaps I forget an Enable, but which ?
Tanks for help