bonjour,
j'ai un projet opengl
j'ai suivi le code des tutoriels pour faire une GLwidget
mais mon problème que si j'ai un grand nuage de point j'ai une lourdeur dans l'affichage qui l'influent de même sur les transformation qui seront tréés lourd
pour cela SVP est ce que il y a quelqu'un qui peut m'aider et me donner la meilleur façon d'optimiser l'affichage et aussi de corrigé ce problème.
Merci d'avance.

ICI Vous trouvez la structure de mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
 
 
// constructeur
GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(parent)
{
    xRot = 0;
    yRot = 0;
    zRot = 0;
     xRotanc = 0;
    yRotanc = 0;
    zRotanc = 0;
    xTrans = 0;
    yTrans = 0;
    couleurback=0;
}
 
 
GLWidget::~GLWidget()
{
    makeCurrent();
     glDeleteLists(form, 1);
}
 
// initialisation
 
void GLWidget::initializeGL()
{
 
    this->lumiere=1;
    this->mode=1;
    this->debut=1;
    this->select=0;
        this->selectstalag=0;
    static const GLfloat lightPos[4] = { 5.0f, 5.0f, 10.0f, 1.0f };
    static const GLfloat reflectance1[4] = { 0.8f, 0.1f, 0.0f, 1.0f };
    static const GLfloat reflectance2[4] = { 0.0f, 0.8f, 0.2f, 1.0f };
    static const GLfloat reflectance3[4] = { 0.2f, 0.2f, 1.0f, 1.0f };
 
    glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);
form=dessinForm(GL_RENDER);
 
    glEnable(GL_NORMALIZE);
    couleurback=0;
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);   
    xTrans=0;
    yTrans=0;
    zTrans=0;
    xRot=0.0;
    yRot=0.0;
    zRot=0.0;
    afficheaxe=0;
    affichenormale=0;
    affichecercle=0;
 
}
 
// fonction de changement de dimension
void GLWidget::resizeGL(int width, int height)
{
    this->w=width;
    this->h=height;
    int side = qMax(width, height);
    glViewport((width - side) / 2, (height - side) / 2, side, side);
        glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
   glFrustum(-1.0, +1.0, -1.0, 1.0, 5.0, 60.0);
    glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
  glTranslated(0.0, 0.0, -15.0);
 
 
}
// fonction d'affichage GL
 
 
void GLWidget::paintGL()
{
 
 glRenderMode (GL_RENDER);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glPushMatrix(); 
    if(xTrans!=0 ||yTrans!=0){
 
    glTranslated(xTrans/100.0, -yTrans/100.0,0.0);
 
        }
 
    if(xRot!=0 ||yRot!=0||zRot!=0){
 
   glRotated(-xRot/16.0, 1.0, 0.0, 0.0);
  glRotated(yRot/16.0, 0.0, 1.0, 0.0);
 glRotated(zRot/16.0, 0.0, 0.0, 1.0);
 
    }
 
 
glColor3f(0.75f,0.75f,1.0f);
glCallList(form);
glPopMatrix();
    glFlush ();    
}
 
 
// construction de l'objet à afficher
 
 
GLuint GLWidget::dessinForm(GLenum mode){
GLuint list = glGenLists(1);
glNewList(list, GL_COMPILE);
 
 
for(i=0;i<n;i++){
 
v1=o->getM_faces()[i].getM_v1();
v2=o->getM_faces()[i].getM_v2();
v3=o->getM_faces()[i].getM_v3();
 
 
 
p=o->getM_vert()[v1].getNorm();
x1=p->x();
y1=p->y();
z1=p->z();
 
glNormal3d(x1,y1,z1);
if(o->getM_vert()[v1].getM_visible()==1 && o->getM_vert()[v2].getM_visible()==1 && o->getM_vert()[v3].getM_visible()==1){   
 
   glBegin(GL_TRIANGLES);    
    // Drawing Using Triangles
x=o->getM_vert()[v1].getX();
y=o->getM_vert()[v1].getY();
z=o->getM_vert()[v1].getZ();
 
glColor3ub(o->getM_vert()[v1].GetColor()->r(),o->getM_vert()[v1].GetColor()->g(),o->getM_vert()[v1].GetColor()->b());
glVertex3d( x, y, z);        // Top
 
p=o->getM_vert()[v2].getNorm();
x1=p->x();
y1=p->y();
z1=p->z();
glNormal3d(x1,y1,z1);
glColor3ub(o->getM_vert()[v2].GetColor()->r(),o->getM_vert()[v2].GetColor()->g(),o->getM_vert()[v2].GetColor()->b());
glVertex3d(o->getM_vert()[v2].getX(),o->getM_vert()[v2].getY(), o->getM_vert()[v2].getZ());        // Bottom Left
 
p=o->getM_vert()[v3].getNorm();
x1=p->x();
y1=p->y();
z1=p->z();
 
glNormal3d(x1,y1,z1);
glColor3ub(o->getM_vert()[v3].GetColor()->r(),o->getM_vert()[v3].GetColor()->g(),o->getM_vert()[v3].GetColor()->b());
 
glVertex3d( o->getM_vert()[v3].getX(),o->getM_vert()[v3].getY(), o->getM_vert()[v3].getZ());        // Bottom Right
// Finished Drawing
glEnd();
 
 
      glEndList();
 
    return list;
}