/[MITgcm]/MITgcm_contrib/darwinview/src/darwin.c
ViewVC logotype

Diff of /MITgcm_contrib/darwinview/src/darwin.c

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

revision 1.4 by marissa, Mon Jul 16 15:40:16 2007 UTC revision 1.8 by marissa, Fri Aug 3 14:37:15 2007 UTC
# Line 9  Line 9 
9  #define RIGHT 102  #define RIGHT 102
10  #define LEFT 100  #define LEFT 100
11  #define MAX 700  #define MAX 700
12    #define SCALE .06
13    
14  int NX, NY, NZ;  int NX, NY, NZ;
15    
16  void do_byteswap_f32( float arr[], int nel ), global(), local( int, int, int );  void do_byteswap_f32( float arr[], int nel ), global(), local( int, int, int );
17  void readnames( char[] ), readarray( float[], char[], int ), readjet(), readxz( float[], char[] );  void readnames( char[] ), readarray( float[], char[], int ), readjet(), readxz( float[], char[] );
18  void TimerFunction( int ), bitmap( char[], int, int );  void readyz( float[], char[] ), readdepths( char[] );
19    void TimerFunction( int ), stroke( char[], int, int );
20    
21  float data[MAX][MAX*MAX], mxval, mnval, jet[64][3];  float data[MAX][MAX*MAX], mxval, mnval, jet[64][3];
22  float globalmx=0, globalmn=100;  float globalmx=0, globalmn=100;
23  int win[MAX], ilev=1, howmany, sets, count=0, glo=0, usr=0, anim=0, logscale=0, xz=0, nonegs=1, endian=0;  int win[MAX], ilev=1, howmany, sets, count=0, glo=0, usr=0, anim=0, endian=0;
24  int xmax, ymax, offset=0;  int xmax, ymax, yoffset=0, xoffset=0, yz=0, logscale=0, xz=0, nonegs=1;
25    int depths[MAX], scaledepth=0, totaldepth=0, scalecount=0;
26  char initfns[MAX][MAX], fns[MAX][MAX][MAX];  char initfns[MAX][MAX], fns[MAX][MAX][MAX];
27    
28  void menu(int value){           // called when menu is opened on right click  void menu( int value ){           // called when menu is opened on right click
29    
30   switch( value ){   switch( value ){
31    case 1: usr=glo=0;            // unset glo & usr, sets local max/min    case 1: usr=glo=0;            // unset glo & usr, sets local max/min
           glutPostRedisplay();  // recall display func with new values  
32            break;            break;
33    case 2: glo=1;                // enables global max/min      case 2: glo=1;                // enables global max/min  
34            usr=0;                // unsets usr            usr=0;                // unsets usr
35            mxval=globalmx;       // sets max to globalmx            mxval=globalmx;       // sets max to globalmx
36            mnval=globalmn;       // sets min to globalmn            mnval=globalmn;       // sets min to globalmn
           glutPostRedisplay();  // recall display func with new values  
37            break;            break;
38    case 3: usr=1;                // switch to user-set max/min    case 3: usr=1;                // switch to user-set max/min
39            glo=0;                // unset glo            glo=0;                // unset glo
40            printf( "Max=" );  scanf( "%f", &mxval );  // prompt user for new max            printf( "Max=" );  scanf( "%f", &mxval );  // prompt user for new max
41            printf( "Min=" );  scanf( "%f", &mnval );  // prompt user for new min            printf( "Min=" );  scanf( "%f", &mnval );  // prompt user for new min
           glutPostRedisplay();                       // recall display func with new values  
42            break;            break;
43    case 4: logscale=(logscale+1)%2;  // switch log scale on/off    case 4: logscale=( logscale+1 )%2;  // switch log scale on/off
           glutPostRedisplay();  
44            break;            break;
45    case 5: nonegs=(nonegs+1)%2;      // switch allowance of negatives on/off    case 5: nonegs=( nonegs+1 )%2;      // switch allowance of negatives on/off
           glutPostRedisplay();  
46            break;            break;
47    case 6: endian=(endian+1)%2;      // switch between big/little endian    case 6: endian=( endian+1 )%2;      // switch between big/little endian
           glutPostRedisplay();  
48            break;            break;
49   }   }
50     glutPostRedisplay();
51  }  }
52    
53  void display(){                 // called on glutPostRedisplay  void display(){                 // called on glutPostRedisplay
54   int i, j, ioff, q;   int i, h, ioff, q;
55   float r, g, b, k, y;   float r, g, b, k, y, j, tmp;
56   double num, logmx, logmn;   double num, logmx, logmn;
57   char str[MAX];   char str[MAX];
58    
59    
60   for( q=0; q<sets; q++ ){           // runs display func for each subwindow   for( q=0; q<sets; q++ ){           // runs display func for each subwindow
61    glutSetWindow( win[q] );          // sets which subwindow to display to    glutSetWindow( win[q] );          // sets which subwindow to display to
62    glClear( GL_COLOR_BUFFER_BIT );   // background to black    glClear( GL_COLOR_BUFFER_BIT );   // background to black
63    if( xz )   ymax=NZ;  
64    else       ymax=NY;    if( xz ) {  xmax=NX;  ymax=NZ;  }
65      else{
66       if( yz ){  xmax=NY;  ymax=NZ;  }
67       else    {  xmax=NX;  ymax=NY;  }
68      }
69    
70    if( glo || usr ){                  // if global or user-set max/min    if( glo || usr ){                  // if global or user-set max/min
71     if( xz )     if( xz )
72      readxz( data[q], fns[q][count] );      readxz( data[q], fns[q][count] );
73     else     else{
74      readarray( data[q], fns[q][count], ilev );  // read new array w/o calculating local max/min      if( yz )
75         readyz( data[q], fns[q][count] );
76        else
77         readarray( data[q], fns[q][count], ilev );  // read new array w/o calculating local max/min
78       }
79    }    }
80    else                              // if local max/min is set    else                              // if local max/min is set
81     local( q, count, ilev );         // read new array and calculate local max/min     local( q, count, ilev );         // read new array and calculate local max/min
# Line 83  void display(){                 // calle Line 91  void display(){                 // calle
91     }     }
92    }    }
93    
94    ioff=0;                           // ioff will count both i&j b/c data is 1D    if( scaledepth && xz || scaledepth && yz ) ymax=NY;
95    for( j=0; j<ymax; j++ ){            // cycles through y values    tmp=(float)ymax/totaldepth;
96      j=0; ioff=0; h=0;                        // ioff will count both i&j b/c data is 1D
97    
98      while ( j<ymax ){            // cycles through y values
99     for( i=0; i<xmax; i++ ){           // cycles through x values     for( i=0; i<xmax; i++ ){           // cycles through x values
100      r=g=b=0;                        // set color values to black      r=g=b=0;                          // set color values to black
101      if( data[q][ioff]==0 );           // if data=0, values stay black      if( data[q][ioff]==0 );           // if data=0, values stay black
102      else{      else{
103       if( logscale ){       if( logscale ){
# Line 113  void display(){                 // calle Line 124  void display(){                 // calle
124      }      }
125    
126      glColor3f( r, g, b );           // put r, g, b into effect      glColor3f( r, g, b );           // put r, g, b into effect
127      glRectf( i, j, i+1, j+1 );      // draws a square for data value      if( scaledepth && xz || scaledepth && yz )
128         glRectf( i, j, i+1, j+(depths[h]*tmp) );
129        else
130         glRectf( i, j, i+1, j+1 );      // draws a square for data value
131      ioff++;                          ioff++;                    
132     }     }
133       if( scaledepth && xz || scaledepth && yz ){
134        j+=(depths[h]*tmp);
135        h++;
136       }
137       else j++;
138    }    }
139    
140    glColor3f( 1, 1, 1 );             // set color to white    glColor3f( 1, 1, 1 );             // set color to white
141    glRectf( xmax, 0, xmax+1, ymax+1 );     // draws a border    glRectf( xmax, 0, xmax+1, ymax+1 );     // draws a border
142    glRectf( 0, ymax, xmax, ymax+1 );       // draws a border      glRectf( 0, ymax, xmax, ymax+1 );       // draws a border  
# Line 132  void display(){                 // calle Line 152  void display(){                 // calle
152     sprintf( str, "%.2f", logmx );     sprintf( str, "%.2f", logmx );
153    else    else
154     sprintf( str, "%.1e", mxval );    // labels color bar with max val     sprintf( str, "%.1e", mxval );    // labels color bar with max val
155    bitmap( str, xmax+2, ymax-1 );    stroke( str, xmax+2, ymax-1 );
156        
157    if( logscale )    if( logscale )
158     sprintf( str, "%.2f", logmn );     sprintf( str, "%.2f", logmn );
159    else    else
160     sprintf( str, "%.1e", mnval );    // labels color bar with min val     sprintf( str, "%.1e", mnval );    // labels color bar with min val
161    bitmap( str, xmax+2, 1 );    stroke( str, xmax+2, 1 );
162    
163    if( xz )    if( xz )
164     sprintf( str, "Y-coordinate=%d", offset+1);     sprintf( str, "N-S slice %d", yoffset+1);
165    else    else{
166     sprintf( str, "Level %d", ilev ); // labels current level     if( yz )
167    bitmap( str, 1, ymax+3 );      sprintf( str, "E-W slice %d", xoffset+1);
168       else
169        sprintf( str, "Level %d", ilev ); // labels current level
170      }
171      stroke( str, 1, ymax+5 );
172    
173    sprintf( str, "Time %d", count+1 ); // labels current time    sprintf( str, "Time %d", count+1 ); // labels current time
174    bitmap( str, 80, ymax+3 );    stroke( str, xmax/2, ymax+5 );
175    
176    if( glo )                         // labels how max/min have been set    if( glo )                         // labels how max/min have been set
177     sprintf( str, "Global" );        // if glo is set, display Global     sprintf( str, "Global" );        // if glo is set, display Global
# Line 155  void display(){                 // calle Line 179  void display(){                 // calle
179     sprintf( str, "User-set" );      // if usr is set, display User-set     sprintf( str, "User-set" );      // if usr is set, display User-set
180    if( !usr && !glo )    if( !usr && !glo )
181     sprintf( str, "Local" );         // else display Local     sprintf( str, "Local" );         // else display Local
182    bitmap( str, xmax+12, ymax+3 );    stroke( str, xmax+8, ymax+8 );
183        
184    if( anim ){                       // tell user if autoplay is on    if( anim ){                       // tell user if autoplay is on
185     sprintf( str, "Autoplay" );     sprintf( str, "Autoplay" );
186     bitmap( str, xmax-25, ymax+3 );     stroke( str, xmax-35, ymax+8 );
187    }    }
188    
189    if( logscale ){    if( logscale ){
190     sprintf( str, "Log Scale" );     // tell user if log scale is on     sprintf( str, "Log Scale" );     // tell user if log scale is on
191     bitmap( str, xmax-25, ymax+10 );     stroke( str, xmax-25, ymax+15);
192    }    }
193    
194    bitmap( fns[q][count], 1, ymax+10 ); // labels current file    stroke( fns[q][count], 1, ymax+15 ); // labels current file
195    
196    glutSwapBuffers();                // double buffering set to animate smoothly    glutSwapBuffers();                // double buffering set to animate smoothly
197    glFlush();    glFlush();
198   }   }
199  }  }
200    
201  void bitmap( char str[], int x, int y ){  // called to display text onscreen  void stroke( char str[], int x, int y ){  // called to display text onscreen
202   int i;   int i;
203    
204   glRasterPos2f( x, y );             // set position of text   glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
205     glEnable( GL_BLEND );
206     glEnable( GL_LINE_SMOOTH );
207     glMatrixMode( GL_MODELVIEW );
208    
209     glPushMatrix();
210    
211     glScalef( SCALE, SCALE, SCALE );
212     glTranslatef( (1/SCALE)*x, (1/SCALE)*y, 0 );
213    
214   for( i=0; i<strlen( str ); i++)    // display each character of str   for( i=0; i<strlen( str ); i++)    // display each character of str
215    glutBitmapCharacter( GLUT_BITMAP_HELVETICA_12, str[i] );    glutStrokeCharacter( GLUT_STROKE_ROMAN, str[i] );
216    
217     glPopMatrix();
218  }  }
219    
220  void key( unsigned char key, int x, int y ){   // called on key press  void key( unsigned char key, int x, int y ){   // called on key press
221   int i, tmp;   int i, tmp;
222     char fn[MAX];
223    
224   switch(key){   switch(key){
225    case 'q':   exit(0);              // quits on 'q'    case 'q':   exit(0);              // quits on 'q'
226                break;                break;
227    case 'r':   count=0;              // resets back to first time        case 'r':   count=0;              // resets back to first time    
228                ilev=1;               // and first level                ilev=1;               // and first level
229                glutPostRedisplay();                            xz=yz=0;
230                break;                break;
231    case 'a':   anim=(anim+1)%2;      // turns anim on/off    case 'a':   anim=(anim+1)%2;      // turns anim on/off
               glutPostRedisplay();              
232                break;                break;
233    case 'x':   xz=(xz+1)%2;    case 'x':   xz=(xz+1)%2;
234                glutPostRedisplay();                yz=0;
235                  break;
236      case 'y':   yz=(yz+1)%2;
237                  xz=0;
238                break;                break;
239      case 'z':   if( xz || yz ){
240                   scaledepth=( scaledepth+1 )%2;
241                   scalecount++;
242                   if( scalecount==1 ){
243                    printf( "Please enter filename containing depth data: " );
244                    scanf( "%s", fn );
245                    readdepths( fn );
246                   }
247                  }
248                  break;
249   }   }
250     glutPostRedisplay();
251  }  }
252    
253  void TimerFunction( int value ){    // called when anim is set and arrow key is pressed  void TimerFunction( int value ){    // called when anim is set and arrow key is pressed
254   int i;   int i;
255    
256   switch(value){                     // increments in the correct direction   switch(value){                     // increments in the correct direction
257    case DOWN : if( xz ){    case DOWN : if( xz && yoffset>0 )
258                 if( offset>0 )                 yoffset--;
                 offset--;  
               }  
259                else{                else{
260                 if( ilev<NZ )                 if( yz && xoffset<NX-1 )
261                  ilev++;              // if down arrow pressed, move down a level                        xoffset++;
262                   else
263                    if( ilev<NZ && !xz && !yz )
264                     ilev++;              // if down arrow pressed, move down a level      
265                }                }
266                break;                break;
267    case UP   : if( xz ){    case UP   : if( xz && yoffset<NY-1 )
268                 if( offset<NY-1 )                 yoffset++;
                 offset++;  
               }  
269                else{                else{
270                 if( ilev>1 )                     if( yz && xoffset>0 )
271                  ilev--;              // if up arrow is pressed, move up a level                  xoffset--;
272                   else
273                    if( ilev>1 && !xz && !yz )    
274                     ilev--;              // if up arrow is pressed, move up a level
275                }                }
276                break;                break;
277    case LEFT : if( count>0 )          case LEFT : if( count>0 )      
# Line 233  void TimerFunction( int value ){    // c Line 284  void TimerFunction( int value ){    // c
284    
285   glutPostRedisplay();               glutPostRedisplay();            
286    
287   if (anim )   if ( anim )
288    switch( value ){        switch( value ){    
289     case DOWN : if( xz ){     case DOWN : if( xz && yoffset==0 )
290                  if( offset==0 ) offset=NY-1;                  yoffset=NY-1;
                }  
291                 else{                 else{
292                  if( ilev==NZ ) ilev=1;                   // if end reached, restart                  if( yz && xoffset==NX-1 )
293                     xoffset=0;
294                    else
295                     if( ilev==NZ && !xz && !yz )
296                      ilev=1;                   // if end reached, restart
297                 }                 }
298                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself
299                 break;                 break;
300     case UP   : if( xz ){     case UP   : if( xz && yoffset==NY-1 )
301                  if( offset==NY-1) offset=0;                  yoffset=0;
                }  
302                 else{                 else{
303                  if( ilev==1 ) ilev=NZ;                   // if end reached, restart                  if( yz && xoffset==0 )
304                     xoffset=NX-1;
305                    else
306                     if( ilev==1 )
307                      ilev=NZ;                   // if end reached, restart
308                 }                 }
309                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself
310                 break;                 break;
# Line 267  void specialkey( int key, int x, int y ) Line 324  void specialkey( int key, int x, int y )
324    glutTimerFunc( 100, TimerFunction, key);             // to scroll automatically    glutTimerFunc( 100, TimerFunction, key);             // to scroll automatically
325    
326   switch(key){   switch(key){
327    case DOWN   :  if( xz ){    case DOWN   :  if( xz && yoffset>0 )
328                    if( offset>0 )                    yoffset--;
                    offset--;  
                  }  
329                   else{                   else{
330                    if( ilev<NZ )      // if you haven't reached the bottom                    if( yz && xoffset<NY-1 )
331                     ilev++;              // keep going down                     xoffset++;
332                      else
333                       if( ilev<NZ && !xz && !yz )      // if you haven't reached the bottom
334                        ilev++;              // keep going down
335                   }                   }
336                   break;                   break;
337    case UP     :  if( xz ){    case UP     :  if( xz && yoffset<NY-1 )
338                    if( offset<NY-1 )                    yoffset++;
                    offset++;  
                  }  
339                   else{                   else{
340                    if( ilev>1 )          // if you haven't reached the top                    if( yz && xoffset>0 )
341                     ilev--;              // keep going up                     xoffset--;
342                      else
343                       if( ilev>1 )          // if you haven't reached the top
344                        ilev--;              // keep going up
345                   }                   }
346                   break;                   break;
347    case RIGHT  :  if( count<howmany-1 ) // if you haven't reached the last file    case RIGHT  :  if( count<howmany-1 ) // if you haven't reached the last file
# Line 314  void local( int i, int time, int lev ){ Line 373  void local( int i, int time, int lev ){
373   mnval=100;   mnval=100;
374   if( xz )   if( xz )
375    readxz( data[i], fns[i][time]);    readxz( data[i], fns[i][time]);
376   else   else{
377    readarray( data[i], fns[i][time], lev );      // read new array of data    if( yz )
378       readyz( data[i], fns[i][time]);
379      else
380       readarray( data[i], fns[i][time], lev );      // read new array of data
381     }
382   for( j=0; j<xmax*ymax; j++ ){   for( j=0; j<xmax*ymax; j++ ){
383    if( data[i][j] > mxval )    if( data[i][j] > mxval )
384     mxval=data[i][j];                           // set largest val to mxval     mxval=data[i][j];                           // set largest val to mxval
# Line 348  void readnames( char filename[] ){ Line 411  void readnames( char filename[] ){
411   howmany=j-1;                                  // saves number of data filenames     howmany=j-1;                                  // saves number of data filenames  
412  }  }
413    
414    void readdepths( char filename[] ){
415     int i;
416     FILE* fp;
417    
418     fp=fopen( filename, "r" );
419    
420     for( i=NZ-1; i>=0; i-- ){
421      fscanf( fp, "%d ", &depths[i] );
422      totaldepth+=depths[i];
423     }
424    
425     fclose( fp );
426    }
427    
428  void readjet(){               //reads in color scale values  void readjet(){               //reads in color scale values
429   FILE* fp;   FILE* fp;
430   int i, j;   int i, j;
# Line 360  void readjet(){               //reads in Line 437  void readjet(){               //reads in
437  }  }
438    
439  void readxz( float arr[], char filename[] ){  void readxz( float arr[], char filename[] ){
440   int i;   int i, j;
441   float tmp[MAX*MAX];   float tmp[MAX][MAX], tmp2[MAX*MAX];
442   FILE* fp;   FILE* fp;
443    
444   fp=fopen( filename, "rb" );     fp=fopen( filename, "rb" );  
445   for( i=0; i<NZ; i++){   for( i=0; i<NZ; i++){
446    fseek( fp, (NX*offset*4)+(i*NX*NY*4), SEEK_SET );    fseek( fp, (NX*yoffset*4)+(i*NX*NY*4), SEEK_SET );
447    fread( &arr[NX*i], sizeof( arr[0] ), NX, fp );  // reads in data to fill one level    fread( &arr[NX*i], sizeof( arr[0] ), NX, fp );  // reads in data to fill one level
448   }   }
449   fclose( fp );   fclose( fp );
450   for( i=1; i<NX*NZ+1; i++ )  
451    tmp[NX*NZ-i]=arr[i-1];   for( i=0; i<NZ; i++ )
452   for( i=0; i<NX*NZ; i++ )    for( j=0; j<NX; j++)
453    arr[i]=tmp[i];     tmp[i][j]=arr[i*NX+j];
454    
455     for( i=0; i<NZ; i++ )
456      for( j=0; j<NX; j++)
457       tmp2[i*NX+j]=tmp[NZ-i-1][j];
458    
459     for( i=0; i<NX*NZ; i++)
460      arr[i]=tmp2[i];
461    }
462    
463    void readyz( float arr[], char filename[] ){
464     int i, j;
465     float tmp[MAX][MAX], tmp2[MAX*MAX];
466     FILE* fp;  
467    
468     fp=fopen( filename, "rb" );
469     for( i=0; i<NY*NZ; i++ ){
470      fseek( fp, (xoffset*4)+(i*NX*4), SEEK_SET );
471      fread( &arr[i], sizeof( arr[0] ), 1, fp );
472     }
473     fclose(fp);
474    
475     for( i=0; i<NZ; i++ )
476      for( j=0; j<NY; j++)
477       tmp[i][j]=arr[i*NY+j];
478    
479     for( i=0; i<NZ; i++ )
480      for( j=0; j<NY; j++)
481       tmp2[i*NY+j]=tmp[NZ-i-1][j];
482    
483     for( i=0; i<NY*NZ; i++)
484      arr[i]=tmp2[i];
485  }  }
486    
487  void readarray( float arr[], char filename[], int il ){   // reads new data  void readarray( float arr[], char filename[], int il ){   // reads new data
488   FILE* fp;   FILE* fp;
489   int i;   int i;
490    
491   fp=fopen( filename, "rb" );                  // opens the file containing data   fp=fopen( filename, "rb" );                 // opens the file containing data
492   fseek( fp, (il-1)*NX*NY*4, SEEK_SET );      // seeks to the correct place using ilev   fseek( fp, (il-1)*NX*NY*4, SEEK_SET );      // seeks to the correct place using ilev
493   fread( arr, sizeof( arr[0] ), NX*NY, fp );  // reads in data to fill one level   fread( arr, sizeof( arr[0] ), NX*NY, fp );  // reads in data to fill one level
494   fclose( fp );                               // close file   fclose( fp );                               // close file
# Line 409  void do_byteswap_f32( float arr[], int n Line 517  void do_byteswap_f32( float arr[], int n
517   }   }
518  }  }
519    
520  void black(){  void black( ){
521   glClear( GL_COLOR_BUFFER_BIT );   glClear( GL_COLOR_BUFFER_BIT );
522   glutSwapBuffers();   glutSwapBuffers();
523   glFlush();   glFlush();
524  }  }
525    
526    
527  int main( int argc, char *argv[] ){  int main( int argc, char *argv[] ){
528   int i, setsx, setsy, tmpx, tmpy, winx, winy, parent;   int i, setsx, setsy, tmpx, tmpy, winx, winy, parent;
529   char filename[MAX];   char str[MAX], filename[MAX];
530     FILE* fp;
531    
532     if( strcmp(argv[1], "binary") == 0 )
533      fp=fopen( ".darwinview/binconfig", "r" );
534     else
535      if( strcmp(argv[1],"netcdf") == 0 )
536       fp=fopen( ".darwinview/ncconfig", "r" );
537    
538   sscanf( argv[1], "%dx%d", &winx, &winy );  // reads screen resolution from command line   fscanf( fp, "%dx%d ", &winx, &winy );
539   winy-=60;  winx-=20;                     // adjusts resolution so edges won't get cut off               winy-=60;  winx-=20;                     // adjusts resolution so edges won't get cut off            
540     fscanf( fp, "%d %d %d ", &NX, &NY, &NZ );
541   printf( "Please enter x, y and z dimensions.\n" );     fscanf( fp, "%dx%d ", &setsx, &setsy );                // prompts user for dimensions of subwindows
542   scanf( "%d %d %d", &NX, &NY, &NZ );           // prompts user for NX, NY, NZ   fscanf( fp, "%s", filename );
543   printf( "Please enter filename.\n" );  
544   scanf( "%s", filename );                         // prompts user for initial filenames   fclose( fp );
  printf( "Please enter dimensions of data sets.\n" );  
  scanf( "%dx%d", &setsx, &setsy );                 // prompts user for dimensions of subwindows  
545    
546   xmax=NX; ymax=NY;   xmax=NX; ymax=NY;
547    
# Line 453  int main( int argc, char *argv[] ){ Line 567  int main( int argc, char *argv[] ){
567    tmpy = (i/setsx)*(winy/setsy);                  // y coordinate of top left corner of subwindow    tmpy = (i/setsx)*(winy/setsy);                  // y coordinate of top left corner of subwindow
568    
569    win[i]=glutCreateSubWindow( parent, tmpx, tmpy, winx/setsx, winy/setsy ); // creates subwindow    win[i]=glutCreateSubWindow( parent, tmpx, tmpy, winx/setsx, winy/setsy ); // creates subwindow
570    gluOrtho2D( 0, NX+35, 0, NY+15 );               // sets how data is mapped to subwindow    gluOrtho2D( 0, NX+35, 0, NY+25 );               // sets how data is mapped to subwindow
571    glutKeyboardFunc( key );                        // called on key press    glutKeyboardFunc( key );                        // called on key press
572    glutSpecialFunc( specialkey );                  // called on special key press (arrow keys)    glutSpecialFunc( specialkey );                  // called on special key press (arrow keys)
573    if( i >= sets )                                 //    if( i >= sets )                                 //

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.22