PDA

View Full Version : glDrawElements crashes my program



Ehsan Kamrani
09-12-2005, 10:47 PM
Hi there
I use from the cal3D API to load the 3D models with their keyframes. this API finds the vertex data, normal data , texture coordinate data and face indices. But when i want to draw the faces with the following code, it produces a run-time error:
if( sizeof( CalIndex ) == 2 )
{
glDrawElements( GL_TRIANGLES, faceCount * 3, GL_UNSIGNED_SHORT, &meshFaces[0][0] );
}
else
{
glDrawElements( GL_TRIANGLES, faceCount * 3, GL_UNSIGNED_INT, &meshFaces[0][0] );
}

Why does *glDrawElements* crash my program?
-Ehsan-

mikael_aronsson
09-13-2005, 02:07 AM
Hi !

I guess there are two things that could do it, you have some kind of bug in your OpenGL driver but then other applications should crash also, the other alternative is that you pass incorrect data to the function, the code in the message only shows the actual call so it is difficult to answer more detailed on that.

Mikael

Ehsan Kamrani
09-13-2005, 03:44 AM
Hi
I solved that problem. Now the human is walking in the scene:)
-Ehsan-