diff options
Diffstat (limited to 'progs')
24 files changed, 451 insertions, 26 deletions
diff --git a/progs/demos/.cvsignore b/progs/demos/.gitignore index f764b3d117e..f764b3d117e 100644 --- a/progs/demos/.cvsignore +++ b/progs/demos/.gitignore diff --git a/progs/demos/Makefile b/progs/demos/Makefile index feb2abd6cfc..4623d6c8d91 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -25,6 +25,7 @@ PROGS = \ fire \ fogcoord \ fplight \ + fslight \ gamma \ gearbox \ gears \ diff --git a/progs/demos/fslight.c b/progs/demos/fslight.c new file mode 100644 index 00000000000..1c016cc75e9 --- /dev/null +++ b/progs/demos/fslight.c @@ -0,0 +1,334 @@ +/** + * Test OpenGL 2.0 vertex/fragment shaders. + * Brian Paul + * 1 November 2006 + * + * Based on ARB version by: + * Michal Krol + * 20 February 2006 + * + * Based on the original demo by: + * Brian Paul + * 17 April 2003 + */ + +#include <assert.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <GL/gl.h> +#include <GL/glut.h> +#include <GL/glext.h> + +static GLfloat diffuse[4] = { 0.5f, 0.5f, 1.0f, 1.0f }; +static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f }; +static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 1.0f }; +static GLfloat delta = 1.0f; + +static GLuint fragShader; +static GLuint vertShader; +static GLuint program; + +static GLint uLightPos; +static GLint uDiffuse; +static GLint uSpecular; + +static GLint win = 0; +static GLboolean anim = GL_TRUE; +static GLboolean wire = GL_FALSE; +static GLboolean pixelLight = GL_TRUE; + +static GLint t0 = 0; +static GLint frames = 0; + +static GLfloat xRot = 0.0f, yRot = 0.0f; + +static PFNGLCREATESHADERPROC glCreateShader_func = NULL; +static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL; +static PFNGLGETSHADERSOURCEPROC glGetShaderSource_func = NULL; +static PFNGLCOMPILESHADERPROC glCompileShader_func = NULL; +static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL; +static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL; +static PFNGLDELETESHADERPROC glDeleteShader_func = NULL; +static PFNGLATTACHSHADERPROC glAttachShader_func = NULL; +static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL; +static PFNGLUSEPROGRAMPROC glUseProgram_func = NULL; +static PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation_func = NULL; +static PFNGLISPROGRAMPROC glIsProgram_func = NULL; +static PFNGLISSHADERPROC glIsShader_func = NULL; +static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL; +static PFNGLUNIFORM3FVPROC glUniform4fv_func = NULL; + + + +static void +normalize(GLfloat *dst, const GLfloat *src) +{ + GLfloat len = sqrtf(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]); + dst[0] = src[0] / len; + dst[1] = src[1] / len; + dst[2] = src[2] / len; +} + + +static void +Redisplay(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + if (pixelLight) { + GLfloat vec[3]; + glUseProgram_func(program); + normalize(vec, lightPos); + glUniform3fv_func(uLightPos, 1, vec); + glDisable(GL_LIGHTING); + } + else { + glUseProgram_func(0); + glLightfv(GL_LIGHT0, GL_POSITION, lightPos); + glEnable(GL_LIGHTING); + } + + glPushMatrix(); + glRotatef(xRot, 1.0f, 0.0f, 0.0f); + glRotatef(yRot, 0.0f, 1.0f, 0.0f); + glutSolidSphere(2.0, 10, 5); + glPopMatrix(); + + glutSwapBuffers(); + frames++; + + if (anim) { + GLint t = glutGet(GLUT_ELAPSED_TIME); + if (t - t0 >= 5000) { + GLfloat seconds =(GLfloat)(t - t0) / 1000.0f; + GLfloat fps = frames / seconds; + printf("%d frames in %6.3f seconds = %6.3f FPS\n", + frames, seconds, fps); + t0 = t; + frames = 0; + } + } +} + + +static void +Idle(void) +{ + lightPos[0] += delta; + if (lightPos[0] > 25.0f || lightPos[0] < -25.0f) + delta = -delta; + glutPostRedisplay(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -15.0f); +} + + +static void +CleanUp(void) +{ + glDeleteShader_func(fragShader); + glDeleteShader_func(vertShader); + glDeleteProgram_func(program); + glutDestroyWindow(win); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + + switch(key) { + case ' ': + case 'a': + anim = !anim; + if (anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'x': + lightPos[0] -= 1.0f; + break; + case 'X': + lightPos[0] += 1.0f; + break; + case 'w': + wire = !wire; + if (wire) + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + else + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + break; + case 'p': + pixelLight = !pixelLight; + if (pixelLight) + printf("Per-pixel lighting\n"); + else + printf("Conventional lighting\n"); + break; + case 27: + CleanUp(); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + const GLfloat step = 3.0f; + + (void) x; + (void) y; + + switch(key) { + case GLUT_KEY_UP: + xRot -= step; + break; + case GLUT_KEY_DOWN: + xRot += step; + break; + case GLUT_KEY_LEFT: + yRot -= step; + break; + case GLUT_KEY_RIGHT: + yRot += step; + break; + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + static const char *fragShaderText = + "uniform vec3 lightPos;\n" + "uniform vec4 diffuse;\n" + "uniform vec4 specular;\n" + "varying vec3 normal;\n" + "void main() {\n" + " // Compute dot product of light direction and normal vector\n" + " float dotProd = max(dot(lightPos, normalize(normal)), 0.0);\n" + " // Compute diffuse and specular contributions\n" + " gl_FragColor = diffuse * dotProd + specular * pow(dotProd, 20.0);\n" + "}\n"; + static const char *vertShaderText = + "varying vec3 normal;\n" + "void main() {\n" + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + " normal = gl_NormalMatrix * gl_Normal;\n" + "}\n"; + + + const char *version; + + version = (const char *) glGetString(GL_VERSION); + if (version[0] != '2' || version[1] != '.') { + printf("Warning: this program expects OpenGL 2.0\n"); + /*exit(1);*/ + } + + + glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader"); + glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader"); + glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram"); + glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource"); + glGetShaderSource_func = (PFNGLGETSHADERSOURCEPROC) glutGetProcAddress("glGetShaderSource"); + glCompileShader_func = (PFNGLCOMPILESHADERPROC) glutGetProcAddress("glCompileShader"); + glCreateProgram_func = (PFNGLCREATEPROGRAMPROC) glutGetProcAddress("glCreateProgram"); + glAttachShader_func = (PFNGLATTACHSHADERPROC) glutGetProcAddress("glAttachShader"); + glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram"); + glUseProgram_func = (PFNGLUSEPROGRAMPROC) glutGetProcAddress("glUseProgram"); + glGetUniformLocation_func = (PFNGLGETUNIFORMLOCATIONPROC) glutGetProcAddress("glGetUniformLocation"); + glIsProgram_func = (PFNGLISPROGRAMPROC) glutGetProcAddress("glIsProgram"); + glIsShader_func = (PFNGLISSHADERPROC) glutGetProcAddress("glIsShader"); + glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv"); + glUniform4fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform4fv"); + + fragShader = glCreateShader_func(GL_FRAGMENT_SHADER); + glShaderSource_func(fragShader, 1, &fragShaderText, NULL); + glCompileShader_func(fragShader); + + vertShader = glCreateShader_func(GL_VERTEX_SHADER); + glShaderSource_func(vertShader, 1, &vertShaderText, NULL); + glCompileShader_func(vertShader); + + program = glCreateProgram_func(); + glAttachShader_func(program, fragShader); + glAttachShader_func(program, vertShader); + glLinkProgram_func(program); + glUseProgram_func(program); + + uLightPos = glGetUniformLocation_func(program, "lightPos"); + uDiffuse = glGetUniformLocation_func(program, "diffuse"); + uSpecular = glGetUniformLocation_func(program, "specular"); + + glUniform4fv_func(uDiffuse, 1, diffuse); + glUniform4fv_func(uSpecular, 1, specular); + + glClearColor(0.3f, 0.3f, 0.3f, 0.0f); + glEnable(GL_DEPTH_TEST); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0f); + + printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); + printf("Press p to toggle between per-pixel and per-vertex lighting\n"); + + /* test glGetShaderSource() */ + { + GLsizei len = strlen(fragShaderText) + 1; + GLsizei lenOut; + GLchar *src =(GLchar *) malloc(len * sizeof(GLchar)); + glGetShaderSource_func(fragShader, 0, NULL, src); + glGetShaderSource_func(fragShader, len, &lenOut, src); + assert(len == lenOut + 1); + assert(strcmp(src, fragShaderText) == 0); + free(src); + } + + assert(glIsProgram_func(program)); + assert(glIsShader_func(fragShader)); + assert(glIsShader_func(vertShader)); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition( 0, 0); + glutInitWindowSize(200, 200); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Redisplay); + if (anim) + glutIdleFunc(Idle); + Init(); + glutMainLoop(); + return 0; +} + diff --git a/progs/directfb/df_gears.c b/progs/directfb/df_gears.c index 27df900115f..c480767bd33 100644 --- a/progs/directfb/df_gears.c +++ b/progs/directfb/df_gears.c @@ -27,9 +27,9 @@ #include <math.h> #include <directfb.h> +#include <directfbgl.h> #include <GL/gl.h> -#include <GL/directfbgl.h> /* the super interface */ diff --git a/progs/directfb/df_morph3d.c b/progs/directfb/df_morph3d.c index f7f143447f4..2730fa61569 100644 --- a/progs/directfb/df_morph3d.c +++ b/progs/directfb/df_morph3d.c @@ -159,9 +159,9 @@ So the angle is: #include <unistd.h> #include <directfb.h> +#include <directfbgl.h> #include <GL/gl.h> -#include <GL/directfbgl.h> /* the super interface */ diff --git a/progs/directfb/df_reflect.c b/progs/directfb/df_reflect.c index ce4d12f749f..a0e789c3871 100644 --- a/progs/directfb/df_reflect.c +++ b/progs/directfb/df_reflect.c @@ -27,9 +27,9 @@ #include <math.h> #include <directfb.h> +#include <directfbgl.h> #include <GL/glu.h> -#include <GL/directfbgl.h> #include "util/showbuffer.c" #include "util/readtex.c" diff --git a/progs/redbook/.cvsignore b/progs/redbook/.gitignore index 8ed3efe3e23..8ed3efe3e23 100644 --- a/progs/redbook/.cvsignore +++ b/progs/redbook/.gitignore diff --git a/progs/samples/.cvsignore b/progs/samples/.gitignore index 12b0650567b..12b0650567b 100644 --- a/progs/samples/.cvsignore +++ b/progs/samples/.gitignore diff --git a/progs/tests/.cvsignore b/progs/tests/.gitignore index 2c0e16c35ec..2c0e16c35ec 100644 --- a/progs/tests/.cvsignore +++ b/progs/tests/.gitignore diff --git a/progs/tests/cva.c b/progs/tests/cva.c index 3f7960f53b6..c7677990bff 100644 --- a/progs/tests/cva.c +++ b/progs/tests/cva.c @@ -1,4 +1,4 @@ -/* $Id: cva.c,v 1.7 2003/12/08 09:03:35 joukj Exp $ */ +/* $Id: cva.c,v 1.8 2006/11/22 19:37:21 sroland Exp $ */ /* * Trivial CVA test, good for testing driver fastpaths (especially @@ -119,6 +119,7 @@ int main( int argc, char **argv ) { GLenum type; char *string; + double version; glutInit( &argc, argv ); @@ -138,9 +139,8 @@ int main( int argc, char **argv ) */ string = (char *) glGetString( GL_VERSION ); - if ( !strstr(string, "1.2") && - !strstr(string, "1.3") && - !strstr(string, "1.4")) { + version = atof(string); + if ( version < 1.2 ) { fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" ); exit( -1 ); } diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c index 8cca200f215..8b000d234a3 100644 --- a/progs/tests/getprocaddress.c +++ b/progs/tests/getprocaddress.c @@ -268,6 +268,75 @@ test_VertexAttrib4dvNV(generic_func func) } +static GLboolean +test_StencilFuncSeparate(generic_func func) +{ +#ifdef GL_VERSION_2_0 + PFNGLSTENCILFUNCSEPARATEPROC stencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) func; + GLint frontFunc, backFunc; + GLint frontRef, backRef; + GLint frontMask, backMask; + (*stencilFuncSeparate)(GL_BACK, GL_GREATER, 2, 0xa); + glGetIntegerv(GL_STENCIL_FUNC, &frontFunc); + glGetIntegerv(GL_STENCIL_BACK_FUNC, &backFunc); + glGetIntegerv(GL_STENCIL_REF, &frontRef); + glGetIntegerv(GL_STENCIL_BACK_REF, &backRef); + glGetIntegerv(GL_STENCIL_VALUE_MASK, &frontMask); + glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, &backMask); + if (frontFunc != GL_ALWAYS || + backFunc != GL_GREATER || + frontRef != 0 || + backRef != 2 || + frontMask == 0xa || /* might be 0xff or ~0 */ + backMask != 0xa) + return GL_FALSE; +#endif + return GL_TRUE; +} + +static GLboolean +test_StencilOpSeparate(generic_func func) +{ +#ifdef GL_VERSION_2_0 + PFNGLSTENCILOPSEPARATEPROC stencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) func; + GLint frontFail, backFail; + GLint frontZFail, backZFail; + GLint frontZPass, backZPass; + (*stencilOpSeparate)(GL_BACK, GL_INCR, GL_DECR, GL_INVERT); + glGetIntegerv(GL_STENCIL_FAIL, &frontFail); + glGetIntegerv(GL_STENCIL_BACK_FAIL, &backFail); + glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &frontZFail); + glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_FAIL, &backZFail); + glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &frontZPass); + glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_PASS, &backZPass); + if (frontFail != GL_KEEP || + backFail != GL_INCR || + frontZFail != GL_KEEP || + backZFail != GL_DECR || + frontZPass != GL_KEEP || + backZPass != GL_INVERT) + return GL_FALSE; +#endif + return GL_TRUE; +} + +static GLboolean +test_StencilMaskSeparate(generic_func func) +{ +#ifdef GL_VERSION_2_0 + PFNGLSTENCILMASKSEPARATEPROC stencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) func; + GLint frontMask, backMask; + (*stencilMaskSeparate)(GL_BACK, 0x1b); + glGetIntegerv(GL_STENCIL_WRITEMASK, &frontMask); + glGetIntegerv(GL_STENCIL_BACK_WRITEMASK, &backMask); + if (frontMask == 0x1b || + backMask != 0x1b) + return GL_FALSE; +#endif + return GL_TRUE; +} + + /* * The following file is auto-generated with Python. */ @@ -302,12 +371,19 @@ check_functions( const char *extensions ) for (entry = functions; entry->name; entry++) { if (entry->name[0] == '-') { - /* XXX update for OpenGL 2.0 */ + const char *version = (const char *) glGetString(GL_VERSION); if (entry->name[1] == '1') { - /* check GL version X.Y */ - const char *version = (const char *) glGetString(GL_VERSION); - if (version[0] == entry->name[1] && - version[1] == entry->name[2] && + /* check GL version 1.x */ + if (version[0] == '1' && + version[1] == '.' && + version[2] >= entry->name[3]) + doTests = 1; + else + doTests = 0; + } + else if (entry->name[1] == '2') { + if (version[0] == '2' && + version[1] == '.' && version[2] >= entry->name[3]) doTests = 1; else @@ -377,12 +453,14 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect) GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, + GLX_STENCIL_SIZE, 1, None }; int attribDouble[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, + GLX_STENCIL_SIZE, 1, GLX_DOUBLEBUFFER, None }; diff --git a/progs/tests/mipmap_limits.c b/progs/tests/mipmap_limits.c index 3bcb8a88584..dc066cab1f0 100644 --- a/progs/tests/mipmap_limits.c +++ b/progs/tests/mipmap_limits.c @@ -127,7 +127,7 @@ static void display(void) GLfloat tcm = 4.0; printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s\n", BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, - NearestFilter ? "LINEAR" : "NEAREST"); + NearestFilter ? "NEAREST" : "LINEAR"); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel); diff --git a/progs/xdemos/.cvsignore b/progs/xdemos/.gitignore index 4adffda2d1e..4adffda2d1e 100644 --- a/progs/xdemos/.cvsignore +++ b/progs/xdemos/.gitignore diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index 4ca8b107a24..ec85464bec0 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -24,11 +24,11 @@ PROGS = glthreads \ pbinfo \ pbdemo \ wincopy \ - xdemo \ xfont \ xrotfontdemo \ yuvrect_client +# omit this XMesa API demo: xdemo ##### RULES ##### diff --git a/progs/xdemos/glthreads.c b/progs/xdemos/glthreads.c index 83413383dd4..989697fbcaa 100644 --- a/progs/xdemos/glthreads.c +++ b/progs/xdemos/glthreads.c @@ -473,7 +473,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(displayName); if (!dpy) { - fprintf(stderr, "Unable to open display %s\n", displayName); + fprintf(stderr, "Unable to open display %s\n", XDisplayName(displayName)); return -1; } } diff --git a/progs/xdemos/glxcontexts.c b/progs/xdemos/glxcontexts.c index fbc296ef625..a9ff326ed5e 100644 --- a/progs/xdemos/glxcontexts.c +++ b/progs/xdemos/glxcontexts.c @@ -587,8 +587,8 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", - dpyName ? dpyName : getenv("DISPLAY")); + fprintf(stderr, "Error: couldn't open display %s\n", + XDisplayName(dpyName)); return -1; } diff --git a/progs/xdemos/glxgears_fbconfig.c b/progs/xdemos/glxgears_fbconfig.c index acbadd21ac5..2dac00b75d1 100644 --- a/progs/xdemos/glxgears_fbconfig.c +++ b/progs/xdemos/glxgears_fbconfig.c @@ -575,7 +575,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); return -1; } diff --git a/progs/xdemos/glxheads.c b/progs/xdemos/glxheads.c index 0145a70e91c..b3290e90d51 100644 --- a/progs/xdemos/glxheads.c +++ b/progs/xdemos/glxheads.c @@ -57,7 +57,7 @@ static int NumHeads = 0; static void Error(const char *display, const char *msg) { - fprintf(stderr, "Error on display %s - %s\n", display, msg); + fprintf(stderr, "Error on display %s - %s\n", XDisplayName(display), msg); exit(1); } diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index fdd1c0523f6..3e8e0be5203 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -456,7 +456,19 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) } printf("display: %s screen: %d\n", displayName, scrnum); free(displayName); - printf("direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No"); + printf("direct rendering: "); + if (glXIsDirect(dpy, ctx)) { + printf("Yes\n"); + } else { + if (!allowDirect) { + printf("No (-i specified)\n"); + } else if (getenv("LIBGL_ALWAYS_INDIRECT")) { + printf("No (LIBGL_ALWAYS_INDIRECT set)\n"); + } else { + printf("No (If you want to find out why, try setting " + "LIBGL_DEBUG=verbose)\n"); + } + } printf("server glx vendor string: %s\n", serverVendor); printf("server glx version string: %s\n", serverVersion); printf("server glx extensions:\n"); @@ -927,7 +939,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(displayName); if (!dpy) { - fprintf(stderr, "Error: unable to open display %s\n", displayName); + fprintf(stderr, "Error: unable to open display %s\n", XDisplayName(displayName)); return -1; } diff --git a/progs/xdemos/glxswapcontrol.c b/progs/xdemos/glxswapcontrol.c index 0ed5ebe4722..d9be984be57 100644 --- a/progs/xdemos/glxswapcontrol.c +++ b/progs/xdemos/glxswapcontrol.c @@ -749,7 +749,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); return -1; } diff --git a/progs/xdemos/manywin.c b/progs/xdemos/manywin.c index c9cca751341..cfea555210a 100644 --- a/progs/xdemos/manywin.c +++ b/progs/xdemos/manywin.c @@ -59,7 +59,7 @@ static GLuint TexObj = 0; static void Error(const char *display, const char *msg) { - fprintf(stderr, "Error on display %s - %s\n", display, msg); + fprintf(stderr, "Error on display %s - %s\n", XDisplayName(display), msg); exit(1); } diff --git a/progs/xdemos/opencloseopen.c b/progs/xdemos/opencloseopen.c index 2e4de24c71d..0b8d0618431 100644 --- a/progs/xdemos/opencloseopen.c +++ b/progs/xdemos/opencloseopen.c @@ -91,7 +91,7 @@ make_window( const char * dpyName, const char *name, dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); exit(1); } diff --git a/progs/xdemos/pbinfo.c b/progs/xdemos/pbinfo.c index 88d93c8da62..b43adf1bb70 100644 --- a/progs/xdemos/pbinfo.c +++ b/progs/xdemos/pbinfo.c @@ -95,7 +95,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName ? dpyName : ":0"); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); return 1; } diff --git a/progs/xdemos/yuvrect_client.c b/progs/xdemos/yuvrect_client.c index 48f82cb7599..e2b79a7c0e1 100644 --- a/progs/xdemos/yuvrect_client.c +++ b/progs/xdemos/yuvrect_client.c @@ -296,7 +296,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { printf("Error: couldn't open display %s\n", - dpyName ? dpyName : getenv("DISPLAY")); + XDisplayName(dpyName)); return -1; } |