I’m working on obj loader. I want to draw an object using glDrawElements (smooth shading). Here are my assumptions:
- the number of normals <= the number of vertices (I don’t need to average normals, only arrange them with relation to vertices indices using normal indices before sending to a gpu. Then the number of normals = the number of vertices)
- the number of normals > the number of vertices ( It indicates that I need to average normals (according to smoothing groups if present) and arrange them with relation to vertices indices using normal indices before sending to a gpu. Then the number of normals = the number of vertices)
- the number of tex coords <= the number of vertices (I need to arrange tex coords with relation to vertices indices using tex coords indices before sending to a gpu. Then the number of tex coords = the number of vertices)
- the number of tex coords > the number of vertices - In this case I can’t use glDrawElements so I process normals as above and then arrange vertices, normals and tex coords using their indices. Data will be properly duplicated and then I will have to use glDrawArrays.
Please verify my assumptions and let me know whether I’m right or wrong.