home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / sviluppo / mesa-glut / test / glut / test20.c < prev    next >
C/C++ Source or Header  |  1998-10-23  |  4KB  |  140 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1996, 1997. */
  3.  
  4. /* This program is freely distributable without licensing fees 
  5.    and is provided without guarantee or warrantee expressed or 
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. /* Test glutExtensionSupported. */
  9.  
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <GL/glut.h>
  14.  
  15. void
  16. wrangleExtensionName(char *extension)
  17. {
  18.   char buffer[512];
  19.   int rc, len;
  20.  
  21.   sprintf(buffer, " %s", extension);
  22.   rc = glutExtensionSupported(buffer);
  23.   if (rc) {
  24.     printf("FAIL: test20, space prefix\n");
  25.     exit(1);
  26.   }
  27.  
  28.   sprintf(buffer, "%s ", extension);
  29.   rc = glutExtensionSupported(buffer);
  30.   if (rc) {
  31.     printf("FAIL: test20, space suffix\n");
  32.     exit(1);
  33.   }
  34.  
  35.   sprintf(buffer, "GL_%s", extension);
  36.   rc = glutExtensionSupported(buffer);
  37.   if (rc) {
  38.     printf("FAIL: test20, GL_ prefix\n");
  39.     exit(1);
  40.   }
  41.  
  42.   sprintf(buffer, "%s", extension + 1);
  43.   rc = glutExtensionSupported(buffer);
  44.   if (rc) {
  45.     printf("FAIL: test20, missing first character\n");
  46.     exit(1);
  47.   }
  48.  
  49.   sprintf(buffer, "%s", extension);
  50.   len = (int) strlen(buffer);
  51.   if(len > 0) {
  52.     buffer[len-1] = '\0';
  53.   }
  54.   rc = glutExtensionSupported(buffer);
  55.   if (rc) {
  56.     printf("FAIL: test20, mising last character\n");
  57.     exit(1);
  58.   }
  59.  
  60.   sprintf(buffer, "%s", extension);
  61.   len = (int) strlen(buffer);
  62.   if(len > 0) {
  63.     buffer[len-1] = 'X';
  64.   }
  65.   rc = glutExtensionSupported(buffer);
  66.   if (rc) {
  67.     printf("FAIL: test20, changed last character\n");
  68.     exit(1);
  69.   }
  70. }
  71.  
  72. int
  73. main(int argc, char **argv)
  74. {
  75.   char *extension;
  76.   int rc;
  77.  
  78.   glutInit(&argc, argv);
  79.   glutCreateWindow("test20");
  80.  
  81.   extension = "GL_EXT_blend_color";
  82.   rc = glutExtensionSupported(extension);
  83.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  84.   if (rc) wrangleExtensionName(extension);
  85.  
  86.   extension = "GL_EXT_abgr";
  87.   rc = glutExtensionSupported(extension);
  88.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  89.   if (rc) wrangleExtensionName(extension);
  90.  
  91.   extension = "GL_EXT_blend_minmax";
  92.   rc = glutExtensionSupported(extension);
  93.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  94.   if (rc) wrangleExtensionName(extension);
  95.  
  96.   extension = "GL_EXT_blend_logic_op";
  97.   rc = glutExtensionSupported(extension);
  98.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  99.   if (rc) wrangleExtensionName(extension);
  100.  
  101.   extension = "GL_EXT_blend_subtract";
  102.   rc = glutExtensionSupported(extension);
  103.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  104.   if (rc) wrangleExtensionName(extension);
  105.  
  106.   extension = "GL_EXT_polygon_offset";
  107.   rc = glutExtensionSupported(extension);
  108.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  109.   if (rc) wrangleExtensionName(extension);
  110.  
  111.   extension = "GL_EXT_subtexture";
  112.   rc = glutExtensionSupported(extension);
  113.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  114.   if (rc) wrangleExtensionName(extension);
  115.  
  116.   extension = "GL_EXT_texture";
  117.   rc = glutExtensionSupported(extension);
  118.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  119.   if (rc) wrangleExtensionName(extension);
  120.  
  121.   extension = "GL_EXT_texture_object";
  122.   rc = glutExtensionSupported(extension);
  123.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  124.   if (rc) wrangleExtensionName(extension);
  125.  
  126.   extension = "GL_SGIX_framezoom";
  127.   rc = glutExtensionSupported(extension);
  128.   printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
  129.   if (rc) wrangleExtensionName(extension);
  130.  
  131.   rc = glutExtensionSupported("");
  132.   if (rc) {
  133.     printf("FAIL: test20, null string\n");
  134.     exit(1);
  135.   }
  136.  
  137.   printf("PASS: test20\n");
  138.   return 0;             /* ANSI C requires main to return int. */
  139. }
  140.