@@ -60,9 +60,10 @@ void key(unsigned char key, int x, int y) {
6060		case  ' 3' 3 ;std::cout << " ---Tri-corn---\n " glutPostRedisplay ();break ;}
6161		case  ' 2' 2 ;std::cout << " -Burning Ship-\n " glutPostRedisplay ();break ;}
6262		case  ' 1' 1 ;std::cout << " Mandelbrot Set\n " glutPostRedisplay ();break ;}
63- 		case  ' r' reset ();break ;}
64- 		case  ' f' if (fullscreen){oWIDTH=WIDTH;oHEIGHT=HEIGHT;glutFullScreen ();}else {glutReshapeWindow (oWIDTH,oHEIGHT);}break ;}
65- 		case  ' j' if (julia){julia=false ;reset ();std::cout << " -Fractal Mode-\n " else {julia=true ;xJul=xPos+mouseX/zoom;yJul=yPos+(HEIGHT-mouseY)/zoom;reset ();std::cout << " --Julia Mode--\n Real:" " \n Imag:" " \n --------------\n " break ;}
63+         case  ' r' reset ();break ;}
64+ 		case  ' f' if (fullscreen){oWIDTH=WIDTH;oHEIGHT=HEIGHT;glutFullScreen ();}else {glutReshapeWindow (oWIDTH,oHEIGHT);}break ;}
65+ 		case  ' j' if (julia){julia=false ;reset ();std::cout << " -Fractal Mode-\n " else {julia=true ;xJul=xPos+mouseX/zoom;
66+ 				   yJul=yPos+(HEIGHT-mouseY)/zoom;reset ();std::cout << " --Julia Mode--\n Real:" " \n Imag:" " \n --------------\n " break ;}
6667	}
6768}
6869long  double  r0,i0,real,imag,tempreal,io,ro;
@@ -126,9 +127,10 @@ float escapesmooth(long double real, long double imag, int x, int y){
126127	return  iter;
127128}
128129void  display (){
130+ 	glClear (GL_COLOR_BUFFER_BIT);
129131	if (render){
132+ 		glBegin (GL_POINTS);
130133		for (int  y=HEIGHT;y>0 ;y--){
131- 			glBegin (GL_POINTS);
132134			for (int  x=0 ;x<WIDTH+1 ;x++){
133135				iterations=escapesmooth (x/zoom+xPos,y/zoom+yPos,xJul,yJul);
134136					glVertex2i (x,y);
@@ -165,10 +167,11 @@ void display(){
165167					}
166168				}
167169			}
168- 		glEnd ();
169- 		glFlush ();
170170		}
171+ 	glEnd ();
172+ 	glFlush ();
171173	}
174+ glutSwapBuffers ();
172175}
173176void  reshape (int  w, int  h) {
174177	glViewport (0 , 0 , w, h);
@@ -181,7 +184,8 @@ void reshape(int w, int h) {
181184	HEIGHT = h;
182185	render=true ;
183186	glutPostRedisplay ();
184- }bool  isDragging = false ;
187+ }
188+ bool  isDragging = false ;
185189int  lastX,lastY;
186190
187191void  mouse (int  button, int  state, int  x, int  y){
@@ -230,7 +234,6 @@ int main(int argc, char** argv){
230234	glMatrixMode (GL_PROJECTION);
231235	glLoadIdentity ();
232236	gluOrtho2D (0 , WIDTH, 0 , HEIGHT);
233- 	glMatrixMode (GL_MODELVIEW);
234237	glLoadIdentity ();
235238	glClearColor (0.0 ,0.0 ,0.0 ,1.0 );
236239	std::cout << " Maximum iterations: " " \n " 
0 commit comments