Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: X-Originating-Email: [andre_bleau AT hotmail DOT com] X-Sender: andre_bleau AT hotmail DOT com From: =?iso-8859-1?B?QW5kcukgQmxlYXU=?= To: cygwin AT cygwin DOT com Subject: Re: still a tessellation problem with OpenGL Date: Sat, 12 Feb 2005 15:42:03 -0500 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed X-OriginalArrivalTime: 12 Feb 2005 20:43:00.0526 (UTC) FILETIME=[70F124E0:01C51143] Note-from-DJ: This may be spam wrote: >Hi, Hi Denis, > >using an advice by Andre Bleau a year ago, I got the two >tessellation examples (tess.c and tesswind.c) from OpenGL working. >However, the example below, slightly different from >tess.c doesn't work. I get a segmentation fault, but I have no idea >how to solve the problem. Well, reading the manual about how to properly call "glu" functions would be a step in the right direction; see below. >I would appreciate any help as this is >a reduced case of a larger program which works well on linux, >and that I'd love to port on cygwin. I suspect this problem is related with >tessellation, but I am not sure. Your problem is indeed related to tessellation, but this time it is not Cygwin-specific. I'll give you some help anyway. > >Thanks in advance, > >Denis > >$ gcc -g -o mytess mytess.c -lopengl32 -lglu32 -lglut32 First thing: the proper order for linking is -lglut32 -lglu32 -lopengl32 , as documented in /usr/share/doc/opengl-1.1.0/README.txt Order is important; you were just lucky this time. > >$mytess.exe >Ok here >Segmentation fault (core dumped) > >... > -> ------------------------------------------------------------------------ >// adapted from tess.c > >#include >#include >#include > >#ifndef CALLBACK #define CALLBACK __attribute__ ((__stdcall__)) >#endif > >... > >void CALLBACK vertexCallback(GLvoid *vertex) >{ > const GLdouble *pointer; > > pointer = (GLdouble *) vertex; > glColor3dv(pointer+3); > glVertex3dv(vertex); >} > >... > >void tess_properties(GLUtesselator *tobj) { > gluTessProperty (tobj, GLU_TESS_WINDING_RULE, > GLU_TESS_WINDING_POSITIVE); gluTessCallback(tobj, > GLU_TESS_VERTEX,(_GLUfuncptr)glVertex3dv); gluTessCallback(tobj, > GLU_TESS_BEGIN,(_GLUfuncptr)beginCallback); gluTessCallback(tobj, > GLU_TESS_END,(_GLUfuncptr)endCallback); > gluTessCallback(tobj, GLU_TESS_ERROR,(_GLUfuncptr)errorCallback); > gluTessCallback(tobj, GLU_TESS_COMBINE, (_GLUfuncptr)combineCallback); > gluTessCallback(tobj, > GLU_TESS_VERTEX_DATA,(_GLUfuncptr)&vertexCallback); >} > >... Here's the problem: vertexCallback is your GLU_TESS_VERTEX_DATA callback function. Proper GLU_TESS_VERTEX_DATA callback functions need to have the following prototype: void CALLBACK vertexData (void * vertex_data, void * polygon_data); Maybe your version of linux and/or gcc on linux is more tolerant to missing arguments. Or maybe you screwed-up the stack there too, only just not enough for crashing your program. You may find other useful info about gluTessCallback in the man pages for glu. There are available at many places on the web. Example: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glufnc01_9bu3.asp I've modified a single line in your test program: void CALLBACK vertexCallback(GLvoid *vertex) was changed to: void CALLBACK vertexCallback(GLvoid *vertex, GLvoid *polygon) Running it opens an all-black window. Probably not what you would like, but certainly no crash. As this is not some problem specific to cygwin's support of glut, glu or open GL, please use some open GL forum, such as: http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=forum;f=2 if you need further help with your program. Regards, André Bleau, Cygwin's OpenGL package maintainer. _________________________________________________________________ Balayez vos courriels entrants et sortants et les pièces jointes et contribuez à éliminer les virus destructeurs susceptibles d’y être intégrés. http://join.msn.com/?pgmarket=fr-ca&page=features/virus Commencez dès maintenant à profiter de tous les avantages de MSN Premium et obtenez les deux premiers mois GRATUITS*. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/