home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / demos / ftest.c < prev    next >
C/C++ Source or Header  |  1996-05-27  |  858b  |  59 lines

  1. /* ftest.c */
  2.  
  3.  
  4. /*
  5.  * This program calls fdraw in fdraw.f to exercise the Fortran
  6.  * interface to Mesa.
  7.  *
  8.  * To make this demo work you may have to change the call to fdraw_()
  9.  * below to just fdraw().
  10.  *
  11.  */
  12.  
  13.  
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include "gltk.h"
  17.  
  18.  
  19. extern void fdraw_( int *width, int *height );
  20.  
  21.  
  22. static int Width = 300;
  23. static int Height = 300;
  24.  
  25.  
  26.  
  27.  
  28. static void Reshape(int width, int height)
  29. {
  30.    Width = width;
  31.    Height = height;
  32. }
  33.  
  34.  
  35. static void Draw(void)
  36. {
  37.    fdraw_( &Width, &Height );
  38. }
  39.  
  40.  
  41. void cmain_(int argc, char **argv)
  42. {
  43.     GLenum type;
  44.  
  45.     tkInitPosition(0, 0, Width, Height );
  46.  
  47.     type = TK_RGB | TK_SINGLE | TK_INDIRECT;
  48.     tkInitDisplayMode(type);
  49.  
  50.     if (tkInitWindow("Fortran Test") == GL_FALSE) {
  51.     tkQuit();
  52.     }
  53.  
  54.     tkExposeFunc(Reshape);
  55.     tkReshapeFunc(Reshape);
  56.     tkDisplayFunc(Draw);
  57.     tkExec();
  58. }
  59.