PDA

View Full Version : glMaterial is causing crash



Hylke Donker
05-29-2005, 07:22 AM
Hello
I'm currently into 3ds models.
So I've tried to create a file that looked similar to player.c(the example of lib3ds).
But I'm getting a segmentation fault when I call glMaterialfv()
Here's a piece of my renderNode function:


#0 0x40e7e3d4 in _nv001079gl () from /usr/lib/libGLcore.so.1
#1 0x4190a040 in ?? ()
#2 0x00000030 in ?? ()
#3 0x00000018 in ?? ()
#4 0x00001201 in ?? ()
#5 0x40e0c347 in ?? () from /usr/lib/libGLcore.so.1
#6 0x08101d88 in ?? ()
#7 0x00000030 in ?? ()
#8 0x00000000 in ?? ()
#9 0x4190a040 in ?? ()
#10 0x00000010 in ?? ()
#11 0x08062588 in ?? ()
#12 0x000000dc in ?? ()
#13 0x0804b1b8 in ?? ()
#14 0x40ae8a48 in ?? () from /usr/lib/libGL.so.1
#15 0x00000000 in ?? ()
#16 0x00000000 in ?? ()
#17 0x40f12fd2 in _nv000812gl () from /usr/lib/libGLcore.so.1
#18 0x0815c750 in ?? ()
Is it a problem in my driver or in my code, I gues it's the last but you never can be sure enough.
And if it's a problem in my code, how can I fix it?
Thanx Hylke

jide
05-29-2005, 08:02 AM
First of all, I wonder how far it is an advanced topic.

I'd like to help you, I use lib3ds too, under linux. Your code seems well, but I guess there are some 'hidden' mistakes in it.

This is not a problem due to your driver or even neither lib3ds. That's clear for me.

With the errors you mentionned, I just can advise you to check all your pointers and allocation.

Hope that can help.

Hylke Donker
05-29-2005, 08:12 AM
Thank you for your reply.
About how advanced this topic is: I gues it isn't that advanced, but I thought I would have a better chance on a good answere on the advanced forum than the beginners forum.

And about the pointers:
Could this be the problem:

Lib3dsVector *normals;
(float*)normals = new Lib3dsVector;?
Cus the original code did not work for me, with a c++ compiler.

jide
05-30-2005, 03:01 AM
This line is strange anyway. Here is how I do it:


Lib3dsVector *normals = static_cast<float(*)[3]> (std::malloc (3*sizeof(Lib3dsVector)*mesh->faces));

Hylke Donker
05-30-2005, 11:58 PM
Thanx.
It now no longer crashes.
The only thing left for now is to try finding the model :-p
Hylke