#include <GL/glut.h>
#include <graphics.h>
#include <stdio.h>
Go to the source code of this file.
|
void | fractal (float left, float top, float xside, float yside) |
|
void | display () |
|
int | main (int argc, char **argv) |
|
◆ MAXCOUNT
◆ display()
Definition at line 82 of file Mandelbrot.c.
83 float left, top, xside, yside;
90 fractal(left, top, xside, yside);
void fractal(float left, float top, float xside, float yside)
References fractal().
Referenced by main().
◆ fractal()
void fractal |
( |
float |
left, |
|
|
float |
top, |
|
|
float |
xside, |
|
|
float |
yside |
|
) |
| |
Definition at line 10 of file Mandelbrot.c.
11 glClear(GL_COLOR_BUFFER_BIT);
14 float xscale, yscale, zx, zy, cx, tempx, cy;
16 int maxx, maxy, count;
25 xscale = xside / maxx;
26 yscale = yside / maxy;
30 rectangle(0, 0, maxx, maxy);
35 for (y = 1; y <= maxy - 1; y++) {
36 for (x = 1; x <= maxx - 1; x++) {
38 cx = x * xscale + left;
41 cy = y * yscale + top;
56 while ((zx * zx + zy * zy < 4) && (count <
MAXCOUNT)) {
62 tempx = zx * zx - zy * zy + cx;
65 zy = 2 * zx * zy + cy;
75 putpixel(x, y, count);
References MAXCOUNT.
Referenced by display().
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 94 of file Mandelbrot.c.
100 int gd = DETECT, gm, errorcode;
102 float left, top, xside, yside;
123 initgraph(&gd, &gm, driver);
125 glutInit(&argc, argv);
126 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
127 glutInitWindowSize(1366, 768);
128 glutInitWindowPosition(0, 0);
140 glutCreateWindow(
"Mandelbrot Fractals with openGL");
References display().