本文使用QGLWidget来绘制各种三维基本图形,包括立方体、圆柱体、圆锥、球体、圆环等等,涉及包括基本绘制以及上色、纹理、旋转等操作。

使用的软件版本:QT5.12 + QT Creater4.8.0

 GLWidget.h
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
 
#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QGLWidget>

class GLWidget : public QGLWidget
{
    Q_OBJECT

public:
    GLWidget(QWidget *parent = );
    ~GLWidget();

protected:
    // 设置渲染环境
    void initializeGL();
    // 绘制窗口
    void paintGL();
    // 响应窗口的大小变化
    void resizeGL(int width, int height);

private:
    // 场景渲染
    void renderScene();
    // 场景渲染-基本图形
    void renderBasicShape();
    // 场景渲染-立方体纹理
    void renderTextureCube();
    // 场景渲染-圆柱体纹理
    void renderTextureCylinder();
    // 绘制立方体
    void drawCube();
    // 绘制圆形
    void drawCircle();
    // 绘制圆柱体
    void drawCylinder();
    // 绘制圆锥体
    void drawCone();
    // 绘制四面体
    void drawTetrahedron();
    // 绘制球体
,
                    GLfloat yy = ,
                    GLfloat zz = ,
                    GLfloat radius = ,
                    GLfloat M = ,
                    GLfloat N = );
    // 绘制圆环
,
                   ,
                   ,
                   );
    // 加载纹理
    void loadGLTextures();

private:
    // 旋转角度
    GLfloat  xRot;
    GLfloat  yRot;
    GLfloat  zRot;
    // 存储纹理
];

};
#endif // GLWIDGET_H

GLWidget.cpp
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
 
#include "GLWidget.h"
#include <qmath.h>

.5f

void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{
    );
    const GLdouble ymin = -ymax;
    const GLdouble xmin = ymin * aspect;
    const GLdouble xmax = ymax * aspect;
    glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}

GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(parent)
    , xRot(.0f)
    , yRot(.0f)
    , zRot(.0f)
{
    // 设置画面的双缓冲和深度缓存
    setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
}

GLWidget::~GLWidget()
{

}

void GLWidget::initializeGL()
{
    // 启用阴影平滑
    glShadeModel(GL_SMOOTH);
    // 白色背景
);
    // 设置深度缓存
);
    // 启用深度测试
    glEnable(GL_DEPTH_TEST);
    // 所作深度测试的类型
    glDepthFunc(GL_LEQUAL);
    // 告诉系统对透视进行修正
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    // 启用2D纹理映射
    glEnable(GL_TEXTURE_2D);
    // 加载纹理
    loadGLTextures();
}

void GLWidget::paintGL()
{
    renderScene();
    update();
}

void GLWidget::resizeGL(int width, int height)
{
    // 防止窗口大小变为0
 )
    {
        height = ;
    }
    // 重置当前的视口
, (GLint)width, (GLint)height);
    // 选择投影矩阵
    glMatrixMode(GL_PROJECTION);
    // 重置投影矩阵
    glLoadIdentity();
    // 设置视口的大小
);
    // 选择模型观察矩阵
    glMatrixMode(GL_MODELVIEW);
    // 重置投影矩阵
    glLoadIdentity();
}

// 绘制立方体
void GLWidget::drawCube()
{
    glBegin(GL_QUAD_STRIP);         //填充凸多边形
);
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glEnd();
    glBegin(GL_QUAD_STRIP);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glColor3f();
    glVertex3f(.0f);
    glEnd();
}

// 绘制圆形
void GLWidget::drawCircle()
{
    glBegin(GL_TRIANGLE_FAN);           //扇形连续填充三角形串
.0f);
    ;
    )
    {
        ;
        glColor3f(sin(p), cos(p), tan(p));
        glVertex3f(sin(p), cos(p), .0f);
    }
    glEnd();
}

