sa0sin
11-27-2011, 10:09 AM
hi, i'm a noob to opengl but i have to do operations without openGL help. so far, i've made shapes, rotation/translation/scaling of my custom 3d shapes and now i need to do lighting and i am stuck at normalizing. i can tell that my lighting works because i added a glutSolidTeapot to my scene and it has some smooth lighting on it while my custom shapes are just all white.
i have my vertices stored like this:
verts[i][j][0] = some val for x equation
verts[i][j][1] = some val for y equation
verts[i][j][2] = some val for z equation
verts[i][j][3] = 1 for homogenous
and my shapes work. now, i don't know how to normalize them. i think i understand that you use the cross product and then normalize but i don't understand how to make the cross product for my vertices. i have them as "quads" not triangles if that means anything. any help on how to normalize with the way my vertices are stored would be appreciated
i have my vertices stored like this:
verts[i][j][0] = some val for x equation
verts[i][j][1] = some val for y equation
verts[i][j][2] = some val for z equation
verts[i][j][3] = 1 for homogenous
and my shapes work. now, i don't know how to normalize them. i think i understand that you use the cross product and then normalize but i don't understand how to make the cross product for my vertices. i have them as "quads" not triangles if that means anything. any help on how to normalize with the way my vertices are stored would be appreciated