-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lights.cpp
78 lines (49 loc) · 1.53 KB
/
Lights.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
#include "Lights.h"
Lights::Lights()
{
getDefault();
}
void Lights::getDefault()
{
//nactení defaultniho svetla
//zde budou definována svetla
glShadeModel(GL_SMOOTH);
glLoadIdentity();
GLfloat whiteLight[]={1.0, 1.0, 1.0, 1.0};
GLfloat lightPosition[]={1.0, 500.0, 10.0, -100.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, whiteLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
}
void Lights::getBlue()
{
//načtení modreho svetla
//zde budou definována svetla
GLfloat whiteLight[]={0.0, 0.0, 1.0, 1.0};
GLfloat lightPosition[]={1.0, 0.0, 1.0, -100.0};
glLightfv(GL_LIGHT1, GL_AMBIENT, whiteLight);
glLightfv(GL_LIGHT1, GL_DIFFUSE, whiteLight);
glLightfv(GL_LIGHT1, GL_SPECULAR, whiteLight);
glLightfv(GL_LIGHT1, GL_POSITION, lightPosition);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT1);
}
void Lights::getMenuLight()
{
//zde budou definována svetla pro menu
GLfloat whiteLight[]={1.0, 1.0, 1.0, 0.0};
GLfloat lightPosition[]={1.0, 30.0, 50.0, 0.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, whiteLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
}
Lights::~Lights()
{
glDisable(GL_LIGHTING);
}