Vertex Arrays and Normals

Simple Question:

Using Vertext Arrays, I can send 8 vertices and 36 indexes to render a cube without lighting. If I want to light the cube, do I need to send 24 vertices and 24 normals and 36 indexes?

Thank you for any info

Whichever way you choose to render an object, for VA’s you will have 1 normal per vertex, 1 tex coord (Tex Unit 0) per vertex, etc

Right now you have chosen not to share vertices across faces, so normal interpolation is not what you want Im assuming.

PS: accelerating cubes was actually suggested in opengl in the suggestions section. Shot dead on the spot!

V-man

I would like to share vertices across faces, but the shared vertex would have a different normal for each face. How can I share vertexes across faces and still have the proper normal used?

Thanks again for your help

You can’t.
You’ll have to have duplicate vertices.

Thats what I was afraid of.

I am loading a .3ds file that stores shared vertices along with the face indexes. It does not store the normals, so to render it I was going to “unshare” the vertices, generate the normals, and send everything in an expanded form. Is there any way to have OpenGL calculate the normals for me automaticially? That way I will only send the shared vertices and the indexes?

Thanks again for any help

My question really is do I have to specify vertex normals to use lighting?

as lighting depends on the surface normal of each pixel (or in gl of each vertex), yes

don’t be afraid of it…

For organic models (smooth surfaces) you will probably want to average normals for a shared vertex of neighboring sufaces.

For non-organic models (a cube), you will be forced to duplicate vertices.

Maybe Studio Max has some output feature for “unsharing vertices”???

V-man