// 绘制圆柱体
void GLWidget::drawCylinder()
{
    // 利用三角形和四边形等基本图元绘制底面圆圆心在坐标原点, 半径为 r,高为 h,方向沿 z 轴方向的圆柱;
    // 侧面用多个四边形,底面用多个三角形来表示
    glBegin(GL_QUAD_STRIP);//连续填充四边形串
;
    )
    {
        ;
        glVertex3f(sin(p), cos(p), .0f);
        glVertex3f(sin(p), cos(p), .0f);
    }
    glEnd();
    //bottom circle
);
    drawCircle();
    glTranslatef();
    //top circle
);
    drawCircle();
    glColor3f();
}

// 绘制圆锥体
void GLWidget::drawCone()
{
    glBegin(GL_QUAD_STRIP);//连续填充四边形串
;
    )
    {
        ;
        glColor3f(sin(p), cos(p), .0f);
        glVertex3f(.0f);
        glVertex3f(sin(p), cos(p), .0f);
    }
    glEnd();
    //bottom circle
);
    drawCircle();
}

// 绘制四面体等
void GLWidget::drawTetrahedron()
{
    glBegin(GL_QUADS);
    glNormal3f();
    glColor3f();
    glVertex3f(-);
    glColor3f();
    glVertex3f(-);
    glColor3f();
    glVertex3f();
    glColor3f();
    glVertex3f();
    glEnd();

glBegin(GL_TRIANGLES);
    glNormal3f();
    glColor3f();
    glVertex3f(-);
    glColor3f();
    glVertex3f();
    glColor3f();
    glVertex3f();
    glEnd();
    glBegin(GL_TRIANGLES);
    glNormal3f();
    glColor3f();
    glVertex3f();
    glColor3f();
    glVertex3f();
    glColor3f();
    glVertex3f();
    glEnd();
    glBegin(GL_TRIANGLES);
    glNormal3f();
    glColor3f();
    glVertex3f();
    glColor3f();
    glVertex3f(-);
    glColor3f();
    glVertex3f();
    glEnd();
    glBegin(GL_TRIANGLES);
    glNormal3f(-);
    glColor3f();
    glVertex3f(-);
    glColor3f();
    glVertex3f(-);
    glColor3f();
    glVertex3f();
    glEnd();
}

// 绘制球体
// 球心坐标为(x,y,z),球的半径为radius,M,N分别表示球体的横纵向被分成多少份
void GLWidget::drawSphere(GLfloat xx, GLfloat yy, GLfloat zz,
                          GLfloat radius, GLfloat M, GLfloat N)
{
    // 选择使用的纹理
]);

float step_z = PI / M;
     * PI / N;
    ];

;
    ;
    ;
    glBegin(GL_QUADS);
    ; i < M; i++)
    {
        angle_z = i * step_z;

; j < N; j++)
        {
            angle_xy = j * step_xy;

x[] = radius * sin(angle_z) * cos(angle_xy);
            y[] = radius * sin(angle_z) * sin(angle_xy);
            z[] = radius * cos(angle_z);

x[] = radius * sin(angle_z + step_z) * cos(angle_xy);
            y[] = radius * sin(angle_z + step_z) * sin(angle_xy);
            z[] = radius * cos(angle_z + step_z);

x[] = radius * sin(angle_z + step_z) * cos(angle_xy + step_xy);
            y[] = radius * sin(angle_z + step_z) * sin(angle_xy + step_xy);
            z[] = radius * cos(angle_z + step_z);

x[] = radius * sin(angle_z) * cos(angle_xy + step_xy);
            y[] = radius * sin(angle_z) * sin(angle_xy + step_xy);
            z[] = radius * cos(angle_z);
            ; k++)
            {
                glColor3f(sin(angle_z), cos(angle_z), tan(angle_z));
                //glTexCoord2f(0.1f, 0.1f);
                glVertex3f(xx + x[k], yy + y[k], zz + z[k]);
            }
        }
    }
    glEnd();
}

