reset password
Author Message
BryanYeh
Posts: 38
Posted 17:01 May 15, 2014 |

For lab 8, when I try create a side face (something like the code below)

face[0].vert[0].vertIndex = 1;

when I try to run it after pressing 'm', it gives an error 

Access violation writing location 0x00000000.

Does anyone know what might be causing this? If somehow my code is wrong please tell me.

Last edited by BryanYeh at 17:12 May 15, 2014.
ljuster2
Posts: 19
Posted 17:31 May 15, 2014 |
Not sure if this is related, but I had to initialialize my faces as arrays of whatever the faces were made of. face[i] = new (DONT REMEMBER OFF THE TOP OF MY HEAD)[ ];
BryanYeh
Posts: 38
Posted 17:41 May 15, 2014 |

Aren't all the things we need already defined in the mesh.h? I don't see how initializing the faces as arrays will do anything different.

cliffordtzlin
Posts: 11
Posted 18:24 May 15, 2014 |

You need to initialize the pointer to the array of objects. 

Inside the function mesh

pt = new Point3[numVerts];
    norm = new Vector3[numNormals];
    face = new Face[numFaces];

all of the arrays are initialized before they are used

Last edited by cliffordtzlin at 18:26 May 15, 2014.
BryanYeh
Posts: 38
Posted 18:42 May 15, 2014 |

K, i see. 

I think I got it now. Thanks for replying.