-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspikeTrap.cpp
37 lines (34 loc) · 1004 Bytes
/
spikeTrap.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
#include "spikeTrap.h"
spikeTrap::spikeTrap(double xx,double yy)
{
x = xx * 20;
y = yy * 20;
down = true;
}
void spikeTrap::draw()
{
glPushMatrix();
glTranslatef(x,0,y);
for(int i = -5; i<5;i++)
{
for(int j = -5; j<5;j++)
{
glPushMatrix();
glDisable(GL_COLOR_MATERIAL);
GLfloat materialSpecular[] = {0.8f, 0.8f, 0.8f, 1.0f};
GLfloat materialEmission[] = {0, 0, 0, 1.0f};
GLfloat materialColor[] = {.3, .3, .3, 1};
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColor);
glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);
glMaterialfv(GL_FRONT, GL_EMISSION, materialEmission);
glMaterialf(GL_FRONT, GL_SHININESS, 15.0f);
if(down)
glTranslatef(0,-.8,0);
glTranslatef(i,0,j);
glRotatef(90,-1,0,0);
glutSolidCone(.3,1,36,36);
glPopMatrix();
}
}
glPopMatrix();
}