In the past I've requested help w/ the following in the "Beginners" forum, but to no avail. I now post in the "Windows Specific" forum hoping that a more focused audience might shed more light. :)

I've been puzzling over a problem with polygon tessellation for some time, and would appreciate some help. I am trying to use the GLU tessellation functions to render a non-convex polygon. My program compiles w/ no errors using MinGW. But, when I run it, Windows XP says it has "encountered a problem & needs to close."
If anyone is able to get my program to run on their machine, or can see my error, I would be most thankful for your reply.

I do not have any experience with MinGW so I imported the source from your post into a Win32 project using Visual C++ .net (2002) with the intention of walking through with the debugger to find the crash. I had a few complaints from the compiler, so I did the following:

I also changed the definition of the second parameter of your myGLUTInitializationFunction: from char* argv[] to just char* argv

I changed the argv parameter calling glutInit: from argv to &argv

Lastly the callback functions were complaining about having to return a value (when they aren't supposed to). I left your typedef for TessFuncPtr as is, but for each callback function I used CALLBACK like this example:

void CALLBACK beginCallback ( GLenum which )
{
glBegin ( which ) ;
} // end beginCallbackAfter those minor changes it compiled fine. When I ran it to find the crashing bug, it did not crash. The Star Trek emblem displayed as expected.

Not sure if all of those changes are correct, I just made them off the top of my head. I didn't take the time to look them all up in the docs, but it worked and one or more of the changes might have fixed the crashing problem.

JeffBozeman

04-03-2004, 05:32 PM

robosport,

Thank you very much for your reply.

I don't have Visual C++ here, so couldn't try out your modifications as of yet. I have a copy of Visual C++ back at my office, so might try it later.

I'm a bit confused about glutInit. The Red Book (4th edition) says on page 17 that its parameters are (int *, char **), but later (on page 684) that the parameters are (int, char **). I've been assuming the former (without problem) in a variety of OpenGL programs for several months now.

I was a little confused as to why you'd changed the 2nd parameter of myGLUTInitializationFunction to char *argv. I had been under the impression that "main", when it has parameters, are (int, char * []), and, hence, myGLUTInitializationFunction receives a char** when invoked (which it just passes on to glutInit).

Also, I tried using CALLBACK as you suggest (also as shown on Red Book's page 493). That did not fix it on my machine, either.

In any case, I am encouraged that you got the programming running properly with fairly little trouble. It's my hypothesis that my problem stems from my (mis)use of MinGW and/or improper DLL's (esp. glu32.dll, which XP cites as the "ModName" in it "Error signature").

Again, thank you very much, robosport, for taking the time to help me on this problem. I'll keep plugging away.

JeffBozeman

robosport

04-04-2004, 07:33 PM

Jeff,

My changes to the argv parameter were strictly related to the different parameters/types used by WinMain vs. main as the program's entry point.

I am dynamically linking to the standard glu32.dll that comes with XP Pro, and the glu32.lib import lib that comes with the compiler I'm using.

If changing the callback function declarations to CALLBACK had no effect, at least it helps narrow your search. Also, now you know the tesselation part of your code works.