Search code examples
openglwavefront

Why there are still many wavefront obj files containing 4 vertices in one face?


Today, I started to implement a wavefront obj loader and the thing is that I don't know why there are so many obj files on the internet containing 4 vertices despite the fact that OpenGL no longer supports GL_QUADS and deprecates its use.

Is there any workaround on this? I mean, everytime I try to draw a face containing 4 vertices using GL_TRIANGLE_FAN or GL_TRIANGLE_STRIP, it shows tragic result. So in the end I have no option but to issue draw command on each face and as you know, it shows bad performance. I want to draw it issuing only one command on each group or smoothing group.

Any ideas?


Solution

  • If you have a modelling program that can open/export objs like Maya or Blender, I'd recommend opening the model there, triangulating it using the appropriate menu option, and then re-exporting it.

    If you don't have access to any of those, it should be relatively simple to write a program that reads in the obj data, triangulates it, and writes it to a file. You'll need a bit of a deeper understanding of the obj format, but it won't require any additional software.