Quote Originally Posted by didier View Post
A this time, no. I have just written this piece of code.


Qt Code:
  1. class GLWidget :public QGLWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. GLWidget(QWidget* argParent = 0,
  6. const QGLWidget* argShareWidget = 0,
  7. Qt::WindowFlags argFlags = 0 );
  8.  
  9. signals:
  10. void sizeChanges(QSize const&);
  11. void doubleClick(QPoint const&);
  12. void click(QPoint const&);
  13.  
  14. protected:
  15. void initializeGL();
  16. void resizeGL(int argWidth, int argHeight);
  17. void mouseDoubleClickEvent(QMouseEvent* event);
  18. void mouseReleaseEvent(QMouseEvent* event);
  19. void paintGL();
  20.  
  21. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "../include/GLWidget.h"
  2.  
  3. GLWidget::GLWidget(QWidget* argParent,
  4. const QGLWidget* argShareWidget,
  5. Qt::WindowFlags argFlags)
  6.  
  7. :QGLWidget(argParent,
  8. argShareWidget,
  9. argFlags)
  10. {
  11. }
  12.  
  13. void GLWidget::initializeGL()
  14. {
  15. }
  16.  
  17. void GLWidget::resizeGL(int argWidth, int argHeight)
  18. {
  19. emit sizeChanges(QSize(argWidth, argHeight));
  20. }
  21.  
  22.  
  23. void GLWidget::paintGL()
  24. {
  25. }
  26.  
  27. void GLWidget::mouseDoubleClickEvent(QMouseEvent* event)
  28. {
  29. emit doubleClick(event->pos());
  30. }
  31.  
  32. void GLWidget::mouseReleaseEvent(QMouseEvent* event)
  33. {
  34. emit click(event->pos());
  35. }
To copy to clipboard, switch view to plain text mode 

I've believed, an instant, it's because my OpenGL implementation is 4.1 and Qt 4.6.3 wouldn't recognize OpenGL 4.1 because of enum QGLFormat::OpenGLVersionFlag's definition.

About glGetString(). The problem is over. I've discovered glContext is inititialized in after QGLWidget() constructor. In paintGL(), it works well.
Good to know about QGLFormat::OpenGLVersionFlag.