-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathShelf.cpp
More file actions
65 lines (59 loc) · 1.51 KB
/
Shelf.cpp
File metadata and controls
65 lines (59 loc) · 1.51 KB
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
#include "Shelf.h"
/**
* Method implemented to draw the shelf
*/
void Shelf::DrawShelf() {
glPushAttrib(GL_ALL_ATTRIB_BITS);
glShadeModel(GL_SMOOTH);
GLfloat mat_specular[] = {0.521, 0.376, 0.247, 1.0};
GLfloat mat_diffuse[] = {0.521, 0.376, 0.247, 1.0};
GLfloat mat_ambient[] = {0.521, 0.376, 0.247, 1.0};
GLfloat mat_shininess = 5.0;
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialf(GL_FRONT, GL_SHININESS, mat_shininess);
/// shelf backside
glPushMatrix();
glColor3d(0,0,1);
glTranslatef(0,3,-9.8);
glScalef(5,3,0.5);
glutSolidCube(1);
glPopMatrix();
/// left plank
glPushMatrix();
glColor3d(1,1,1);
glTranslatef(-2.5,3,-9);
glScalef(0.05,3,1.5);
glutSolidCube(1);
glPopMatrix();
/// right plank
glPushMatrix();
glColor3d(1,1,1);
glTranslatef(2.5,3,-9);
glScalef(0.05,3,1.5);
glutSolidCube(1);
glPopMatrix();
/// upper plank
glPushMatrix();
glColor3d(1,1,1);
glTranslatef(0,4.5,-9);
glScalef(5,0.05,1.5);
glutSolidCube(1);
glPopMatrix();
/// middle plank
glPushMatrix();
glColor3d(1,1,1);
glTranslatef(0,3,-9);
glScalef(5,0.05,1.5);
glutSolidCube(1);
glPopMatrix();
/// lower plank
glPushMatrix();
glColor3d(1,1,1);
glTranslatef(0,1.5,-9);
glScalef(5,0.05,1.5);
glutSolidCube(1);
glPopMatrix();
glPopAttrib();
}