// 绘制圆环
// 大半径Radius,小半径TubeRadius,边数Sides, 环数Rings
void GLWidget::DrawTorus(double Radius, double TubeRadius, int Sides, int Rings)
{
     * PI / Sides;
     * PI / Rings;
    ;
    ;
    ;

double phi, sinPhi, cosPhi;
    double dist;
    glColor3f();
    ; i < Rings; i++)
    {
        double theta1 = theta + ringDelta;
        double cosTheta1 = cos(theta1);
        double sinTheta1 = sin(theta1);

glBegin(GL_QUAD_STRIP);
        phi = ;
        ; j <= Sides; j++)
        {
            phi = phi + sideDelta;
            cosPhi = cos(phi);
            sinPhi = sin(phi);
            dist = Radius + (TubeRadius * cosPhi);

glNormal3f(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi);
            glColor3f(cosTheta, sinTheta, sinPhi);
            glVertex3f(cosTheta * dist, sinTheta * dist, TubeRadius * sinPhi);

glNormal3f(cosTheta1 * cosPhi, sinTheta1 * cosPhi, sinPhi);
            glColor3f(cosTheta1, sinTheta1, sinPhi);
            glVertex3f(cosTheta1 * dist, sinTheta1 * dist, TubeRadius * sinPhi);
        }
        glEnd();
        theta = theta1;
        cosTheta = cosTheta1;
        sinTheta = sinTheta1;
    }
}

// 加载纹理
void GLWidget::loadGLTextures()
{
    QImage tex1, buf1;
    QImage tex2, buf2;
    if (!buf1.load(":/data/qt-logo.jpg"))
    {
        // 如果载入不成功,自动生成一个128*128的32位色的绿色图片。
        qWarning("Could not read image file!");
        QImage dummy(, QImage::Format_RGB32);
        dummy.fill(Qt::green);
        buf1 = dummy;
    }

if (!buf2.load(":/data/qt-wood.jpg"))
    {
        // 如果载入不成功,自动生成一个128*128的32位色的绿色图片。
        qWarning("Could not read image file!");
        QImage dummy(, QImage::Format_RGB32);
        dummy.fill(Qt::green);
        buf2 = dummy;
    }

//***********************************************//
    // 纹理0:qt-logo
    //***********************************************//
    //转换成纹理类型
    tex1 = QGLWidget::convertToGLFormat(buf1);
    // 创建纹理
]);
    // 使用来自位图数据生成的典型纹理,将纹理名字texture[0]绑定到纹理目标上
]);
    // WRAP参数:纹理坐标超出[0,0]到[1,1]的范围该怎么处理呢?
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    // Filter参数:纹理坐标映射到纹素位置(127.34,255.14)该怎么办?
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    // 纹理环境
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    // 将纹素数组从CPU传至GPU并且设置为当前纹理。
    // 在处理单一纹理时,你可以用,负责效率非常低。
    // 多纹理时可以参见纹理绑定。
,
                 GL_RGBA, GL_UNSIGNED_BYTE, tex1.bits());

//***********************************************//
    // 纹理0:qt-logo
    //***********************************************//
    tex2 = QGLWidget::convertToGLFormat(buf2);
    glGenTextures(]);
    glBindTexture(GL_TEXTURE_2D, texture[]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glTexImage2D(GL_TEXTURE_2D, ,
                 GL_RGBA, GL_UNSIGNED_BYTE, tex2.bits());
    // 使用纹理
    // 首先调用glEnable( GL_TEXTURE_2D ),来启用2D纹理;
    // 然后绘制图形,并且为每个顶点指定ST坐标;
    // 最后调用glDisable( GL_TEXTURE_2D ).
}

// 场景渲染
void GLWidget::renderScene(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

glPushMatrix();
    renderBasicShape();
    glPopMatrix();

glPushMatrix();
    glTranslatef(-);
    renderTextureCube();
    glPopMatrix();

glPushMatrix();
    glTranslatef();
    renderTextureCylinder();
    glPopMatrix();
}

// 渲染基本图形
void GLWidget::renderBasicShape()
{
    .0f;
    fRotAngle += ROT_DELTA;
    )
        fRotAngle = ;

glPushMatrix();
    glColor3f();
    glTranslatef(-);
    glRotatef(fRotAngle, );
    drawCylinder();
    glPopMatrix();

glPushMatrix();
    glColor3f();
    glTranslatef();
    glRotatef(fRotAngle, );
    drawTetrahedron();
    glPopMatrix();

glPushMatrix();
    glColor3f();
    glTranslatef();
    glRotatef(fRotAngle, );
    drawCircle();
    glPopMatrix();

