PDA

View Full Version : glLightModelfv crashes in vtkOpenGLRenderer



vlibertiaux
03-01-2011, 03:32 PM
Dear all,

First of all, I want to tell you that I posted the same issue on the vtk forum but was unsuccessful getting an answer.

I "inherited" a vtk project (understand: I didn't code it) and I try to make it work on my Mac Pro equipped with a ATI Radeon HD 5870 (if relevant).

Inside the vtkOpenGLRenderer class, the function glLightModelfv crashes the program systematically.
The error message is as follows:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff8145c68d in glLightModelfv ()

The same program, compiled with the same compiler and the same version of vtk works fine on my laptop running Ubuntu 10.04 (the graphic card is a NVIDIA).

Do you have any idea why the function causes crashes on the mac ?

I thank you very much in advance for your help.

Best regards,

Vincent

ZbuffeR
03-01-2011, 04:38 PM
Second parameter of glLightModelfv must be a pointer to valid memory. The error message you get is when you pass a NULL (=0) pointer, which is a special marker for not usable memory.
Going earlier in your program, try to print the value of the pointer (and the value of memory it points to), to find why it is not properly initialised.

vlibertiaux
03-01-2011, 04:47 PM
Hi ZbuffeR,

thank you for your reply.
I tried to do as you say before posting.
For info, here is the code: http://codepad.org/yyCup7Sv

So the second parameter is initialised. I printed the value of its address and it seemed ok.

I finally got an answer on the vtk forum, telling me that it should work. Well, it does not ... :) Not on the mac but I don't have this problem with Ubuntu.

Any other idea ?

Once again, thank you for your reply,

Best regards,

V.

ZbuffeR
03-01-2011, 05:28 PM
Curious.
What does it says where compiled in debug, on the debugger, step by step ? Anything that can help to pinpoint the exact cause of the error with more precision ?

vlibertiaux
03-01-2011, 05:50 PM
OK...

The problem, once again, was between the keyboard and the chair...
The guy who coded this portion used a function he should not have.

Thank you very much for you interest and your help.

Best regards,

V.