Hi
Here is a strange one.
I am developing a iPhone 3D engine and have a question about the normal pointer array.
If I create an array that is the same size as the vertex array then my app crashes. If I make it double the size then all is OK. Can anyone explain this behaviour?
…
vertices = new GLfloat[numvertices * 3];
normals = new GLfloat[numvertices * 6];//Using 3, 4 or 5 the app crashes
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_NORMAL_ARRAY );
glVertexPointer( 3, GL_FLOAT, 0, vertices );
glNormalPointer( GL_FLOAT, 0, normals );
…
…
vertices[id] = pt->x; vertices[id] = pt->x; vertices[id] = pt->x;
normals[id] = normal->x; normals[id] = normal->x; normals[id] = normal->x;
id += 3;
…
…
glDrawArrays( GL_TRIANGLES, 0, id );
Cheers Nik