-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglwidget.cpp
executable file
·61 lines (46 loc) · 1.16 KB
/
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
#include "glwidget.h"
Glwidget::Glwidget(QWidget *parent) : QOpenGLWidget(parent)
{
prt=parent;
b =new banc(750);
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
timer.setInterval(1);
timer.start();
_t=0;
}
Glwidget::~Glwidget()
{
}
void Glwidget::initializeGL()
{
glClearColor(0.05,0.05,0.05, 0.0f);
//glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
//glDepthFunc(GL_LEQUAL);
}
void Glwidget::resizeGL(int width, int height)
{
GLfloat aspect = (GLfloat)width / (GLfloat)height;
// Set the viewport to cover the new window
glViewport(0, 0, width, height);
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
gluPerspective(60,aspect,.1,100000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void Glwidget::paintGL()
{
//_t+=0.01;
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gluLookAt ( sin(_t)*35,0,cos(_t)*35,0,0,0,0,1,0);
b->anime();
b->aff();
prt->setWindowTitle(QString("%1 %2").arg(b->t1).arg(b->t2));
//*setWindowIconText();
}
void Glwidget::button1click()
{
update ();
}