blob: 8cca200f21515fc834999844d29ad73e8beca71c [file] [log] [blame]
Brian Paul17fe22d2001-11-18 23:16:56 +00001/*
Brian Paul1cfae1a2002-11-07 16:23:40 +00002 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
Brian Paul17fe22d2001-11-18 23:16:56 +00003 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 */
21
22/*
23 * Test that glXGetProcAddress works.
24 */
25
Brian Pauld4ece7b2001-11-21 17:21:41 +000026#define GLX_GLXEXT_PROTOTYPES
27
Brian Paul17fe22d2001-11-18 23:16:56 +000028#include <X11/Xlib.h>
29#include <X11/Xutil.h>
30#include <GL/gl.h>
31#include <GL/glx.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
Brian Paul03f0ddb2003-09-03 17:21:51 +000035#include <math.h>
Brian Paul17fe22d2001-11-18 23:16:56 +000036
37
Brian Paul0699b0b2004-11-27 19:57:46 +000038typedef void (*generic_func)();
39
Brian Paul9a2121c2003-06-10 14:54:37 +000040#define EQUAL(X, Y) (fabs((X) - (Y)) < 0.001)
41
Brian Paul1ec9b5a2006-05-31 20:36:52 +000042/**
43 * The following functions are used to check that the named OpenGL function
44 * actually does what it's supposed to do.
45 * The naming of these functions is signficant. The getprocaddress.py script
46 * scans this file and extracts these function names.
47 */
48
49
Brian Pauld1efbf02002-11-08 15:35:46 +000050static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +000051test_ActiveTextureARB(generic_func func)
Brian Pauld1efbf02002-11-08 15:35:46 +000052{
53 PFNGLACTIVETEXTUREARBPROC activeTexture = (PFNGLACTIVETEXTUREARBPROC) func;
54 GLint t;
55 GLboolean pass;
56 (*activeTexture)(GL_TEXTURE1_ARB);
57 glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &t);
58 pass = (t == GL_TEXTURE1_ARB);
59 (*activeTexture)(GL_TEXTURE0_ARB); /* restore default */
60 return pass;
61}
Brian Paul17fe22d2001-11-18 23:16:56 +000062
Brian Pauld1efbf02002-11-08 15:35:46 +000063
64static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +000065test_SecondaryColor3fEXT(generic_func func)
Brian Pauld1efbf02002-11-08 15:35:46 +000066{
67 PFNGLSECONDARYCOLOR3FEXTPROC secColor3f = (PFNGLSECONDARYCOLOR3FEXTPROC) func;
68 GLfloat color[4];
69 GLboolean pass;
70 (*secColor3f)(1.0, 1.0, 0.0);
71 glGetFloatv(GL_CURRENT_SECONDARY_COLOR_EXT, color);
72 pass = (color[0] == 1.0 && color[1] == 1.0 && color[2] == 0.0);
73 (*secColor3f)(0.0, 0.0, 0.0); /* restore default */
74 return pass;
75}
76
77
78static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +000079test_ActiveStencilFaceEXT(generic_func func)
Brian Pauld1efbf02002-11-08 15:35:46 +000080{
81 PFNGLACTIVESTENCILFACEEXTPROC activeFace = (PFNGLACTIVESTENCILFACEEXTPROC) func;
82 GLint face;
83 GLboolean pass;
84 (*activeFace)(GL_BACK);
85 glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT, &face);
86 pass = (face == GL_BACK);
87 (*activeFace)(GL_FRONT); /* restore default */
88 return pass;
89}
90
91
Brian Paul9a2121c2003-06-10 14:54:37 +000092static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +000093test_VertexAttrib1fvARB(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +000094{
95 PFNGLVERTEXATTRIB1FVARBPROC vertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC) func;
96 PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
97
98 const GLfloat v[1] = {25.0};
99 const GLfloat def[1] = {0};
100 GLfloat res[4];
101 GLboolean pass;
102 (*vertexAttrib1fvARB)(6, v);
103 (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
104 pass = (res[0] == 25.0 && res[1] == 0.0 && res[2] == 0.0 && res[3] == 1.0);
105 (*vertexAttrib1fvARB)(6, def);
106 return pass;
107}
108
109static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000110test_VertexAttrib4NubvARB(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000111{
112 PFNGLVERTEXATTRIB4NUBVARBPROC vertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC) func;
113 PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
114
115 const GLubyte v[4] = {255, 0, 255, 0};
116 const GLubyte def[4] = {0, 0, 0, 255};
117 GLfloat res[4];
118 GLboolean pass;
119 (*vertexAttrib4NubvARB)(6, v);
120 (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
121 pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0);
122 (*vertexAttrib4NubvARB)(6, def);
123 return pass;
124}
125
126
127static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000128test_VertexAttrib4NuivARB(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000129{
130 PFNGLVERTEXATTRIB4NUIVARBPROC vertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC) func;
131 PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
132
133 const GLuint v[4] = {0xffffffff, 0, 0xffffffff, 0};
134 const GLuint def[4] = {0, 0, 0, 0xffffffff};
135 GLfloat res[4];
136 GLboolean pass;
137 (*vertexAttrib4NuivARB)(6, v);
138 (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
139 pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0));
140 (*vertexAttrib4NuivARB)(6, def);
141 return pass;
142}
143
144
145static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000146test_VertexAttrib4ivARB(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000147{
148 PFNGLVERTEXATTRIB4IVARBPROC vertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC) func;
149 PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
150
151 const GLint v[4] = {1, 2, -3, 4};
152 const GLint def[4] = {0, 0, 0, 1};
153 GLfloat res[4];
154 GLboolean pass;
155 (*vertexAttrib4ivARB)(6, v);
156 (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
157 pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 2.0) && EQUAL(res[2], -3.0) && EQUAL(res[3], 4.0));
158 (*vertexAttrib4ivARB)(6, def);
159 return pass;
160}
161
162
163static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000164test_VertexAttrib4NsvARB(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000165{
166 PFNGLVERTEXATTRIB4NSVARBPROC vertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC) func;
167 PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
168
169 const GLshort v[4] = {0, 32767, 32767, 0};
170 const GLshort def[4] = {0, 0, 0, 32767};
171 GLfloat res[4];
172 GLboolean pass;
173 (*vertexAttrib4NsvARB)(6, v);
174 (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
175 pass = (EQUAL(res[0], 0.0) && EQUAL(res[1], 1.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0));
176 (*vertexAttrib4NsvARB)(6, def);
177 return pass;
178}
179
180
181static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000182test_VertexAttrib4NusvARB(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000183{
184 PFNGLVERTEXATTRIB4NUSVARBPROC vertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC) func;
185 PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
186
187 const GLushort v[4] = {0xffff, 0, 0xffff, 0};
188 const GLushort def[4] = {0, 0, 0, 0xffff};
189 GLfloat res[4];
190 GLboolean pass;
191 (*vertexAttrib4NusvARB)(6, v);
192 (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
193 pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0));
194 (*vertexAttrib4NusvARB)(6, def);
195 return pass;
196}
197
198
199static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000200test_VertexAttrib4ubNV(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000201{
202 PFNGLVERTEXATTRIB4UBNVPROC vertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC) func;
203 PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
204
205 const GLubyte v[4] = {255, 0, 255, 0};
206 const GLubyte def[4] = {0, 0, 0, 255};
207 GLfloat res[4];
208 GLboolean pass;
209 (*vertexAttrib4ubNV)(6, v[0], v[1], v[2], v[3]);
210 (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
211 pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0);
212 (*vertexAttrib4ubNV)(6, def[0], def[1], def[2], def[3]);
213 return pass;
214}
215
216
217static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000218test_VertexAttrib2sNV(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000219{
220 PFNGLVERTEXATTRIB2SNVPROC vertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC) func;
221 PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
222
223 const GLshort v[2] = {2, -4,};
224 const GLshort def[2] = {0, 0};
225 GLfloat res[4];
226 GLboolean pass;
227 (*vertexAttrib2sNV)(6, v[0], v[1]);
228 (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
229 pass = (EQUAL(res[0], 2) && EQUAL(res[1], -4) && EQUAL(res[2], 0) && res[3] == 1.0);
230 (*vertexAttrib2sNV)(6, def[0], def[1]);
231 return pass;
232}
233
234
235static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000236test_VertexAttrib3fNV(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000237{
238 PFNGLVERTEXATTRIB3FNVPROC vertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC) func;
239 PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
240
241 const GLfloat v[3] = {0.2, 0.4, 0.8};
242 const GLfloat def[3] = {0, 0, 0};
243 GLfloat res[4];
244 GLboolean pass;
245 (*vertexAttrib3fNV)(6, v[0], v[1], v[2]);
246 (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
247 pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && res[3] == 1.0);
248 (*vertexAttrib3fNV)(6, def[0], def[1], def[2]);
249 return pass;
250}
251
252
253static GLboolean
Brian Paul0699b0b2004-11-27 19:57:46 +0000254test_VertexAttrib4dvNV(generic_func func)
Brian Paul9a2121c2003-06-10 14:54:37 +0000255{
256 PFNGLVERTEXATTRIB4DVNVPROC vertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC) func;
257 PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
258
259 const GLdouble v[4] = {0.2, 0.4, 0.8, 1.2};
260 const GLdouble def[4] = {0, 0, 0, 1};
261 GLfloat res[4];
262 GLboolean pass;
263 (*vertexAttrib4dvNV)(6, v);
264 (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
265 pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && EQUAL(res[3], 1.2));
266 (*vertexAttrib4dvNV)(6, def);
267 return pass;
268}
Brian Pauld1efbf02002-11-08 15:35:46 +0000269
270
271/*
Brian Paul1ec9b5a2006-05-31 20:36:52 +0000272 * The following file is auto-generated with Python.
Brian Pauld1efbf02002-11-08 15:35:46 +0000273 */
274#include "getproclist.h"
275
Brian Paul17fe22d2001-11-18 23:16:56 +0000276
277
Brian Paul17fe22d2001-11-18 23:16:56 +0000278static int
279extension_supported(const char *haystack, const char *needle)
280{
Brian Paul1ec9b5a2006-05-31 20:36:52 +0000281 const char *p = strstr(haystack, needle);
282 if (p) {
283 /* found string, make sure next char is space or zero */
284 const int len = strlen(needle);
285 if (p[len] == ' ' || p[len] == 0)
286 return 1;
287 else
288 return 0;
289 }
Brian Paul17fe22d2001-11-18 23:16:56 +0000290 else
291 return 0;
292}
293
294
295static void
Brian Pauld1efbf02002-11-08 15:35:46 +0000296check_functions( const char *extensions )
Brian Paul17fe22d2001-11-18 23:16:56 +0000297{
Brian Pauld1efbf02002-11-08 15:35:46 +0000298 struct name_test_pair *entry;
Brian Paul17fe22d2001-11-18 23:16:56 +0000299 int failures = 0, passes = 0;
Brian Pauld1efbf02002-11-08 15:35:46 +0000300 int totalFail = 0, totalPass = 0;
Brian Paul17fe22d2001-11-18 23:16:56 +0000301 int doTests;
Brian Paul17fe22d2001-11-18 23:16:56 +0000302
Brian Pauld1efbf02002-11-08 15:35:46 +0000303 for (entry = functions; entry->name; entry++) {
304 if (entry->name[0] == '-') {
Brian Paule4b23562005-05-04 20:11:35 +0000305 /* XXX update for OpenGL 2.0 */
Brian Pauld1efbf02002-11-08 15:35:46 +0000306 if (entry->name[1] == '1') {
Brian Paul35695992003-07-10 14:39:57 +0000307 /* check GL version X.Y */
308 const char *version = (const char *) glGetString(GL_VERSION);
309 if (version[0] == entry->name[1] &&
310 version[1] == entry->name[2] &&
311 version[2] >= entry->name[3])
312 doTests = 1;
313 else
314 doTests = 0;
Brian Paul17fe22d2001-11-18 23:16:56 +0000315 }
316 else {
317 /* check if the named extension is available */
Brian Pauld1efbf02002-11-08 15:35:46 +0000318 doTests = extension_supported(extensions, entry->name+1);
Brian Paul17fe22d2001-11-18 23:16:56 +0000319 }
320 if (doTests)
Brian Pauld1efbf02002-11-08 15:35:46 +0000321 printf("Testing %s functions\n", entry->name + 1);
322 totalFail += failures;
323 totalPass += passes;
Brian Paul17fe22d2001-11-18 23:16:56 +0000324 failures = 0;
325 passes = 0;
326 }
327 else if (doTests) {
Brian Paul0699b0b2004-11-27 19:57:46 +0000328 generic_func funcPtr = (generic_func) glXGetProcAddressARB((const GLubyte *) entry->name);
Brian Pauld1efbf02002-11-08 15:35:46 +0000329 if (funcPtr) {
330 if (entry->test) {
331 GLboolean b;
332 printf(" Validating %s:", entry->name);
333 b = (*entry->test)(funcPtr);
334 if (b) {
335 printf(" Pass\n");
336 passes++;
337 }
338 else {
339 printf(" FAIL!!!\n");
340 failures++;
341 }
342 }
343 else {
344 passes++;
345 }
Brian Paul17fe22d2001-11-18 23:16:56 +0000346 }
347 else {
Brian Pauld1efbf02002-11-08 15:35:46 +0000348 printf(" glXGetProcAddress(%s) failed!\n", entry->name);
Brian Paul17fe22d2001-11-18 23:16:56 +0000349 failures++;
350 }
351 }
352
Brian Pauld1efbf02002-11-08 15:35:46 +0000353 if (doTests && (!(entry+1)->name || (entry+1)->name[0] == '-')) {
Brian Paul17fe22d2001-11-18 23:16:56 +0000354 if (failures > 0) {
Brian Pauld1efbf02002-11-08 15:35:46 +0000355 printf(" %d failed.\n", failures);
Brian Paul17fe22d2001-11-18 23:16:56 +0000356 }
Brian Pauld1efbf02002-11-08 15:35:46 +0000357 if (passes > 0) {
Brian Paul17fe22d2001-11-18 23:16:56 +0000358 printf(" %d passed.\n", passes);
359 }
360 }
361 }
Brian Pauld1efbf02002-11-08 15:35:46 +0000362 totalFail += failures;
363 totalPass += passes;
364
365 printf("-----------------------------\n");
366 printf("Total: %d pass %d fail\n", totalPass, totalFail);
Brian Paul17fe22d2001-11-18 23:16:56 +0000367}
368
369
370
371static void
372print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
373{
374 Window win;
375 int attribSingle[] = {
376 GLX_RGBA,
377 GLX_RED_SIZE, 1,
378 GLX_GREEN_SIZE, 1,
379 GLX_BLUE_SIZE, 1,
380 None };
381 int attribDouble[] = {
382 GLX_RGBA,
383 GLX_RED_SIZE, 1,
384 GLX_GREEN_SIZE, 1,
385 GLX_BLUE_SIZE, 1,
386 GLX_DOUBLEBUFFER,
387 None };
388
389 XSetWindowAttributes attr;
390 unsigned long mask;
391 Window root;
392 GLXContext ctx;
393 XVisualInfo *visinfo;
394 int width = 100, height = 100;
395
396 root = RootWindow(dpy, scrnum);
397
398 visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
399 if (!visinfo) {
400 visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
401 if (!visinfo) {
402 fprintf(stderr, "Error: couldn't find RGB GLX visual\n");
403 return;
404 }
405 }
406
407 attr.background_pixel = 0;
408 attr.border_pixel = 0;
409 attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
410 attr.event_mask = StructureNotifyMask | ExposureMask;
411 mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
412 win = XCreateWindow(dpy, root, 0, 0, width, height,
413 0, visinfo->depth, InputOutput,
414 visinfo->visual, mask, &attr);
415
416 ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect );
417 if (!ctx) {
418 fprintf(stderr, "Error: glXCreateContext failed\n");
419 XDestroyWindow(dpy, win);
420 return;
421 }
422
423 if (glXMakeCurrent(dpy, win, ctx)) {
Brian Pauld1efbf02002-11-08 15:35:46 +0000424 check_functions( (const char *) glGetString(GL_EXTENSIONS) );
Brian Paul17fe22d2001-11-18 23:16:56 +0000425 }
426 else {
427 fprintf(stderr, "Error: glXMakeCurrent failed\n");
428 }
429
430 glXDestroyContext(dpy, ctx);
431 XDestroyWindow(dpy, win);
432}
433
434
435int
436main(int argc, char *argv[])
437{
438 char *displayName = NULL;
439 Display *dpy;
440
441 dpy = XOpenDisplay(displayName);
442 if (!dpy) {
443 fprintf(stderr, "Error: unable to open display %s\n", displayName);
444 return -1;
445 }
446
447 print_screen_info(dpy, 0, GL_TRUE);
448
449 XCloseDisplay(dpy);
450
451 return 0;
452}