3
#endif /* GLEW_USE_LIB_ES */
5
5
/* ------------------------------------------------------------------------ */
7
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
7
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX) || defined(GLEW_USE_LIB_ES)
8
8
int main (int argc, char** argv)
15
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
15
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX) || defined(GLEW_USE_LIB_ES)
16
16
char* display = NULL;
19
19
if (glewParseArgs(argc-1, argv+1, &display, &visual))
21
# if defined(GLEW_USE_LIB_ES)
22
fprintf(stderr, "Usage: glewinfo [-display <display>] \n");
23
# elif defined(_WIN32)
22
24
fprintf(stderr, "Usage: glewinfo [-pf <id>]\n");
24
26
fprintf(stderr, "Usage: glewinfo [-display <display>] [-visual <id>]\n");
42
46
glewExperimental = GL_TRUE;
44
48
err = glewContextInit(glewGetContext());
49
# if defined(GLEW_USE_LIB_ES)
50
#if defined GLEW_INC_EGL
51
err = eglewContextInit(eglewGetContext());
46
54
err = err || wglewContextInit(wglewGetContext());
47
55
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
48
56
err = err || glxewContextInit(glxewGetContext());
67
75
fprintf(f, " GLEW Extension Info\n");
68
76
fprintf(f, "---------------------------\n\n");
69
77
fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION));
78
# if defined(GLEW_USE_LIB_ES)
79
fprintf(f, "Reporting capabilities of display %s , \n",
80
display == NULL ? getenv("DISPLAY") : (char *)display);
71
82
fprintf(f, "Reporting capabilities of pixelformat %d\n", visual);
72
83
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
73
84
fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n",
77
88
glGetString(GL_RENDERER), glGetString(GL_VENDOR));
78
89
fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION));
91
# if defined(GLEW_USE_LIB_ES)
92
#if defined (GLEW_INC_EGL)
90
105
/* ------------------------------------------------------------------------ */
92
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
107
#if defined(_WIN32) || !defined(__APPLE__) || defined(GLEW_APPLE_GLX) || defined(GLEW_USE_LIB_ES)
93
108
GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual)
113
#if defined(GLEW_USE_LIB_ES)
114
if (!strcmp(argv[p], "-display"))
116
if (++p >= argc) return GL_TRUE;
117
*display = argv[p++];
122
#elif defined(_WIN32)
99
123
if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat"))
101
125
if (++p >= argc) return GL_TRUE;
126
150
/* ------------------------------------------------------------------------ */
152
#if defined(GLEW_USE_LIB_ES)
154
EGLDisplay eDpy = NULL;
155
EGLSurface eSurf = NULL;
156
EGLContext eCtx = NULL;
162
GLboolean glewCreateContext (const char* display)
166
# if defined(GLEW_USE_LIB_ES20)
167
EGLint attribs[] = {EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
168
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,EGL_NONE};
169
EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
171
EGLint attribs[] = {EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_NONE};
172
EGLint contextAttribs[] = {EGL_NONE};
176
dpy = XOpenDisplay(display);
177
wnd = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1,
180
eDpy = eglGetDisplay((NativeDisplayType)dpy);
181
if(eDpy == NULL) return GL_TRUE;
182
if(!eglInitialize(eDpy, NULL, NULL)) return GL_TRUE;
183
if(!eglChooseConfig(eDpy, attribs, cfg, 1, &noCfg)) return GL_TRUE;
184
eCtx = eglCreateContext(eDpy, cfg[0], EGL_NO_CONTEXT, contextAttribs);
185
if(eCtx == NULL) return GL_TRUE;
186
eSurf = eglCreateWindowSurface(eDpy, cfg[0], (EGLNativeWindowType)wnd, NULL);
187
if(eSurf == NULL) return GL_TRUE;
188
if(!eglMakeCurrent(eDpy, eSurf, eSurf, eCtx)) return GL_TRUE;
192
void glewDestroyContext ()
194
eglMakeCurrent(eDpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
195
if (!eDpy && !eSurf) eglDestroySurface(eDpy, eSurf);
196
if (!eDpy && !eCtx) eglDestroyContext(eDpy, eCtx);
197
if (!eDpy) eglTerminate(eDpy);
199
if(NULL != dpy && 0 != wnd) XDestroyWindow(dpy, wnd);
200
if(NULL != dpy) XCloseDisplay(dpy);
204
#elif defined(_WIN32)