glPushMatrix();
    glColor3f();
    glTranslatef();
    glRotatef(fRotAngle, );
    drawSphere();
    glPopMatrix();

glPushMatrix();
    glColor3f();
    glTranslatef(-);
    glRotatef(fRotAngle, );
    drawCube();
    glPopMatrix();

glPushMatrix();
    glColor3f();
    glTranslatef();
    glRotatef(fRotAngle, );
    DrawTorus();
    glPopMatrix();

glPushMatrix();
    glColor3f();
    glTranslatef();
    glRotatef(fRotAngle, );
    drawCone();
    glPopMatrix();
}

// 渲染纹理
void GLWidget::renderTextureCube()
{
    // 纹理映射
);
    glTranslatef(.0f);
    glRotatef(xRot, );
    glRotatef(yRot, );
    glRotatef(zRot, );
    // 使用来自位图数据生成的典型纹理,将纹理名字texture[0]绑定到纹理目标上
]);
    glBegin( GL_QUADS );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f(   );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f( - );
    glTexCoord2f(  );
    glVertex3f( - );
    glEnd();
    xRot += ROT_DELTA;
    ;
    yRot += ROT_DELTA;
    ;
    zRot += ROT_DELTA;
    ;
}

void GLWidget::renderTextureCylinder()
{
    // 纹理映射
.0f);
    glRotatef(xRot, );
    //glRotatef(yRot, 0.0, 1.0, 0.0);
    //glRotatef(zRot, 0.0, 0.0, 1.0);
    // 选择使用的纹理
]);
    // 利用三角形和四边形等基本图元绘制底面圆圆心在坐标原点, 半径为 r,高为 h,方向沿 z 轴方向的圆柱;
    // 侧面用多个四边形,底面用多个三角形来表示
    glBegin(GL_QUAD_STRIP);//连续填充四边形串
;
    )
    {
        ;
        //p和圆周是相对应的, 这里让纹理的横坐标随圆周扫过的角度一起改变,就能够将纹理图“刷”上去了,
        //而纵坐标设置为图像的高度和纹理高度的对应,这里合适的参数是根据实际测试得到的
.1f);
        glVertex3f(sin(p), cos(p), .0f);   //这个 1.0f指定的是高度h
.0f);
        glVertex3f(sin(p), cos(p), .0f);
    }
    glEnd();
    //bottom circle
    glBegin(GL_TRIANGLE_FAN);           //扇形连续填充三角形串
.0f);           //将纹理图(0, 0)映射到圆心
.0f);
    )
    {
        ;
        glTexCoord2f(.0f);       //将纹理图(1, 0)映射到圆周
.0f);
    }
    glEnd();
    glTranslatef();              //设定高度为1,画上底面
    //top circle
    glBegin(GL_TRIANGLE_FAN);           //扇形连续填充三角形串
.0f);           //将纹理图(0, 0)映射到圆心
.0f);
    )
    {
        ;
        glTexCoord2f(.0f);       //将纹理图(1, 0)映射到圆周
.0f);
    }
    glEnd();

xRot += ROT_DELTA;
    ;
    yRot += ROT_DELTA;
    ;
    zRot += ROT_DELTA;
    ;
}

主函数调用

main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
#include "GLWidget.h"
#include <QApplication>
#include <QObject>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

GLWidget w;
    w.resize();
    w.setWindowTitle(QObject::tr("Michael's OpenGL Framework"));
    w.show();

return a.exec();
}

运行效果

