PDA

View Full Version : about normal again



zydgyy
12-05-2011, 08:46 PM
Hi,
if i want to assign a normal to a triangle,then,


glBegin(GL_TRIANGLES);
for (i = 0; i < 20; i++) {
glNormal(normals[i]);
glVertex3fv(&amp;vdata[tindices[i][0]] [0]);
glVertex3fv(&amp;vdata[tindices[i][1]] [0]);
glVertex3fv(&amp;vdata[tindices[i][2]] [0]);
}
glEnd();

and,if i want use indexd array,then i have to have normals array with same size as vertices array!I have a little confused,are these normals redundant ??

tksuoran
12-06-2011, 02:26 AM
From GPU point of view, per vertex attributes are required, and as such they are not redundant. If you use begin-end, driver (software) will perform duplication for you. If you use index array, you have to do duplication yourself. So modern OpenGL API more closely matches the current GPU.