PDA

View Full Version : normal vectors



kalkas
07-26-2011, 12:03 PM
hi

i have a question about normal vectors. i'm currently trying
to write a library that uses opengl. i choose buffer objects
to store my models. now i decided to add light, so i needed
normal vectors. i made an attempt and i didn't like the result.
so i sat down and started to thinking. with the buffer objects you can define one normal vector for each vertex. i figured that this is not going to work. to draw a cube, for each vertex
you need three normals, by logic, one for each side. i
opened 3ds max to check and it is like that. am i wrong?
how can i achive this in openGL?

thanks

BionicBytes
07-26-2011, 12:13 PM
Ensure you have enough verticies.
Therefore each face of the cube should have it's own set of vertex and normals in the buffer object. It's more verticies than theoretically needed, but is the only way you can achive this in OpenGL so that you have the correct normals at each vertex.

kalkas
07-26-2011, 12:34 PM
really?
is this the most common technique? and for the large models?
i imagine this will affect the memory and not the performance,
correct?

Zyx_2000
07-26-2011, 02:56 PM
For large models, you don't usually have many sharp corners like in a cube. So there's no need to duplicate most of the vertices.