QT OpenGL绘制三维图形(立方体、圆柱体、圆锥、球体、圆环等等)的更多相关文章

  1. matlab绘制三维图形

    原文地址:种三维曲面图. 程序如下: [x,y]=meshgrid(-8:0.5:8); z=sin(sqrt(x.^2+y.^2))./sqrt(x.^2+y.^2+eps); subplot(2, ...

  2. opengl绘制三维人物luweiqi

    素材中有四个.bmp格式的纹理文件和一个.txt的模型参数文件 文件格式说明: 纹理文件数量 纹理文件1(字符串)//.bmp 纹理文件2(字符串) 纹理文件3(字符串) . . . 材质数量 amb ...

  3. OPenGL中三维图形的矩阵变换

    对于二维的图形开发,拿简单的图片显示来说,我们主要的目的:就是在一块显示buffer中,不停的把每个像素进行着色,然后就可以绘制出来了.为了速度,很多其他的加速方法,但原理基本上就是这样了. 很直观, ...

  4. 45.Qt openGL实现三维绘图

    main.cpp #include <QApplication> #include <iostream> #include "tetraheadron.h" ...

  5. Matlab绘制三维图形以及提示框

    1.首先,在编辑区输入如下代码 >> [x,y] = meshgrid([-100,0.1,100]); >> z = sqrt(x.^2 + y.^2); >> ...

  6. [Matlab绘图][三维图形][三维曲线基本函数+三维曲面+其他三维图形]

    1.绘制三维图形的基本函数 最基本的三维绘图函数为plot3: plot3与plot用法十分相似,调用格式: plot(x1,y1,z1,选项1,x2,y2,z2,选项2,...,xn,yn,zn,选 ...

  7. 基于OpenGL的三维曲面动态显示实现

    在使用Visual C++的MFC AppWizard建立应用程序框架后,生成了多个类,与OpenGL编程相关的类是视图类,主要的显示任务都在其中完成. 1.基于OpenGL绘图的基本设置 1.1 设 ...

  8. Python使用matplotlib绘制三维曲线

    本文主要演示如何使用matplotlib绘制三维图形 代码如下: # -*- coding: UTF-8 -*- import matplotlib as mpl from mpl_toolkits. ...

  9. 46.Qt 使用OpenGL绘制立方体

    main.cpp #include <QApplication> #include <iostream> #include "vowelcube.h" in ...

随机推荐

  1. mysql的导入导出工具mysqldump命令详解

    导出要用到MySQL的mysqldump工具,基本用法是: shell> mysqldump [OPTIONS] database [tables] 如果你不给定任何表,整个数据库将被导出. 通 ...

  2. 微信小程序——页面之间传递值

    小程序页面传值的方式: 1.正向传值:上一页面 -->  下一页面 url传值 本地储存 全局的app对象 2.反向传值:下一页面 -->  上一页面 本地储存 全局的app对象 先说一下 ...

  3. 引入css少引入了rel="stylesheet" 这行代码。导致整个页面空白、

    忘记引入rel="stylesheet" 如下: <link  href="css/swiper-3.3.1.min.css" /> 这样使得整个页 ...

  4. why "Everything" is so fast?

    Everything并不扫描整个磁盘,只是读取磁盘上的USN日志,所以速度飞快.但因此缺点也明显:1.只支持NTFS格式的分区,因为USN日志是NTFS专有的.在FAT.FAT32格式分区上无法使用E ...

  5. Sanjeev Arora

    中文名:桑吉弗 阿罗拉 个人主页:https://www.cs.princeton.edu/~arora/ 生日:1968年一月 祖籍:印度 本科:1990年麻省理工大学毕业 博士:1994年加州伯克 ...

  6. linux 将终端进行换行

    原始 修改 修改方法 vim .bashrc fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debia ...

  7. c++ 的类 和 类继承, 什么是c++中的基类和派生类?

    闲云潭影日悠悠,物换星移几度秋 你既然已经做出了选择, 又何必去问为什么选择.鬼谷绝学的要义, 从来都不是回答, 而是抉与择 普通类 #ifndef TABTENN0_H_ #define TABTE ...

  8. SAP Process Integration - High Level ERP/Integration Process --- Cargill Process Concept Design

    Customer Industry: Commercial off-the-shelf (COTS) application ,, Food Ingredients or Agricultural S ...

  9. Linux中的绝对路径和相对路径

    一.介绍 1,文件路径 什么是文件的路径? 答:这个文件存放的地方,可以联想为 文件的“家”. 在Linux中,存在着绝对路径和相对路径 绝对路径:路径的写法一定是由根目录 / 写起的,例如 /usr ...

  10. vi 命令集

    一:跳到文件第一行 1. 输入:0或:1,然后回车: 2. 在键盘按下小写gg:   二:跳到文件最后一行 1. 输入:$,然后回车: 2. 在键盘按下大写G : 3. 在键盘按Shift + g: ...