Hello anyone,

I have Qt-4.2.3 on WindowsXP
I have made a cube that is rotating on y-axis with a logo on the sides.
I put the cube into QMessageBox but i see only a part of the height of the glWidget.
I have also done this on Linux there i see the compleet cube.
Is this a misbehavior on WindowsXP or i missing something.

my glWidget.cpp
Qt Code:
  1. #include <QtGui>
  2. #include <QtOpenGL>
  3. #include <QGLWidget>
  4.  
  5. #include <math.h>
  6.  
  7. #include "glwidget.h"
  8.  
  9.  
  10. GLWidget::GLWidget(QWidget *parent)
  11. : QGLWidget(parent)
  12. {
  13. clearColor = Qt::red;
  14. yRot = 0;
  15. QTimer *timer = new QTimer(this);
  16. connect(timer, SIGNAL(timeout()), this, SLOT(animate()));
  17. timer->start(5);
  18. }
  19.  
  20. GLWidget::~GLWidget()
  21. {
  22. makeCurrent();
  23. glDeleteLists(object, 1);
  24. }
  25.  
  26. QSize GLWidget::minimumSizeHint() const
  27. {
  28. return QSize(50, 50);
  29. }
  30.  
  31. QSize GLWidget::sizeHint() const
  32. {
  33. return QSize(200, 200);
  34. }
  35.  
  36.  
  37.  
  38. void GLWidget::setClearColor(const QColor &color)
  39. {
  40. clearColor = color;
  41. updateGL();
  42. }
  43.  
  44. void GLWidget::initializeGL()
  45. {
  46.  
  47. object = makeObject();
  48. glEnable(GL_DEPTH_TEST);
  49. glEnable(GL_CULL_FACE);
  50. glEnable(GL_TEXTURE_2D);
  51. }
  52.  
  53. void GLWidget::paintGL()
  54. {
  55. qglClearColor(clearColor);
  56. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  57. glLoadIdentity();
  58. glTranslated(0.0, 0.0, -12.0);
  59. glRotated(yRot, 0.0, 1.0, 0.0);
  60. glCallList(object);
  61. }
  62.  
  63. void GLWidget::resizeGL(int width, int height)
  64. {
  65. glViewport(0, 0, width, height);
  66.  
  67. glMatrixMode(GL_PROJECTION);
  68. glLoadIdentity();
  69. glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
  70. glMatrixMode(GL_MODELVIEW);
  71. glLoadIdentity();
  72. }
  73.  
  74.  
  75.  
  76. GLuint GLWidget::makeObject()
  77. {
  78. static const int coords[4][4][3] = {
  79. { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
  80. { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
  81. { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
  82. { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
  83. };
  84.  
  85.  
  86. GLuint textures[4];
  87. for (int j=0; j < 4; ++j)
  88. textures[j] = bindTexture(QPixmap(QString(":/images/triple%1.png").arg(j + 1)),
  89. GL_TEXTURE_2D);
  90.  
  91. GLuint list = glGenLists(1);
  92. glNewList(list, GL_COMPILE);
  93. for (int i = 0; i < 4; ++i) {
  94. glBindTexture(GL_TEXTURE_2D, textures[i]);
  95. glBegin(GL_QUADS);
  96. for (int j = 0; j < 4; ++j) {
  97. glTexCoord2d(j == 0 || j == 3, j == 0 || j == 1);
  98. glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1],
  99. 0.2 * coords[i][j][2]);
  100. }
  101. glEnd();
  102. }
  103.  
  104. glEndList();
  105. return list;
  106. }
  107.  
  108. void GLWidget::animate()
  109. {
  110.  
  111. yRot += 1.0f;
  112. updateGL();
  113. }
To copy to clipboard, switch view to plain text mode 

Part of my MainWindow.cpp
Qt Code:
  1. void MainWindow::info()
  2. {
  3. QMessageBox *mb = new QMessageBox(this);
  4. mb->setWindowTitle("Triple/S");
  5. mb->setPalette(QPalette(qRgb(255, 255, 255)));
  6. mb->setAutoFillBackground(true);
  7. mb->setWindowIcon(QIcon(":/images/triple20.png"));
  8. glWidget = new GLWidget(mb);
  9. mb->setText( " some text....");
  10. mb->exec();
  11. }
To copy to clipboard, switch view to plain text mode 
I also try glWidget->show(); the same result.
thanks in advance.