Hello! I have such a problem: program should display on widget few triangles, which have same vertex. But program display only a vertex))) Can you help me?

Scene.h

Qt Code:
  1. #ifndef SCENE_H
  2. #define SCENE_H
  3.  
  4. #include <QOpenGLWidget>
  5. #include <QKeyEvent>
  6.  
  7. class Scene : public QOpenGLWidget
  8. {
  9.  
  10. public:
  11. Scene( QWidget *parent = 0 );
  12.  
  13. private:
  14. void initializeGL();
  15. void paintGL();
  16. void resizeGL( int w, int h );
  17.  
  18.  
  19. };
  20.  
  21. #endif // SCENE_H
To copy to clipboard, switch view to plain text mode 

Scene.cpp

Qt Code:
  1. #include "scene.h"
  2. #include <math.h>
  3.  
  4. #define GL_PI 3.1415f
  5.  
  6. Scene::Scene ( QWidget *parent ) :
  7. QOpenGLWidget ( parent )
  8. {
  9.  
  10. }
  11.  
  12. void Scene::initializeGL()
  13. {
  14. glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
  15. glColor3f( 0.0f, 1.0f, 0.0f );
  16. glShadeModel( GL_FLAT );
  17. glFrontFace( GL_CW );
  18.  
  19. }
  20.  
  21. void Scene::paintGL()
  22. {
  23. GLfloat angle, x, y;
  24.  
  25. glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
  26. glBegin( GL_TRIANGLE_FAN );
  27. glVertex3f( 0.0f, 0.0f, 75.0f );
  28. for( angle = 0.0f; angle < ( 2.0f*GL_PI ); angle += ( GL_PI/8.f ) ){
  29. x = 50.0f*sin( angle );
  30. y = 50.0f*cos( angle );
  31.  
  32. glVertex2f( x, y );
  33. }
  34. glEnd();
  35. glFlush();
  36. }
  37.  
  38. void Scene::resizeGL(int w, int h)
  39. {
  40. glViewport( 0, 0, w, h );
  41. glOrtho( -100.0f, 100.0f, -100.0f, 100.0f, 100.0f, -100.0f );
  42.  
  43. }
To copy to clipboard, switch view to plain text mode