PDA

View Full Version : Normal Vector with load Wavefont Obj



nguyenkim495
05-20-2015, 01:08 AM
Hi Everyone, I'm Asian and I not good English! But I have a problem with Normal vector when I read and load model into program
1819
Above is program that I load model form .obj file. I export it from Blender. I read v, vt, vn, f, and I draw with mode GL_TRIANGLES. But it is'nt true. The model seems enough v, vt, vn and three v/vt/vn each face. Seem my problem is Normal vector!
So, please tell me why? And help me :(

GClements
05-20-2015, 07:12 AM
If you're using glDrawElements(), it uses a single index to specify the vertex position, normal and texture coordinates. The OBJ format has a separate index for each attribute, so you either need make each vertex unique, or at least only share vertices when all of their attributes are identical.

Also, bear in mind that the OBJ face specification uses 1-based indices, whereas C and OpenGL uses 0-based indices.

nguyenkim495
05-21-2015, 08:01 AM
If you're using glDrawElements(), it uses a single index to specify the vertex position, normal and texture coordinates. The OBJ format has a separate index for each attribute, so you either need make each vertex unique, or at least only share vertices when all of their attributes are identical.

Also, bear in mind that the OBJ face specification uses 1-based indices, whereas C and OpenGL uses 0-based indices.

Thank GClements!