-
Notifications
You must be signed in to change notification settings - Fork 0
/
QRCodeGenerator 1.0 .cpp
88 lines (77 loc) · 1.97 KB
/
QRCodeGenerator 1.0 .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
79
80
81
82
83
84
85
86
87
88
#include<GL/glut.h>
#include<stdio.h>
int A[21][21]=
{ {1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,1},
{1,0,1,1,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,0,1,0,1,1,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,0,0,0,1,0,1,0,1,1,1,0,1},
{1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,1},
{1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1},
{0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0},
{1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,0,0,1,1},
{1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,1},
{0,0,1,0,1,0,1,1,0,1,1,0,0,0,1,0,0,0,1,1,0},
{0,1,0,1,1,0,0,1,1,1,1,0,1,0,0,0,1,0,1,1,0},
{0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,1,0,1,0,0,1},
{1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,1,1,1,1,1,0},
{1,0,0,0,0,0,1,0,1,1,0,1,0,1,1,1,0,0,1,0,1},
{1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,1,1},
{1,0,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0},
{1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,1,1,1,1},
{1,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1},
{1,1,1,1,1,1,1,0,1,1,0,0,0,0,1,0,0,1,1,1,1} };
void drawBlock(int i, int j)
{
int xmin, ymin, xmax, ymax;
xmin = (20 + (i * 20));
ymin = (20 + (j * 20));
xmax = xmin + 20;
ymax = ymin + 20;
glColor3f(0.0, 0.0, 0.0);
glLineWidth(2);
glBegin(GL_POLYGON);
glVertex2f(xmin, ymin);
glVertex2f(xmin, ymax);
glVertex2f(xmax, ymax);
glVertex2f(xmax, ymin);
glEnd();
glFlush();
}
void initArray()
{
}
void drawQR()
{
int i, j;
for (i = 0; i < 21; i++)
{
for (j = 0; j < 21; j++)
{
if (A[i][j] == 1)
{
drawBlock(i, j);
}
}
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
gluOrtho2D(0, 460, 0, 460);
drawQR();
glFlush();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(600, 600);
glutCreateWindow("Draw Rectangle");
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glClearColor(1.0, 1.0, 1.0, 1.0);
glutDisplayFunc(display);
glutMainLoop();
}