test20.c
上传用户:xk288cn
上传日期:2007-05-28
资源大小:4876k
文件大小:4k
- /* Copyright (c) Mark J. Kilgard, 1996, 1997. */
- /* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
- /* Test glutExtensionSupported. */
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <GL/glut.h>
- void
- wrangleExtensionName(char *extension)
- {
- char buffer[512];
- int rc, len;
- sprintf(buffer, " %s", extension);
- rc = glutExtensionSupported(buffer);
- if (rc) {
- printf("FAIL: test20, space prefixn");
- exit(1);
- }
- sprintf(buffer, "%s ", extension);
- rc = glutExtensionSupported(buffer);
- if (rc) {
- printf("FAIL: test20, space suffixn");
- exit(1);
- }
- sprintf(buffer, "GL_%s", extension);
- rc = glutExtensionSupported(buffer);
- if (rc) {
- printf("FAIL: test20, GL_ prefixn");
- exit(1);
- }
- sprintf(buffer, "%s", extension + 1);
- rc = glutExtensionSupported(buffer);
- if (rc) {
- printf("FAIL: test20, missing first charactern");
- exit(1);
- }
- sprintf(buffer, "%s", extension);
- len = (int) strlen(buffer);
- if(len > 0) {
- buffer[len-1] = ' ';
- }
- rc = glutExtensionSupported(buffer);
- if (rc) {
- printf("FAIL: test20, mising last charactern");
- exit(1);
- }
- sprintf(buffer, "%s", extension);
- len = (int) strlen(buffer);
- if(len > 0) {
- buffer[len-1] = 'X';
- }
- rc = glutExtensionSupported(buffer);
- if (rc) {
- printf("FAIL: test20, changed last charactern");
- exit(1);
- }
- }
- int
- main(int argc, char **argv)
- {
- char *extension;
- int rc;
- glutInit(&argc, argv);
- glutCreateWindow("test20");
- extension = "GL_EXT_blend_color";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_abgr";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_blend_minmax";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_blend_logic_op";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_blend_subtract";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_polygon_offset";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_subtexture";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_texture";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_EXT_texture_object";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- extension = "GL_SGIX_framezoom";
- rc = glutExtensionSupported(extension);
- printf("Extension %s is %s by your OpenGL.n", extension, rc ? "SUPPORTED" : "NOT supported");
- if (rc) wrangleExtensionName(extension);
- rc = glutExtensionSupported("");
- if (rc) {
- printf("FAIL: test20, null stringn");
- exit(1);
- }
- printf("PASS: test20n");
- return 0; /* ANSI C requires main to return int. */
- }