Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /examples/iso2d-demo/main.c
ViewVC logotype

Diff of /examples/iso2d-demo/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1912, Tue Jun 5 16:02:39 2012 UTC revision 1913, Tue Jun 5 16:10:02 2012 UTC
# Line 44  Line 44 
44  } State_t;  } State_t;
45    
46  // Callback function called by GLUT to render screen  // Callback function called by GLUT to render screen
47  void Draw ()  void Draw (Nrrd *positions)
48  {  {
49    // Clear frame buffer    // Clear frame buffer
50      glClearColor (0, 0, 0, 1);      glClearColor (0, 0, 0, 1);
# Line 204  Line 204 
204    
205      ISO_Initially (wrld);      ISO_Initially (wrld);
206    
     uint32_t nSteps = ISO_Run (wrld, 0);  
   
   // get results  
207      Nrrd *nData = nrrdNew();      Nrrd *nData = nrrdNew();
208      if (ISO_OutputGet_outRGBA (wrld, nData)) {      do {
209          // get snapshot of state
210            if (ISO_Sapshot_outRGBA (wrld, nData)) {
211        // error        // error
212          fprintf(stderr, "Error getting nrrd data\n");          fprintf(stderr, "Error getting nrrd data\n");
213          return 1;          return 1;
214      }      }
215          // render the state
216            Draw (nData);
217          // step the computation
218            uint32_t nSteps = ISO_Run (wrld, 1);
219        } while (ISO_NumActive() > 0);
220    
221      if (nrrdSave("out.nrrd", nData, NULL)) {    // get and render final state
222          char *err = biffGetDone(NRRD);      if (ISO_OutputGet_outRGBA (wrld, nData)) {
223          fprintf(stderr, "Trouble saving nrrd struct: %s\n", err);        // error
224            fprintf(stderr, "Error getting nrrd data\n");
225          return 1;          return 1;
226      }      }
227        Draw (nData);
228    
229      ISO_Shutdown (wrld);      ISO_Shutdown (wrld);
230  #endif  #endif

Legend:
Removed from v.1912  
changed lines
  Added in v.1913

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0