-
Notifications
You must be signed in to change notification settings - Fork 0
/
weird-thing-thai-dye-subtle-2.c
102 lines (83 loc) · 2.62 KB
/
weird-thing-thai-dye-subtle-2.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<stdio.h>
#include<math.h>
#include<GL/glut.h>
#include<stdlib.h>
#include <time.h>
#include <unistd.h>
int x, y;
double a, duh, der, myx, myy, extra;
GLdouble width = 1200, height = 700;
// double imagemap[][] = new double [width][height];
double imagemap[1200][700];
void display(void)
{
// clear all pixels? */
glClear(GL_COLOR_BUFFER_BIT);
// Draw a point
glBegin(GL_POINTS);
//glVertex2f(width / 2, height / 2);
for (x = 0; x < width; x++)
for (y = 0; y < height; y++)
{
//unsigned int c = myx ^ myy;
//duh = duh + 0.003 * 4.0*atan(1.0);
//duh = duh + 0.01;
//duh = sin(myy*a);
//der = sin(myx*a);
//double xloc = sin(x*y + extra * 0.66667); // original
// double xloc = cos(x + (extra * 0.1) * y * 0.66667); // this one is cool.
//double xloc = cos(sin(x + extra * y * 0.66667));
//glColor3f(xloc, xloc / 2, 0.7);
//glVertex2f(x, y);
extra = extra + 0.00001;
//duh = 0.0;
duh = (640.0 + (640.0 * sin(x / 8.0))+ 640.0 + (640.0 * sin(y / 3.0))) / 4000 * sin(extra);
der = (128.0 + (64.0 * sin(sqrt((x - width / 8.0) * (x - width / 8.0) + (y - height / 8.0) * (y - height / 8.0)) / 8.0)))/200; // * sin(extra);
//der = 0.0;
duh = duh + der;
//if (colorz > 255) colorz = colorz * 0.5; // turn white into black
imagemap[(int)x][(int)y] = duh;
glColor3f(imagemap[x][y], imagemap[x][x], imagemap[y][y]);
glVertex2f(x,y);
//double c2 = (double) c / 1000;
// glColor3f(c2, sin(duh), der);
//printf("%f\n", duh);
// glVertex2f(myx, myy);
//glColor3f(der, duh/7, duh);
//glVertex2f(der * width, duh * height);
//if (duh > 1.0) duh = 0.001;
if (extra > 3.0) extra = 0.00001;
}
//a = a + 0.2;
glEnd();
//duh = duh +1;
//printf("%f\n", duh);
//if (duh > 1) duh = 0.001;
//SwapBuffers(); // this doesn't seem to work outside of windows? :(
glutSwapBuffers();
//glFlush();
}
void init (void)
{
//duh = 0.001;
//a = 1;
extra = 0.00001;
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);
}