From owner-ogl-sample@oss.sgi.com Mon Apr 23 02:02:24 2001 Received: (from majordomo@localhost) by oss.sgi.com (8.11.3/8.11.3) id f3N92OE13997 for ogl-sample-outgoing; Mon, 23 Apr 2001 02:02:24 -0700 Received: from mail0.epfl.ch (mail0.epfl.ch [128.178.50.57]) by oss.sgi.com (8.11.3/8.11.3) with SMTP id f3N92KM13994 for ; Mon, 23 Apr 2001 02:02:21 -0700 Received: (qmail 9107 invoked from network); 23 Apr 2001 09:02:18 -0000 Received: from ltspc67.epfl.ch (HELO epfl.ch) (128.178.121.34) by mail0.epfl.ch with SMTP; 23 Apr 2001 09:02:18 -0000 Message-ID: <3AE3EF9A.6182C49F@epfl.ch> Date: Mon, 23 Apr 2001 11:02:18 +0200 From: Diego Santa Cruz Organization: Ecole Polytechnique Federale de Lausanne X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17-14cstm i686) X-Accept-Language: en, es, fr MIME-Version: 1.0 To: ogl-sample@oss.sgi.com Subject: [ogl-sample] Bug in GLU: invalid call to glMapGrid2f() Content-Type: multipart/mixed; boundary="------------83C7B4EC020A4ED3E6A92334" Sender: owner-ogl-sample@oss.sgi.com Precedence: bulk Reply-To: ogl-sample@oss.sgi.com This is a multi-part message in MIME format. --------------83C7B4EC020A4ED3E6A92334 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi there, Sorry for sending this bug report to this mailing lits instead of reporting it via bugzilla but I have been unable to get a password from the bugzilla system (mail sent with password never arrived). The bug is that the GLU nurbs renderer sometimes places invalid calls to glMapGrid2f() with parameters 'un' and/or 'vn' of 0. I have traced the bug to main/gfx/lib/glu/libnurbs/internals/slicer.cc and I think I have fixed it in the patch which I attach. The nurbs_revol.c program attached demonstrates the problem. Note that it occurs only when using the GLU_NURBS_RENDERER, not with the GLU_NURBS_TESSELLATOR (as it does not use GL evaluators). If any help is needed you can contact me at my e-mail address (I'm not member of this mailing list). Best regards, Diego Santa Cruz PS: I have tried the bug and it occurs on Irix machines (with the shipped GLU) as well as Linux/i386 ones (with the SI-GLU compiled by me). -- ----------------------------------------------------------------------- Diego Santa Cruz mailto:Diego.Santacruz@epfl.ch Signal Processing Laboratory (LTS) http://ltswww.epfl.ch/~dsanta Swiss Federal Institute of Technology (EPFL) EL - Ecublens - CH-1015 Lausanne - Switzerland Office: ELE 236 Phone: +41 - 21 - 693 26 57 (Office) +41 - 21 - 693 46 20 (LTS Lab) * * Fax: +41 - 21 - 693 76 00 'O^-' Mobile: +41 - 79 - 375 50 60 ( o ) -------------------------------------------------------- oOO U OOo ---- --------------83C7B4EC020A4ED3E6A92334 Content-Type: text/plain; charset=us-ascii; name="nurb_revol.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="nurb_revol.c" /* * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the name of * Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF * ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * Modified by Diego Santa Cruz, Fri Apr 20 CEST 2001 * * Changed the model to the Goblet one from the Computer Science Department, * University of Utah and added GLU 1.3 NURBS tessellator support. * * Copyright (c) 2001, Diego Santa Cruz * */ #include #include #include #include #include #ifndef GLU_VERSION_1_1 #error Reuiqres GLU 1.1 to compile #endif #ifndef CALLBACK #define CALLBACK #endif GLenum doubleBuffer; GLenum expectedError; GLint rotX = 0, rotY = 0; GLUnurbsObj *theNurbs; /* This model was created using the Alpha_1 geometric */ /* modeling system at the Computer Science Department, */ /* University of Utah. We would appreciate your */ /* acknowledging the source of the data in publication */ /* of work utilizing this model, or portions of it. */ GLfloat control_points[] = { 0, -.339411, 0, 1, 0, -.169706, -.169706, 1, 0, 0, -.339411, 1, 0, .169706, -.169706, 1, 0, .339411, 0, 1, 0, .169706, .169706, 1, 0, 0, .339411, 1, 0, -.169706, .169706, 1, 0, -.339411, 0, 1, .0166667, -.339305, 0, 1, .0166667, -.169653, -.169653, 1, .0166667, 0, -.339305, 1, .0166667, .169653, -.169653, 1, .0166667, .339305, 0, 1, .0166667, .169653, .169653, 1, .0166667, 0, .339305, 1, .0166667, -.169653, .169653, 1, .0166667, -.339305, 0, 1, .05, -.335863, 0, 1, .05, -.167931, -.167931, 1, .05, 0, -.335863, 1, .05, .167931, -.167931, 1, .05, .335863, 0, 1, .05, .167931, .167931, 1, .05, 0, .335863, 1, .05, -.167931, .167931, 1, .05, -.335863, 0, 1, .0914931, -.299836, 0, 1, .0914931, -.149918, -.149918, 1, .0914931, 0, -.299836, 1, .0914931, .149918, -.149918, 1, .0914931, .299836, 0, 1, .0914931, .149918, .149918, 1, .0914931, 0, .299836, 1, .0914931, -.149918, .149918, 1, .0914931, -.299836, 0, 1, .124826, -.167957, 0, 1, .106673, -.0982697, -.0982697, .85457, .124826, 0, -.167957, 1, .106673, .0982697, -.0982697, .85457, .124826, .167957, 0, 1, .106673, .0982697, .0982697, .85457, .124826, 0, .167957, 1, .106673, -.0982697, .0982697, .85457, .124826, -.167957, 0, 1, .15816, -.0595285, 0, 1, .111836, -.042093, -.042093, .707107, .15816, 0, -.0595285, 1, .111836, .042093, -.042093, .707107, .15816, .0595285, 0, 1, .111836, .042093, .042093, .707107, .15816, 0, .0595285, 1, .111836, -.042093, .042093, .707107, .15816, -.0595285, 0, 1, .191667, -.0401543, 0, 1, .135529, -.0283934, -.0283934, .707107, .191667, 0, -.0401543, 1, .135529, .0283934, -.0283934, .707107, .191667, .0401543, 0, 1, .135529, .0283934, .0283934, .707107, .191667, 0, .0401543, 1, .135529, -.0283934, .0283934, .707107, .191667, -.0401543, 0, 1, .225, -.0425, 0, 1, .159099, -.030052, -.030052, .707107, .225, 0, -.0425, 1, .159099, .030052, -.030052, .707107, .225, .0425, 0, 1, .159099, .030052, .030052, .707107, .225, 0, .0425, 1, .159099, -.030052, .030052, .707107, .225, -.0425, 0, 1, .258316, -.0714549, 0, 1, .182657, -.0505262, -.0505262, .707107, .258316, 0, -.0714549, 1, .182657, .0505262, -.0505262, .707107, .258316, .0714549, 0, 1, .182657, .0505262, .0505262, .707107, .258316, 0, .0714549, 1, .182657, -.0505262, .0505262, .707107, .258316, -.0714549, 0, 1, .29158, -.128385, 0, 1, .206178, -.0907821, -.0907821, .707107, .29158, 0, -.128385, 1, .206178, .0907821, -.0907821, .707107, .29158, .128385, 0, 1, .206178, .0907821, .0907821, .707107, .29158, 0, .128385, 1, .206178, -.0907821, .0907821, .707107, .29158, -.128385, 0, 1, .324271, -.154993, 0, 1, .229294, -.109597, -.109597, .707107, .324271, 0, -.154993, 1, .229294, .109597, -.109597, .707107, .324271, .154993, 0, 1, .229294, .109597, .109597, .707107, .324271, 0, .154993, 1, .229294, -.109597, .109597, .707107, .324271, -.154993, 0, 1, .365399, -.116657, 0, 1, .258376, -.0824886, -.0824886, .707107, .365399, 0, -.116657, 1, .258376, .0824886, -.0824886, .707107, .365399, .116657, 0, 1, .258376, .0824886, .0824886, .707107, .365399, 0, .116657, 1, .258376, -.0824886, .0824886, .707107, .365399, -.116657, 0, 1, .421858, -.0606315, 0, 1, .298298, -.0428729, -.0428729, .707107, .421858, 0, -.0606315, 1, .298298, .0428729, -.0428729, .707107, .421858, .0606315, 0, 1, .298298, .0428729, .0428729, .707107, .421858, 0, .0606315, 1, .298298, -.0428729, .0428729, .707107, .421858, -.0606315, 0, 1, .493867, -.0511714, 0, 1, .349217, -.0361836, -.0361836, .707107, .493867, 0, -.0511714, 1, .349217, .0361836, -.0361836, .707107, .493867, .0511714, 0, 1, .349217, .0361836, .0361836, .707107, .493867, 0, .0511714, 1, .349217, -.0361836, .0361836, .707107, .493867, -.0511714, 0, 1, .54785, -.0848609, 0, 1, .387388, -.0600057, -.0600057, .707107, .54785, 0, -.0848609, 1, .387388, .0600057, -.0600057, .707107, .54785, .0848609, 0, 1, .387388, .0600057, .0600057, .707107, .54785, 0, .0848609, 1, .387388, -.0600057, .0600057, .707107, .54785, -.0848609, 0, 1, .589141, -.164206, 0, 1, .416585, -.116111, -.116111, .707107, .589141, 0, -.164206, 1, .416585, .116111, -.116111, .707107, .589141, .164206, 0, 1, .416585, .116111, .116111, .707107, .589141, 0, .164206, 1, .416585, -.116111, .116111, .707107, .589141, -.164206, 0, 1, .62916, -.216905, 0, 1, .444883, -.153375, -.153375, .707107, .62916, 0, -.216905, 1, .444883, .153375, -.153375, .707107, .62916, .216905, 0, 1, .444883, .153375, .153375, .707107, .62916, 0, .216905, 1, .444883, -.153375, .153375, .707107, .62916, -.216905, 0, 1, .70224, -.253141, 0, 1, .496559, -.178998, -.178998, .707107, .70224, 0, -.253141, 1, .496559, .178998, -.178998, .707107, .70224, .253141, 0, 1, .496559, .178998, .178998, .707107, .70224, 0, .253141, 1, .496559, -.178998, .178998, .707107, .70224, -.253141, 0, 1, .82956, -.263243, 0, 1, .586588, -.186141, -.186141, .707107, .82956, 0, -.263243, 1, .586588, .186141, -.186141, .707107, .82956, .263243, 0, 1, .586588, .186141, .186141, .707107, .82956, 0, .263243, 1, .586588, -.186141, .186141, .707107, .82956, -.263243, 0, 1, .93484, -.251769, 0, 1, .661032, -.178028, -.178028, .707107, .93484, 0, -.251769, 1, .661032, .178028, -.178028, .707107, .93484, .251769, 0, 1, .661032, .178028, .178028, .707107, .93484, 0, .251769, 1, .661032, -.178028, .178028, .707107, .93484, -.251769, 0, 1, 1, -.24, 0, 1, .707107, -.169706, -.169706, .707107, 1, 0, -.24, 1, .707107, .169706, -.169706, .707107, 1, .24, 0, 1, .707107, .169706, .169706, .707107, 1, 0, .24, 1, .707107, -.169706, .169706, .707107, 1, -.24, 0, 1 }; GLfloat uknots[] = { 0, 0, 0, .25, .25, .5, .5, .75, .75, 1, 1, 1 }; GLfloat vknots[] = { 0, 0, 0, 0, .05, .1, .124479, .15, .2, .225, .25, .299948, .324792, .348073, .423333, .494167, .564102, .58528, .61804, .68416, .80452, 1, 1, 1, 1 }; #define UORDER 3 #define VORDER 4 #define NUKNOTS (sizeof(uknots)/sizeof(uknots[0])) #define NVKNOTS (sizeof(vknots)/sizeof(vknots[0])) #define NUPNTS (NUKNOTS-UORDER) #define NVPNTS (NVKNOTS-VORDER) static void CALLBACK ErrorCallback(GLenum which) { if (which != expectedError) { fprintf(stderr, "Unexpected error occured (%d):\n", which); fprintf(stderr, " %s\n", (char *) gluErrorString(which)); } } static void CALLBACK NurbsBegin(GLenum type) { glBegin(type); } static void CALLBACK NurbsEnd() { glEnd(); } static void CALLBACK NurbsVertex(GLfloat *vertex) { glVertex3fv(vertex); } static void CALLBACK NurbsNormal(GLfloat *normal) { glNormal3fv(normal); } static void Init(void) { static const GLfloat material_f[4] = {0.7, 0.7, 0.7, 1.0}; static const GLfloat material_b[4] = {0.5, 0.5, 0.5, 1.0}; static const GLfloat amb_light[4] = {0.9, 0.9, 0.9, 1.0}; static const GLfloat lt0_light[] = {0.3, 0.3, 0.3, 1.0f}; theNurbs = gluNewNurbsRenderer(); #if defined(GLU_VERSION_1_3) gluNurbsCallback(theNurbs, GLU_NURBS_ERROR, ErrorCallback); gluNurbsCallback(theNurbs, GLU_NURBS_BEGIN, NurbsBegin); gluNurbsCallback(theNurbs, GLU_NURBS_VERTEX, NurbsVertex); gluNurbsCallback(theNurbs, GLU_NURBS_NORMAL, NurbsNormal); gluNurbsCallback(theNurbs, GLU_NURBS_END, NurbsEnd); #elif defined(GLU_VERSION_1_2) gluNurbsCallback(theNurbs, GLU_ERROR, ErrorCallback); #endif gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_FILL); /* A tolerance of 15 or less makes the sample implementation of the GLU * (version of 2001.03.15) generate invalid calls to glMapGrid2f(), where vn * or un are 0. Mesa's 3.4.1 GLU does not have this bug. */ gluNurbsProperty(theNurbs, GLU_SAMPLING_METHOD, GLU_PARAMETRIC_ERROR); gluNurbsProperty(theNurbs, GLU_PARAMETRIC_TOLERANCE, 10.0); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); glLightModelfv(GL_LIGHT_MODEL_AMBIENT,amb_light); glLightfv(GL_LIGHT0,GL_DIFFUSE,lt0_light); glLightfv(GL_LIGHT0,GL_SPECULAR,lt0_light); glEnable(GL_AUTO_NORMAL); glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,material_f); glMaterialfv(GL_FRONT,GL_SPECULAR,material_f); glMaterialf(GL_FRONT,GL_SHININESS,100); glMaterialfv(GL_BACK,GL_AMBIENT_AND_DIFFUSE,material_b); glMaterialfv(GL_BACK,GL_SPECULAR,material_b); glMaterialf(GL_BACK,GL_SHININESS,10); } static void Reshape(int width, int height) { glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(35,(GLfloat)width/(GLfloat)height,0.8,5); gluLookAt(0,0,2.718107,0,0,0,0,1,0); glMatrixMode(GL_MODELVIEW); } static void Key2(int key, int x, int y) { switch (key) { case GLUT_KEY_DOWN: rotY += 5; break; case GLUT_KEY_UP: rotY -= 5; break; case GLUT_KEY_LEFT: rotX -= 5; break; case GLUT_KEY_RIGHT: rotX += 5; break; default: return; } glutPostRedisplay(); } static void Key(unsigned char key, int x, int y) { switch (key) { case 27: case 'q': case 'Q': exit(0); break; #ifdef GLU_VERSION_1_3 case 'r': case 'R': gluNurbsProperty(theNurbs,GLU_NURBS_MODE,GLU_NURBS_RENDERER); fprintf(stderr,"INFO: nurbs mode = GLU_NURBS_RENDERER\n"); glutPostRedisplay(); break; #endif case 't': case 'T': #ifdef GLU_VERSION_1_3 gluNurbsProperty(theNurbs,GLU_NURBS_MODE,GLU_NURBS_TESSELLATOR); fprintf(stderr,"INFO: nurbs mode = GLU_NURBS_TESSELLATOR\n"); glutPostRedisplay(); #else fprintf(stderr,"Compile with GLU 1.3 for GLU NURBS tessellator support.\n"); #endif break; } } static void Draw(void) { static const GLfloat light_pos[] = {-1,1,1,0}; GLenum errorCode; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glLightfv(GL_LIGHT0, GL_POSITION, light_pos); glRotatef(rotY, 1, 0, 0); glRotatef(rotX, 0, 1, 0); glTranslatef(-0.5, 0, 0); gluBeginSurface(theNurbs); gluNurbsSurface(theNurbs, NUKNOTS, uknots, NVKNOTS, vknots, 4, 4*NUPNTS, control_points, UORDER, VORDER, GL_MAP2_VERTEX_4); gluEndSurface(theNurbs); glPopMatrix(); glFlush(); if (doubleBuffer) { glutSwapBuffers(); } while ((errorCode = glGetError()) != GL_NO_ERROR) { fprintf(stderr,"GL error: %s\n",(const char *)gluErrorString(errorCode)); } } static GLenum Args(int argc, char **argv) { GLint i; doubleBuffer = GL_FALSE; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-sb") == 0) { doubleBuffer = GL_FALSE; } else if (strcmp(argv[i], "-db") == 0) { doubleBuffer = GL_TRUE; } else { printf("%s (Bad option).\n", argv[i]); return GL_FALSE; } } return GL_TRUE; } int main(int argc, char **argv) { GLenum type; glutInit(&argc, argv); if (Args(argc, argv) == GL_FALSE) { exit(1); } glutInitWindowPosition(0, 0); glutInitWindowSize( 500, 500); type = GLUT_RGB|GLUT_DEPTH; type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; glutInitDisplayMode(type); if (glutCreateWindow("NURBS Test") == GL_FALSE) { exit(1); } Init(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutSpecialFunc(Key2); glutDisplayFunc(Draw); glutMainLoop(); return 0; } --------------83C7B4EC020A4ED3E6A92334 Content-Type: text/plain; charset=us-ascii; name="ogl-sample-glu-nurbs-renderer.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ogl-sample-glu-nurbs-renderer.patch" --- main/gfx/lib/glu/libnurbs/internals/slicer.cc Wed Apr 5 08:43:40 2000 +++ main-fixed/gfx/lib/glu/libnurbs/internals/slicer.cc Fri Apr 20 18:19:16 2001 @@ -575,11 +575,11 @@ TrimVertex trimVert; trimVert.nuid = 0;//???? - backend.surfgrid(u_val[0], u_val[n_ulines-1], n_ulines-1, - v_val[n_vlines-1], v_val[0], n_vlines-1); - - if(n_ulines>1 && n_vlines>1) + if(n_ulines>1 && n_vlines>1) { + backend.surfgrid(u_val[0], u_val[n_ulines-1], n_ulines-1, + v_val[n_vlines-1], v_val[0], n_vlines-1); backend.surfmesh(0,0,n_ulines-1,n_vlines-1); + } return; --------------83C7B4EC020A4ED3E6A92334-- From owner-ogl-sample@oss.sgi.com Fri Apr 27 13:36:08 2001 Received: (from majordomo@localhost) by oss.sgi.com (8.11.3/8.11.3) id f3RKa8B32691 for ogl-sample-outgoing; Fri, 27 Apr 2001 13:36:08 -0700 Received: from mail.valinux.com (mail@mail.valinux.com [198.186.202.175]) by oss.sgi.com (8.11.3/8.11.3) with ESMTP id f3RKa6M32688 for ; Fri, 27 Apr 2001 13:36:07 -0700 Received: from jens2.cmn.net ([207.174.125.34] helo=valinux.com) by mail.valinux.com with esmtp (Cipher SSLv3:RC4-MD5:128) (Exim 3.22 #1 (Debian)) id 14tEyD-0006WJ-00 for ; Fri, 27 Apr 2001 13:36:06 -0700 Message-ID: <3AE9D94E.5FFE82AF@valinux.com> Date: Fri, 27 Apr 2001 14:40:46 -0600 From: Brian Paul Organization: VA Linux Systems, Inc. X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.4.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: "ogl-sample@oss.sgi.com" Subject: [ogl-sample] Bug fix for __glXSwapBuffers() Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-ogl-sample@oss.sgi.com Precedence: bulk Reply-To: ogl-sample@oss.sgi.com I've found a problem in the server-side swapbuffers code while testing with the DRI. Here's the function from the ogl-sample glx/server/glxcmds.c file: int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; DrawablePtr pDraw; xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; GLXContextTag tag = req->contextTag; XID drawId = req->drawable; __GLXpixmap *pGlxPixmap; __GLXcontext *glxc = NULL; int error; /* ** Check that the GLX drawable is valid. */ pDraw = (DrawablePtr) LookupDrawable(drawId, client); if (pDraw) { if (pDraw->type == DRAWABLE_WINDOW) { /* ** Drawable is an X window. */ } else { /* ** Drawable is an X pixmap, which is not allowed. */ client->errorValue = drawId; return __glXBadDrawable; } } else { pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes); if (pGlxPixmap) { /* ** Drawable is a GLX pixmap. */ } else { /* ** Drawable is neither a X window nor a GLX pixmap. */ client->errorValue = drawId; return __glXBadDrawable; } } if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) { return __glXBadContextTag; } /* ** The calling thread is swapping its current drawable. In this case, ** glxSwapBuffers is in both GL and X streams, in terms of ** sequentiality. */ if (__glXForceCurrent(cl, tag, &error)) { /* ** Do whatever is needed to make sure that all preceding requests ** in both streams are completed before the swap is executed. */ glFinish(); __GLX_NOTE_FLUSHED_CMDS(glxc); } else { return error; } } if (pDraw) { __GLXdrawablePrivate *glxPriv; glxPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes); if (glxPriv == NULL) { return __glXBadDrawable; } if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) { return __glXBadDrawable; } } return Success; } If is 0, then will be NULL when we reach the call to __glXGetDrawablePrivate(). Dereferencing glxc->modes causes a segfault. can legally be zero. This happens when the user calls glXSwapBuffers() for a window which is not currently bound to a rendering context. The client-side glXSwapBuffers() code explicity sets the context tag to zero when the user does this. Replacing the end of the function with this code seems to fix the problem: [...] if (pDraw) { __GLXdrawablePrivate *glxPriv; if (glxc) { glxPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes); if (glxPriv == NULL) { return __glXBadDrawable; } } else { glxPriv = __glXFindDrawablePrivate(drawId); if (glxPriv == NULL) { /* This is a window we've never seen before, do nothing */ return Success; } } if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) { return __glXBadDrawable; } } return Success; } I'm simply returning Success when attempting to do a swap on a window which the GLX code has never encountered before. I'm not sure what else can be done. I'm checking this change into the XFree86/DRI code. If this looks OK someone should probably update the ogl-sample code too. -Brian From owner-ogl-sample@oss.sgi.com Fri Apr 27 13:49:30 2001 Received: (from majordomo@localhost) by oss.sgi.com (8.11.3/8.11.3) id f3RKnUI00706 for ogl-sample-outgoing; Fri, 27 Apr 2001 13:49:30 -0700 Received: from mail.valinux.com (mail@mail.valinux.com [198.186.202.175]) by oss.sgi.com (8.11.3/8.11.3) with ESMTP id f3RKnUM00703 for ; Fri, 27 Apr 2001 13:49:30 -0700 Received: from jens2.cmn.net ([207.174.125.34] helo=valinux.com) by mail.valinux.com with esmtp (Cipher SSLv3:RC4-MD5:128) (Exim 3.22 #1 (Debian)) id 14tFBB-0007lT-00 for ; Fri, 27 Apr 2001 13:49:30 -0700 Message-ID: <3AE9DC70.F3D69827@valinux.com> Date: Fri, 27 Apr 2001 14:54:08 -0600 From: Brian Paul Organization: VA Linux Systems, Inc. X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.4.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: "ogl-sample@oss.sgi.com" Subject: [ogl-sample] suggested change for glcore.h Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-ogl-sample@oss.sgi.com Precedence: bulk Reply-To: ogl-sample@oss.sgi.com The gfx/include/gl/internal/glcore.h file has the following: #if __GL_NUMBER_OF_AUX_BUFFERS > 0 __GLdrawableBuffer *auxBuffer; #endif The problem is __GL_NUMBER_OF_AUX_BUFFERS is never defined, resulting in a lot of compiler warnings. The suggested change is: #if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) __GLdrawableBuffer *auxBuffer; #endif -Brian From owner-ogl-sample@oss.sgi.com Fri Apr 27 14:33:45 2001 Received: (from majordomo@localhost) by oss.sgi.com (8.11.3/8.11.3) id f3RLXji02189 for ogl-sample-outgoing; Fri, 27 Apr 2001 14:33:45 -0700 Received: from mail.valinux.com (mail@mail.valinux.com [198.186.202.175]) by oss.sgi.com (8.11.3/8.11.3) with ESMTP id f3RLXiM02186 for ; Fri, 27 Apr 2001 14:33:44 -0700 Received: from jens2.cmn.net ([207.174.125.34] helo=valinux.com) by mail.valinux.com with esmtp (Cipher SSLv3:RC4-MD5:128) (Exim 3.22 #1 (Debian)) id 14tFrz-0002KV-00 for ; Fri, 27 Apr 2001 14:33:44 -0700 Message-ID: <3AE9E6D0.DA6CC38@valinux.com> Date: Fri, 27 Apr 2001 15:38:24 -0600 From: Brian Paul Organization: VA Linux Systems, Inc. X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.4.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: "ogl-sample@oss.sgi.com" Subject: [ogl-sample] another glcore.h change Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-ogl-sample@oss.sgi.com Precedence: bulk Reply-To: ogl-sample@oss.sgi.com As long as I'm making suggestions I'd like to suggest replacing the two struct members named 'private' with 'privatePtr' or something else so that glcore.h would work with C++. -Brian