This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: still a tessellation problem with OpenGL

<Denis dot Roegel at loria dot fr> wrote:


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,


$ 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 <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>

#ifndef CALLBACK #define CALLBACK __attribute__ ((__stdcall__))


void CALLBACK vertexCallback(GLvoid *vertex)
   const GLdouble *pointer;

   pointer = (GLdouble *) 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,
   gluTessCallback(tobj, GLU_TESS_ERROR,(_GLUfuncptr)errorCallback);
   gluTessCallback(tobj, GLU_TESS_COMBINE, (_GLUfuncptr)combineCallback);


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:

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:;f=2

if you need further help with your program.


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. Commencez dès maintenant à profiter de tous les avantages de MSN Premium et obtenez les deux premiers mois GRATUITS*.

-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]