Eric Fredricksen avatar Eric Fredricksen committed 15ba982

All compiles

Comments (0)

Files changed (3)

Classes/EAGLView.m

         eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                         [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
 
-        renderer = [[ES2Renderer alloc] init];
+        renderer = NULL;//[[ES2Renderer alloc] init];
 
         if (!renderer)
         {

Classes/ES1Renderer.m

     glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
     glClear(GL_COLOR_BUFFER_BIT);
 
+	display_func();
+	/*
     glVertexPointer(2, GL_FLOAT, 0, squareVertices);
     glEnableClientState(GL_VERTEX_ARRAY);
     glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
     glEnableClientState(GL_COLOR_ARRAY);
 
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
+	*/
+	
+	
+	
     // This application only creates a single color renderbuffer which is already bound at this point.
     // This call is redundant, but needed if dealing with multiple renderbuffers.
     glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
 static float * u, * v, * u_prev, * v_prev;
 static float * dens, * dens_prev;
 
-static int win_id;
+//static int win_id;
 static int win_x, win_y;
 static int mouse_down[3];
 static int omx, omy, mx, my;
 	}
 }
 
-static int allocate_data ( void )
+int allocate_data()
 {
 	int size = (N+2)*(N+2);
 
 			clear_data ();
 			break;
 
-		case 'q':
-		case 'Q':
-			free_data ();
-			exit ( 0 );
-			break;
-
 		case 'v':
 		case 'V':
 			dvel = !dvel;
 	}
 }
 
-static void mouse_func ( int button, int state, int x, int y )
+static void mouse_func (int button, int state, int x, int y)
 {
 	omx = mx = x;
 	omx = my = y;
 
-	mouse_down[button] = state == GLUT_DOWN;
+	mouse_down[button] = state;
 }
 
-static void motion_func ( int x, int y )
+static void motion_func (int x, int y)
 {
 	mx = x;
 	my = y;
 }
 
-static void reshape_func ( int width, int height )
-{
-	glutSetWindow ( win_id );
-	glutReshapeWindow ( width, height );
-
-	win_x = width;
-	win_y = height;
-}
-
 static void idle_func ( void )
 {
 	get_from_UI ( dens_prev, u_prev, v_prev );
 	vel_step ( N, u, v, u_prev, v_prev, visc, dt );
 	dens_step ( N, dens, dens_prev, u, v, diff, dt );
 
-	glutSetWindow ( win_id );
-	glutPostRedisplay ();
+	//glutSetWindow ( win_id );
+	//glutPostRedisplay ();
 }
 
-static void display_func ( void )
+void display_func()
 {
 	pre_display ();
 
-		if ( dvel ) draw_velocity ();
-		else		draw_density ();
+	if ( dvel ) draw_velocity ();
+	else		draw_density ();
 
 	//glutSwapBuffers ();
 }
 
 static void open_glut_window ( void )
 {
-	glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE );
+	//glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE );
 
-	glutInitWindowPosition ( 0, 0 );
-	glutInitWindowSize ( win_x, win_y );
-	win_id = glutCreateWindow ( "Alias | wavefront" );
+	//glutInitWindowPosition ( 0, 0 );
+	//glutInitWindowSize ( win_x, win_y );
+	//win_id = glutCreateWindow ( "Alias | wavefront" );
 
-	glClearColor ( 0.0f, 0.0f, 0.0f, 1.0f );
-	glClear ( GL_COLOR_BUFFER_BIT );
-	glutSwapBuffers ();
-	glClear ( GL_COLOR_BUFFER_BIT );
-	glutSwapBuffers ();
+	//glClearColor ( 0.0f, 0.0f, 0.0f, 1.0f );
+	//glClear ( GL_COLOR_BUFFER_BIT );
+	//glutSwapBuffers ();
+	//glClear ( GL_COLOR_BUFFER_BIT );
+	//glutSwapBuffers ();
 
 	pre_display ();
 
-	glutKeyboardFunc ( key_func );
-	glutMouseFunc ( mouse_func );
-	glutMotionFunc ( motion_func );
-	glutReshapeFunc ( reshape_func );
-	glutIdleFunc ( idle_func );
-	glutDisplayFunc ( display_func );
+	//glutKeyboardFunc ( key_func );
+	//glutMouseFunc ( mouse_func );
+	//glutMotionFunc ( motion_func );
+	//glutReshapeFunc ( reshape_func );
+	//glutIdleFunc ( idle_func );
+	//glutDisplayFunc ( display_func );
 }
 
 
   ----------------------------------------------------------------------
 */
 
-int main ( int argc, char ** argv )
+void DEMOmain(int argc, char** argv)
 {
 	if ( argc != 1 && argc != 6 ) {
 		fprintf ( stderr, "usage : %s N dt diff visc force source\n", argv[0] );
 	printf ( "\t Clear the simulation by pressing the 'c' key\n" );
 	printf ( "\t Quit by pressing the 'q' key\n" );
 
-	dvel = 0;
+	dvel = !0;
 
 	if ( !allocate_data () ) exit ( 1 );
 	clear_data ();
 	win_y = 512;
 	open_glut_window ();
 
-	glutMainLoop ();
+	//glutMainLoop ();
 
-	exit ( 0 );
+	//exit ( 0 );
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.