-
Notifications
You must be signed in to change notification settings - Fork 0
/
PowerGlass.h
46 lines (37 loc) · 1.08 KB
/
PowerGlass.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
#include <GL/glut.h>
using namespace std;
class PowerGlass
{
public: void createGlassBarrierZ(int x, int y, int z, int height, int width) {
height /= 2;
width /= 2;
glBlendFunc(GL_SRC_ALPHA ,GL_ONE_MINUS_SRC_ALPHA); //the blend function
glEnable(GL_BLEND);
glColor4f(0.0f,0.5f,1.0f,0.6f);
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(x, y-1*height, z-1*width);
glVertex3f(x, y-1*height, z+width);
glVertex3f(x, y+height, z+width );
glVertex3f(x, y+height, z-1*width);
glEnd();
glColor3f(1.0f,1.0f,1.0f);
glDisable(GL_BLEND);
}
public: void createGlassBarrierX(int x, int y, int z, int height, int width) {
height /= 2;
width /= 2;
glBlendFunc(GL_SRC_ALPHA ,GL_ONE_MINUS_SRC_ALPHA); //the blend function
glEnable(GL_BLEND);
glColor4f(0.0f,0.5f,1.0f,0.6f);
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(x-1*width, y-1*height, z);
glVertex3f(x+width, y-1*height, z);
glVertex3f(x+width, y+height, z);
glVertex3f(x-1*width, y+height, z);
glEnd();
glColor3f(1.0f,1.0f,1.0f);
glDisable(GL_BLEND);
}
};