in case you haven't seen this before

Jan 19, 2006 23:38



void createVertices() {
int i;
vertices = (GLfloat**) malloc((m+1)*(n+1)*4*2*sizeof(GLfloat*));
for(i=0;i<(m+1)*(n+1)*4*2;i++) {
vertices[i] = (GLfloat*) malloc(3*sizeof(GLfloat));
vertices[i][0] = (GLfloat) ((((i%((m+1)*(n+1)*4))/4)%(m+1))
+((i%4)%2)*0.1);
vertices[i][1] = (GLfloat) ((((i%((m+1)*(n+1)*4))/4)/(m+1))
+((i%4)/2)*0.1);
vertices[i][2] = (GLfloat) ((i/((m+1)*(n+1)*4)));
//printf("vertex %d: %f %f %f\n",i, vertices[i][0], vertices[i][1], vertices[i][2]);
}
}
Previous post Next post
Up