Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Normal Vector with load Wavefont Obj

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2014
    Posts
    5

    Normal Vector with load Wavefont Obj

    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
    Click image for larger version. 

Name:	Untitled.jpg 
Views:	328 
Size:	6.2 KB 
ID:	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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,408
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2014
    Posts
    5
    Quote Originally Posted by GClements View Post
    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •