#include #include #include #include #include #include #define X 500 #define Y 500 float image[X][Y]; //store image color data here typedef GLfloat point2d[2]; point2d point = {0.0, 0.0}; void display(void) { //clear background to glClearColor glClear ( GL_COLOR_BUFFER_BIT ); //point color float red=0.0, green=0.0, blue=0.0; glColor3f ( red, green, blue ); int x, y; for ( x=0; x 2.0 ) break; } //set up image data if ( magnitude > 1.0 ) magnitude = 1.0; image[i][j] = magnitude; }// end i loop }// end j loop } void init (void) { //select clearing color glClearColor (0.0, 0.0, 0.0, 0.0); //remove hidden stuff for faster rendering glEnable(GL_DEPTH_TEST); //initialize viewing values glMatrixMode(GL_PROJECTION); gluOrtho2D( 0.0, X, 0.0, Y); glMatrixMode( GL_MODELVIEW ); } int main( int argc, char** argv ) { mandelbrot(); glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize ( X, Y); glutInitWindowPosition (100, 100); glutCreateWindow ("test"); init (); glutDisplayFunc(display); glutMainLoop(); return 0; }