GLTessellator crashing

Posted by user146780 on Stack Overflow See other posts from Stack Overflow or by user146780
Published on 2010-05-24T01:29:10Z Indexed on 2010/05/24 1:30 UTC
Read the original article Hit count: 377

Filed under:
|
|
|

I'v followed a tutorial to get the GLU tesselator working. It woulds except the interpolation for colors of new points causes a crash (error reading from memory...)

This is my callback where it crashes:

void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],
                              GLfloat weight[4], GLdouble **dataOut)
{
    GLdouble *vertex;
    int i;

    vertex = (GLdouble *) malloc(6 * sizeof(GLdouble));
    vertex[0] = coords[0];
    vertex[1] = coords[1];
    vertex[2] = coords[2];

    //crashes here
    **for (int i = 3; i < 6; i++)
    {
        vertex[i] = weight[0] * vertex_data[0][i] +
            weight[1] * vertex_data[1][i] +
            weight[2] * vertex_data[2][i] +
            weight[3] * vertex_data[3][i];
    }**
    //crashes here

    *dataOut = vertex;

}

I looked at memory when it crashes but can't put my finger on exactly what triggers it. I followed this tutorial: http://www.flipcode.com/archives/Polygon_Tessellation_In_OpenGL.shtml

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about c