Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Tessellation Memory access error.

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2008
    Posts
    4

    Tessellation Memory access error.

    I"m trying to use tesselator to draw my surfaces and am getting a memory access error on the "vertex[i] += weight[2]...." line.

    This occurs after about 100+ calls, so I'm a little confused. The malloc call is not failing. In looking at the disassembled code, it looks like it is a problem with vertex_data[2][i].

    I've copied the code from the red book example. I'm running on windows XP and Visual Studio 2005sp1.

    Any thoughts on where to check?

    Tom

    ---------------------------------------------------------------
    void CALLBACK cls_Pathview_DrawCube::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];
    for (i = 3; i < 6; i++)
    {
    vertex[i] = weight[0] * vertex_data[0][i];
    vertex[i] += weight[1] * vertex_data[1][i];
    <u> vertex[i] += weight[2] * vertex_data[2][i]; </u>
    vertex[i] += weight[3] * vertex_data[3][i];
    }
    *dataOut = vertex;
    }
    ---------------------------------------------------------------

  2. #2
    Junior Member Regular Contributor songho's Avatar
    Join Date
    May 2003
    Location
    Canada
    Posts
    247

    Re: Tessellation Memory access error.

    Make sure that "vertex_data" is 2D array and 6 elements for each vertex, for example, (x, y, z, r, g, b).

    I concern more on the deallocation of the local array variable, "vertex", in the combine callback function. How and when do you deallocate the memory from outside of this callback function?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •