/[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.2 by marissa, Thu Jul 12 18:30:19 2007 UTC revision 1.4 by marissa, Mon Jul 16 15:40:16 2007 UTC
# Line 8  Line 8 
8  #define DOWN 103  #define DOWN 103
9  #define RIGHT 102  #define RIGHT 102
10  #define LEFT 100  #define LEFT 100
11  #define MAX 200  #define MAX 700
12    
13  int NX, NY, MAXNZ, setsx, setsy;  int NX, NY, NZ;
14    
15  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 );
16  void readnames( char[] ), readarray( float[], char[], int ), readjet();  void readnames( char[] ), readarray( float[], char[], int ), readjet(), readxz( float[], char[] );
17  void TimerFunction( int ), bitmap( char[], int, int );  void TimerFunction( int ), bitmap( char[], int, int );
18    
19  float data[MAX][MAX*MAX], mxval, mnval, jet[MAX][MAX];  float data[MAX][MAX*MAX], mxval, mnval, jet[64][3];
20  float globalmx=0, globalmn=100;  float globalmx=0, globalmn=100;
21  int win[MAX], ilev=1, howmany, count=0, glo=0, usr=0, anim=0, logscale=0;  int win[MAX], ilev=1, howmany, sets, count=0, glo=0, usr=0, anim=0, logscale=0, xz=0, nonegs=1, endian=0;
22    int xmax, ymax, offset=0;
23  char initfns[MAX][MAX], fns[MAX][MAX][MAX];  char initfns[MAX][MAX], fns[MAX][MAX][MAX];
24    
25  void menu(int value){           // called when menu is opened on right click  void menu(int value){           // called when menu is opened on right click
# Line 42  void menu(int value){           // calle Line 43  void menu(int value){           // calle
43    case 4: logscale=(logscale+1)%2;  // switch log scale on/off    case 4: logscale=(logscale+1)%2;  // switch log scale on/off
44            glutPostRedisplay();            glutPostRedisplay();
45            break;            break;
46      case 5: nonegs=(nonegs+1)%2;      // switch allowance of negatives on/off
47              glutPostRedisplay();
48              break;
49      case 6: endian=(endian+1)%2;      // switch between big/little endian
50              glutPostRedisplay();
51              break;
52   }   }
53  }  }
54    void display(){                 // called on glutPostRedisplay
 void display(void){                 // called on glutPostRedisplay  
55   int i, j, ioff, q;   int i, j, ioff, q;
56   float r, g, b, k, y;   float r, g, b, k, y;
57   double num, logmx, logmn;   double num, logmx, logmn;
58   char str[MAX];   char str[MAX];
59    
60   for( q=0; q<setsx*setsy; 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( glo || usr )                  // if global or user-set max/min    if( xz )   ymax=NZ;
64     readarray( data[q], fns[q][count], ilev );  // read new array w/o calculating local max/min    else       ymax=NY;
65    
66      if( glo || usr ){                  // if global or user-set max/min
67       if( xz )
68        readxz( data[q], fns[q][count] );
69       else
70        readarray( data[q], fns[q][count], ilev );  // read new array w/o calculating local max/min
71      }
72    else                              // if local max/min is set    else                              // if local max/min is set
73     local( q, count, ilev );         // read new array and calculate local max/min     local( q, count, ilev );         // read new array and calculate local max/min
74    
# Line 69  void display(void){                 // c Line 82  void display(void){                 // c
82      logmn=log10( mnval );      logmn=log10( mnval );
83     }     }
84    }    }
85    
86    ioff=0;                           // ioff will count both i&j b/c data is 1D    ioff=0;                           // ioff will count both i&j b/c data is 1D
87    for( j=0; j<NY; j++ ){            // cycles through y values    for( j=0; j<ymax; j++ ){            // cycles through y values
88     for( i=0; i<NX; i++ ){           // cycles through x values     for( i=0; i<xmax; i++ ){           // cycles through x values
89      r=g=b=0;                        // set color values to black      r=g=b=0;                        // set color values to black
90      if( data[q][ioff]==0 );           // if data=0, values stay black      if( data[q][ioff]==0 );           // if data=0, values stay black
91      else{      else{
# Line 80  void display(void){                 // c Line 93  void display(void){                 // c
93        num=(double)data[q][ioff];        num=(double)data[q][ioff];
94        num=log10( num );        num=log10( num );
95        if( num<logmn ) num=0;        if( num<logmn ) num=0;
96        if( num>logmx ) num=63;        else{
97        else         if( num>logmx ) num=63;
98         num=63*( num-logmn )/( logmx-logmn );         else
99            num=63*( num-logmn )/( logmx-logmn );
100          }
101       }       }
102       else{       else{
103        if( data[q][ioff]<mnval )  num=0;   // if data is less than min, =min        if( data[q][ioff]<mnval )  num=0;   // if data is less than min, =min
104        else        else{
105         if( data[q][ioff]>mxval )  num=63; // if data is more than max, =max         if( data[q][ioff]>mxval )  num=63; // if data is more than max, =max
106         else         else
107          num=63*( data[q][ioff]-mnval )/( mxval-mnval );  // scale num from 0-63 (not defined for 64)          num=63*( data[q][ioff]-mnval )/( mxval-mnval );  // scale num from 0-63 (not defined for 64)
108          }
109       }       }
110       r=jet[(int)num][0];            // set red val       r=jet[(int)num][0];            // set red val
111       g=jet[(int)num][1];            // set green val       g=jet[(int)num][1];            // set green val
# Line 102  void display(void){                 // c Line 118  void display(void){                 // c
118     }     }
119    }    }
120    glColor3f( 1, 1, 1 );             // set color to white    glColor3f( 1, 1, 1 );             // set color to white
121    glRectf( NX, 0, NX+1, NY+1 );     // draws a border    glRectf( xmax, 0, xmax+1, ymax+1 );     // draws a border
122    glRectf( 0, NY, NX, NY+1 );       // draws a border      glRectf( 0, ymax, xmax, ymax+1 );       // draws a border  
123    for( i=0; i<64; i++ ){            // draws color bar        for( i=0; i<64; i++ ){            // draws color bar    
124     glColor3f( jet[i][0], jet[i][1], jet[i][2]);         // sets color     glColor3f( jet[i][0], jet[i][1], jet[i][2]);         // sets color
125     k=(float)i;                      // turns i into a float     k=(float)i;                      // turns i into a float
126     y=(float)NY/64;                  // sets height of rectangles     y=(float)ymax/64;                  // sets height of rectangles
127     glRectf( NX+10, y*k, NX+20, (k+1)*y );               // draws rectangle     glRectf( xmax+10, y*k, xmax+20, (k+1)*y );               // draws rectangle
128    }    }
129    glColor3f( 1, 1, 1 );             // color to white    glColor3f( 1, 1, 1 );             // color to white
130    
131    if( logscale )    if( logscale )
132     sprintf( str, "%.2f", logmx );     sprintf( str, "%.2f", logmx );
133    else    else
134     sprintf( str, "%.2e", mxval );    // labels color bar with max val     sprintf( str, "%.1e", mxval );    // labels color bar with max val
135    bitmap( str, NX+2, NY-1 );    bitmap( str, xmax+2, ymax-1 );
136        
137    if( logscale )    if( logscale )
138     sprintf( str, "%.2f", logmn );     sprintf( str, "%.2f", logmn );
139    else    else
140     sprintf( str, "%.2e", mnval );    // labels color bar with min val     sprintf( str, "%.1e", mnval );    // labels color bar with min val
141    bitmap( str, NX+2, 1 );    bitmap( str, xmax+2, 1 );
142    
143    sprintf( str, "Level %d", ilev ); // labels current level    if( xz )
144    bitmap( str, 1, NY+3 );     sprintf( str, "Y-coordinate=%d", offset+1);
145      else
146       sprintf( str, "Level %d", ilev ); // labels current level
147      bitmap( str, 1, ymax+3 );
148    
149    sprintf( str, "Time %d", count+1 ); // labels current time    sprintf( str, "Time %d", count+1 ); // labels current time
150    bitmap( str, 50, NY+3 );    bitmap( str, 80, ymax+3 );
151    
152    if( glo )                         // labels how max/min have been set    if( glo )                         // labels how max/min have been set
153     sprintf( str, "Global" );        // if glo is set, display Global     sprintf( str, "Global" );        // if glo is set, display Global
# Line 136  void display(void){                 // c Line 155  void display(void){                 // c
155     sprintf( str, "User-set" );      // if usr is set, display User-set     sprintf( str, "User-set" );      // if usr is set, display User-set
156    if( !usr && !glo )    if( !usr && !glo )
157     sprintf( str, "Local" );         // else display Local     sprintf( str, "Local" );         // else display Local
158    bitmap( str, NX+12, NY+3 );    bitmap( str, xmax+12, ymax+3 );
159        
160    if( anim ){                       // tell user if autoplay is on    if( anim ){                       // tell user if autoplay is on
161     sprintf( str, "Autoplay" );     sprintf( str, "Autoplay" );
162     bitmap( str, NX-25, NY+3 );     bitmap( str, xmax-25, ymax+3 );
163    }    }
164    
165    if( logscale ){    if( logscale ){
166     sprintf( str, "Log Scale" );     // tell user if log scale is on     sprintf( str, "Log Scale" );     // tell user if log scale is on
167     bitmap( str, NX-25, NY+10 );     bitmap( str, xmax-25, ymax+10 );
168    }    }
169    
170    bitmap( fns[q][count], 1, NY+10 ); // labels current file    bitmap( fns[q][count], 1, ymax+10 ); // labels current file
171    
172    glutSwapBuffers();                // double buffering set to animate smoothly    glutSwapBuffers();                // double buffering set to animate smoothly
173    glFlush();    glFlush();
# Line 164  void bitmap( char str[], int x, int y ){ Line 183  void bitmap( char str[], int x, int y ){
183  }  }
184    
185  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
186   int i;   int i, tmp;
187    
188   switch(key){   switch(key){
189    case 'q':   exit(0);              // quits on 'q'    case 'q':   exit(0);              // quits on 'q'
# Line 176  void key( unsigned char key, int x, int Line 195  void key( unsigned char key, int x, int
195    case 'a':   anim=(anim+1)%2;      // turns anim on/off    case 'a':   anim=(anim+1)%2;      // turns anim on/off
196                glutPostRedisplay();                            glutPostRedisplay();            
197                break;                break;
198      case 'x':   xz=(xz+1)%2;
199                  glutPostRedisplay();
200                  break;
201   }   }
202  }  }
203    
# Line 183  void TimerFunction( int value ){    // c Line 205  void TimerFunction( int value ){    // c
205   int i;   int i;
206    
207   switch(value){                     // increments in the correct direction   switch(value){                     // increments in the correct direction
208    case DOWN : if( ilev<MAXNZ )    case DOWN : if( xz ){
209                 ilev++;              // if down arrow pressed, move down a level                       if( offset>0 )
210                    offset--;
211                  }
212                  else{
213                   if( ilev<NZ )
214                    ilev++;              // if down arrow pressed, move down a level      
215                  }
216                break;                break;
217    case UP   : if( ilev>1 )        case UP   : if( xz ){
218                 ilev--;              // if up arrow is pressed, move up a level                 if( offset<NY-1 )
219                    offset++;
220                  }
221                  else{
222                   if( ilev>1 )    
223                    ilev--;              // if up arrow is pressed, move up a level
224                  }
225                break;                break;
226    case LEFT : if( count>0 )          case LEFT : if( count>0 )      
227                 count--;             // if left arrow is pressed, move back one time step                 count--;             // if left arrow is pressed, move back one time step
# Line 201  void TimerFunction( int value ){    // c Line 235  void TimerFunction( int value ){    // c
235    
236   if (anim )   if (anim )
237    switch( value ){        switch( value ){    
238     case DOWN : if( ilev==MAXNZ ) ilev=1;                   // if end reached, restart     case DOWN : if( xz ){
239                    if( offset==0 ) offset=NY-1;
240                   }
241                   else{
242                    if( ilev==NZ ) ilev=1;                   // if end reached, restart
243                   }
244                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself
245                 break;                 break;
246     case UP   : if( ilev==1 ) ilev=MAXNZ;                   // if end reached, restart     case UP   : if( xz ){
247                    if( offset==NY-1) offset=0;
248                   }
249                   else{
250                    if( ilev==1 ) ilev=NZ;                   // if end reached, restart
251                   }
252                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself                 glutTimerFunc( 100, TimerFunction, value ); // recalls itself
253                 break;                 break;
254     case LEFT : if( count==0 ) count=howmany-1;             // if end reached, restart     case LEFT : if( count==0 ) count=howmany-1;             // if end reached, restart
# Line 223  void specialkey( int key, int x, int y ) Line 267  void specialkey( int key, int x, int y )
267    glutTimerFunc( 100, TimerFunction, key);             // to scroll automatically    glutTimerFunc( 100, TimerFunction, key);             // to scroll automatically
268    
269   switch(key){   switch(key){
270    case DOWN   :  if( ilev<MAXNZ )      // if you haven't reached the bottom    case DOWN   :  if( xz ){
271                    ilev++;              // keep going down                    if( offset>0 )
272                       offset--;
273                     }
274                     else{
275                      if( ilev<NZ )      // if you haven't reached the bottom
276                       ilev++;              // keep going down
277                     }
278                   break;                   break;
279    case UP     :  if( ilev>1 )          // if you haven't reached the top    case UP     :  if( xz ){
280                    ilev--;              // keep going up                    if( offset<NY-1 )
281                       offset++;
282                     }
283                     else{
284                      if( ilev>1 )          // if you haven't reached the top
285                       ilev--;              // keep going up
286                     }
287                   break;                   break;
288    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
289                    count++;             // keep going right                    count++;             // keep going right
# Line 242  void specialkey( int key, int x, int y ) Line 298  void specialkey( int key, int x, int y )
298  void global(){                         // calculates the max/min for the total data set  void global(){                         // calculates the max/min for the total data set
299   FILE* fp;   FILE* fp;
300   int h, i, j;   int h, i, j;
301   for( h=0; h<setsx*setsy; h++)         // cycles through each window   for( h=0; h<sets; h++)                // cycles through each window
302    for( i=0; i<howmany; i++ )           // cycles through each time    for( i=0; i<howmany; i++ )           // cycles through each time
303     for( j=0; j<MAXNZ; j++ ){           // cycles through each level for each file     for( j=0; j<NZ; j++ ){              // cycles through each level for each file
304      local( h, i, j );                  // calculates local max/min for specific data set      local( h, i, j );                  // calculates local max/min for specific data set
305      if( mxval > globalmx ) globalmx = mxval;   // sets highest value to globalmx      if( mxval > globalmx ) globalmx = mxval;   // sets highest value to globalmx
306      if( mnval < globalmn ) globalmn = mnval;   // sets lowest value to globalmn      if( mnval < globalmn ) globalmn = mnval;   // sets lowest value to globalmn
# Line 256  void local( int i, int time, int lev ){ Line 312  void local( int i, int time, int lev ){
312    
313   mxval=0;     mxval=0;  
314   mnval=100;   mnval=100;
315   readarray( data[i], fns[i][time], lev );      // read new array of data   if( xz )
316   for( j=0; j<NX*NY; j++ ){    readxz( data[i], fns[i][time]);
317     else
318      readarray( data[i], fns[i][time], lev );      // read new array of data
319     for( j=0; j<xmax*ymax; j++ ){
320    if( data[i][j] > mxval )    if( data[i][j] > mxval )
321     mxval=data[i][j];                           // set largest val to mxval     mxval=data[i][j];                           // set largest val to mxval
322    if( data[i][j] < mnval && data[i][j] > 0 )    if( data[i][j] < mnval && data[i][j]!=0 )
323     mnval=data[i][j];                           // set smallest positive val to mnval     mnval=data[i][j];                           // set smallest positive val to mnval
324   }   }
325  }  }
# Line 275  void readnames( char filename[] ){ Line 334  void readnames( char filename[] ){
334    i++;                                         // counts how many filenames there are      i++;                                         // counts how many filenames there are  
335   }   }
336   fclose( fp );                                 // close file   fclose( fp );                                 // close file
337   howmany=i-1;                                  // saves number of initial filenames   sets=i-1;                                  // saves number of initial filenames
338    
339   for(i=0; i<howmany; i++){                     // goes through each read-in filename   for(i=0; i<sets; i++){                     // goes through each read-in filename
340    fp=fopen( initfns[i], "r" );                 // opens each filename      fp=fopen( initfns[i], "r" );                 // opens each filename  
341    j=0;    j=0;
342    while( !feof(fp) ){                          // reads in filenames from each filename    while( !feof(fp) ){                          // reads in filenames from each filename
# Line 290  void readnames( char filename[] ){ Line 349  void readnames( char filename[] ){
349  }  }
350    
351  void readjet(){               //reads in color scale values  void readjet(){               //reads in color scale values
   
352   FILE* fp;   FILE* fp;
353   int i, j;   int i, j;
354        
# Line 301  void readjet(){               //reads in Line 359  void readjet(){               //reads in
359   fclose( fp );                // closes file   fclose( fp );                // closes file
360  }  }
361    
362    void readxz( float arr[], char filename[] ){
363     int i;
364     float tmp[MAX*MAX];
365     FILE* fp;
366    
367     fp=fopen( filename, "rb" );  
368     for( i=0; i<NZ; i++){
369      fseek( fp, (NX*offset*4)+(i*NX*NY*4), SEEK_SET );
370      fread( &arr[NX*i], sizeof( arr[0] ), NX, fp );  // reads in data to fill one level
371     }
372     fclose( fp );
373     for( i=1; i<NX*NZ+1; i++ )
374      tmp[NX*NZ-i]=arr[i-1];
375     for( i=0; i<NX*NZ; i++ )
376      arr[i]=tmp[i];
377    }
378    
379  void readarray( float arr[], char filename[], int il ){   // reads new data  void readarray( float arr[], char filename[], int il ){   // reads new data
380   FILE *fp;   FILE* fp;
381   int i;   int i;
382    
383   fp=fopen( filename, "r" );                  // opens the file containing data   fp=fopen( filename, "rb" );                  // opens the file containing data
384   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
385   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
386   fclose( fp );                               // close file   fclose( fp );                               // close file
  for( i=0; i<NX*NY; i++ )                      
   if( arr[i] < 0 )  arr[i] = pow(10, -20);   // sets negative values to 10^-20  
387    
388   //do_byteswap_f32( arr, NX*NY );            // switches endian   if( nonegs )
389      for( i=0; i<NX*NY; i++ )                    
390       if( arr[i] < 0 )
391        arr[i] = pow(10, -20);   // sets negative values to 10^-20
392    
393     if( endian )
394      do_byteswap_f32( arr, NX*NY );            // switches endian
395  }  }
396    
397  void do_byteswap_f32( float arr[], int nel ) // switches endian  void do_byteswap_f32( float arr[], int nel ){ // switches endian
398  {  
399     int i;   int i;
400     char src[4];   char src[4], trg[4];
401     char trg[4];  
402     for( i=0; i<nel; i++ ){   for( i=0; i<nel; i++ ){
403      memcpy( src, &(arr[i]), 4);    memcpy( src, &(arr[i]), 4 );
404      trg[0]=src[3];    trg[0]=src[3];
405      trg[1]=src[2];    trg[1]=src[2];
406      trg[2]=src[1];    trg[2]=src[1];
407      trg[3]=src[0];    trg[3]=src[0];
408      memcpy( &(arr[i]), trg, 4);    memcpy( &(arr[i]), trg, 4 );
409     }   }
410    }
411    
412    void black(){
413     glClear( GL_COLOR_BUFFER_BIT );
414     glutSwapBuffers();
415     glFlush();
416  }  }
417    
418  int main( int argc, char *argv[] ){  int main( int argc, char *argv[] ){
419   int i, tmpx, tmpy, winx, winy, parent;   int i, setsx, setsy, tmpx, tmpy, winx, winy, parent;
420   char filename[MAX];   char filename[MAX];
421    
422   sscanf(argv[1], "%dx%d", &winx, &winy);  // reads screen resolution from command line   sscanf( argv[1], "%dx%d", &winx, &winy );  // reads screen resolution from command line
423   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            
424    
425   printf( "Please enter x, y and z dimensions.\n" );     printf( "Please enter x, y and z dimensions.\n" );  
426   scanf( "%d %d %d", &NX, &NY, &MAXNZ );           // prompts user for NX, NY, NZ   scanf( "%d %d %d", &NX, &NY, &NZ );           // prompts user for NX, NY, NZ
427   printf( "Please enter filename.\n" );   printf( "Please enter filename.\n" );
428   scanf( "%s", filename );                         // prompts user for initial filenames   scanf( "%s", filename );                         // prompts user for initial filenames
429   printf( "Please enter dimensions of data sets.\n" );   printf( "Please enter dimensions of data sets.\n" );
430   scanf( "%dx%d", &setsx, &setsy);                 // prompts user for dimensions of subwindows   scanf( "%dx%d", &setsx, &setsy );                 // prompts user for dimensions of subwindows
431    
432     xmax=NX; ymax=NY;
433    
434   readjet();                               // stores color values   readjet();                               // stores color values
435   readnames( filename );                   // gets list of filenames to read from   readnames( filename );                   // gets list of filenames to read from
# Line 360  int main( int argc, char *argv[] ){ Line 446  int main( int argc, char *argv[] ){
446   glutDisplayFunc( display );   glutDisplayFunc( display );
447   glutKeyboardFunc( key );                         // called on key press   glutKeyboardFunc( key );                         // called on key press
448   glutSpecialFunc( specialkey );                   // called on special key press (arrow keys)   glutSpecialFunc( specialkey );                   // called on special key press (arrow keys)
449    
450    
451   for( i=0; i<setsx*setsy; i++ ){   for( i=0; i<setsx*setsy; i++ ){
452    tmpx = (i%setsx)*(winx/setsx);                  // x coordinate of top left corner of subwindow    tmpx = (i%setsx)*(winx/setsx);                  // x coordinate of top left corner of subwindow
453    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
454    
   local( i, count, ilev );                        // reads curr data array, finds local max/min  
   
455    win[i]=glutCreateSubWindow( parent, tmpx, tmpy, winx/setsx, winy/setsy ); // creates subwindow    win[i]=glutCreateSubWindow( parent, tmpx, tmpy, winx/setsx, winy/setsy ); // creates subwindow
456    gluOrtho2D( 0, NX+35, 0, NY+15 );               // sets how data is mapped to subwindow    gluOrtho2D( 0, NX+35, 0, NY+15 );               // sets how data is mapped to subwindow
   glutDisplayFunc( display );                     // sets display func for subwindow  
457    glutKeyboardFunc( key );                        // called on key press    glutKeyboardFunc( key );                        // called on key press
458    glutSpecialFunc( specialkey );                  // called on special key press (arrow keys)    glutSpecialFunc( specialkey );                  // called on special key press (arrow keys)
459      if( i >= sets )                                 //
460       glutDisplayFunc( black );
461      else
462       glutDisplayFunc( display );                     // sets display func for subwindow
463      
464    
465    glutCreateMenu( menu );                         // adds a menu    glutCreateMenu( menu );                                // adds a menu
466     glutAddMenuEntry( "Local Color Scale", 1 );    // adds a menu entry     glutAddMenuEntry( "Local Color Scale", 1 );           // adds a menu entry
467     glutAddMenuEntry( "Global Color Scale", 2 );   // adds a menu entry     glutAddMenuEntry( "Global Color Scale", 2 );          // adds a menu entry
468     glutAddMenuEntry( "User-Set Color Scale", 3 ); // adds a menu entry     glutAddMenuEntry( "User-Set Color Scale", 3 );        // adds a menu entry
469     glutAddMenuEntry( "Log Scale (on/off)", 4 );   // adds a menu entry     glutAddMenuEntry( "Log Scale (on/off)", 4 );          // adds a menu entry
470    glutAttachMenu( GLUT_RIGHT_BUTTON );            // menu called on right click     glutAddMenuEntry( "Allow Negatives (on/off)", 5 );    // adds a menu entry
471       glutAddMenuEntry( "Switch Endian (big/little) ", 6);  // adds a menu entry
472      glutAttachMenu( GLUT_RIGHT_BUTTON );                   // menu called on right click
473   }   }
474    
475   glutMainLoop();                                  // begin processing events   glutMainLoop();                                  // begin processing events

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

  ViewVC Help
Powered by ViewVC 1.1.22