-
Notifications
You must be signed in to change notification settings - Fork 0
/
blue-block-thing.c
58 lines (45 loc) · 1.03 KB
/
blue-block-thing.c
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
#include<stdio.h>
#include<math.h>
#include<GLUT/glut.h>
#include<stdlib.h>
#include <time.h>
#include <unistd.h>
double a, y, x, duh, der, myx, myy, extra;
GLdouble width = 640, height = 480;
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
for (x = 0; x < width; x++)
for (y = 0; y < height; y++)
{
double xloc = sin(x*y + extra * 0.66667);
glColor3f(0.2, 0, xloc);
glVertex2f(x, y);
extra++;
}
glEnd();
glutSwapBuffers();
}
void init (void)
{
extra = 100;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glDisable(GL_DEPTH_TEST);
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (width, height);
glutInitWindowPosition (100, 100);
glutCreateWindow ("hello");
glutIdleFunc(display);
init ();
glutDisplayFunc(display);
glutMainLoop();
return(0);
}