int main (void) #endif { GLuint err; #if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX) char* display = NULL; int visual = -1; if (glewParseArgs(argc-1, argv+1, &display, &visual)) { #if defined(_WIN32) fprintf(stderr, "Usage: glewinfo [-pf <id>]\n"); #else fprintf(stderr, "Usage: glewinfo [-display <display>] [-visual <id>]\n"); #endif return 1; } #endif #if defined(_WIN32) if (GL_TRUE == glewCreateContext(&visual)) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) if (GL_TRUE == glewCreateContext()) #else if (GL_TRUE == glewCreateContext(display, &visual)) #endif { fprintf(stderr, "Error: glewCreateContext failed\n"); glewDestroyContext(); return 1; } glewExperimental = GL_TRUE; #ifdef GLEW_MX err = glewContextInit(glewGetContext()); #ifdef _WIN32 err = err || wglewContextInit(wglewGetContext()); #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) err = err || glxewContextInit(glxewGetContext()); #endif #else err = glewInit(); #endif if (GLEW_OK != err) { fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); glewDestroyContext(); return 1; } #if defined(_WIN32) f = fopen("glewinfo.txt", "w"); if (f == NULL) f = stdout; #else f = stdout; #endif fprintf(f, "---------------------------\n"); fprintf(f, " GLEW Extension Info\n"); fprintf(f, "---------------------------\n\n"); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); #if defined(_WIN32) fprintf(f, "Reporting capabilities of pixelformat %d\n", visual); #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", display == NULL ? getenv("DISPLAY") : display, visual); #endif fprintf(f, "Running on a %s from %s\n", glGetString(GL_RENDERER), glGetString(GL_VENDOR)); fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION)); glewInfo(); #if defined(_WIN32) wglewInfo(); #else glxewInfo(); #endif if (f != stdout) fclose(f); glewDestroyContext(); return 0; }
int main (int argc, char** argv) { GLuint err; struct createParams params = { #if defined(__OSMESA__) -1, /* bit depth */ #elif defined(_WIN32) -1, /* pixelformat */ #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) "", /* display */ -1, /* visual */ #endif 0, /* major */ 0, /* minor */ 0, /* profile mask */ 0 /* flags */ }; if (glewParseArgs(argc-1, argv+1, ¶ms)) { fprintf(stderr, "Usage: glewinfo " #if defined(__OSMESA__) #elif defined(_WIN32) "[-pf <pixelformat>] " #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) "[-display <display>] " "[-visual <visual id>] " #endif "[-version <OpenGL version>] " "[-profile core|compatibility] " "[-flag debug|forward]" "\n"); return 1; } if (GL_TRUE == glewCreateContext(¶ms)) { fprintf(stderr, "Error: glewCreateContext failed\n"); glewDestroyContext(); return 1; } glewExperimental = GL_TRUE; #ifdef GLEW_MX err = glewContextInit(glewGetContext()); #if defined(__OSMESA__) err = err || osmewContextInit(osmewGetContext()); #elif defined(_WIN32) err = err || wglewContextInit(wglewGetContext()); #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) err = err || glxewContextInit(glxewGetContext()); #endif #else err = glewInit(); #endif if (GLEW_OK != err) { fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); glewDestroyContext(); return 1; } #if defined(_WIN32) #if defined(_MSC_VER) && (_MSC_VER >= 1400) if (fopen_s(&f, "glewinfo.txt", "w") != 0) f = stdout; #else f = fopen("glewinfo.txt", "w"); #endif /* _MSC_VER */ if (f == NULL) f = stdout; #else f = stdout; #endif /* _WIN32 */ fprintf(f, "---------------------------\n"); fprintf(f, " GLEW Extension Info\n"); fprintf(f, "---------------------------\n\n"); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); #if defined(__OSMESA__) fprintf(f, "Reporting capabilitiees of OSMesa\n"); #elif defined(_WIN32) fprintf(f, "Reporting capabilities of pixelformat %d\n", params.pixelformat); #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", params.display == NULL ? getenv("DISPLAY") : params.display, params.visual); #endif /* __OSMESA__ */ fprintf(f, "Running on a %s from %s\n", glGetString(GL_RENDERER), glGetString(GL_VENDOR)); fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION)); glewInfo(); #if defined(__OSMESA__) osmewInfo(); #elif defined(_WIN32) wglewInfo(); #else glxewInfo(); #endif /* __OSMESA__ */ if (f != stdout) fclose(f); glewDestroyContext(); return 0; }
int main (int argc, char** argv) { GLuint err; struct createParams params = { #if defined(GLEW_OSMESA) #elif defined(GLEW_EGL) #elif defined(_WIN32) -1, /* pixelformat */ #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) "", /* display */ -1, /* visual */ #endif 0, /* major */ 0, /* minor */ 0, /* profile mask */ 0 /* flags */ }; #if defined(GLEW_EGL) typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGPROC) (GLenum name); PFNGLGETSTRINGPROC getString; #endif if (glewParseArgs(argc-1, argv+1, ¶ms)) { fprintf(stderr, "Usage: glewinfo " #if defined(GLEW_OSMESA) #elif defined(GLEW_EGL) #elif defined(_WIN32) "[-pf <pixelformat>] " #elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) "[-display <display>] " "[-visual <visual id>] " #endif "[-version <OpenGL version>] " "[-profile core|compatibility] " "[-flag debug|forward]" "\n"); return 1; } if (GL_TRUE == glewCreateContext(¶ms)) { fprintf(stderr, "Error: glewCreateContext failed\n"); glewDestroyContext(); return 1; } glewExperimental = GL_TRUE; err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); glewDestroyContext(); return 1; } #if defined(GLEW_EGL) getString = (PFNGLGETSTRINGPROC) eglGetProcAddress("glGetString"); if (!getString) { fprintf(stderr, "Error: eglGetProcAddress failed to fetch glGetString\n"); glewDestroyContext(); return 1; } #endif #if defined(_WIN32) #if defined(_MSC_VER) && (_MSC_VER >= 1400) if (fopen_s(&f, "glewinfo.txt", "w") != 0) f = stdout; #else f = fopen("glewinfo.txt", "w"); #endif if (f == NULL) f = stdout; #else f = stdout; #endif fprintf(f, "---------------------------\n"); fprintf(f, " GLEW Extension Info\n"); fprintf(f, "---------------------------\n\n"); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); #if defined(GLEW_OSMESA) #elif defined(GLEW_EGL) #elif defined(_WIN32) fprintf(f, "Reporting capabilities of pixelformat %d\n", params.pixelformat); #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", params.display == NULL ? getenv("DISPLAY") : params.display, params.visual); #endif #if defined(GLEW_EGL) fprintf(f, "Running on a %s from %s\n", getString(GL_RENDERER), getString(GL_VENDOR)); fprintf(f, "OpenGL version %s is supported\n", getString(GL_VERSION)); #else fprintf(f, "Running on a %s from %s\n", glGetString(GL_RENDERER), glGetString(GL_VENDOR)); fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION)); #endif glewInfo(); #if defined(GLEW_OSMESA) #elif defined(GLEW_EGL) eglewInfo(); #elif defined(_WIN32) wglewInfo(); #else glxewInfo(); #endif if (f != stdout) fclose(f); glewDestroyContext(); return 0; }