Question

I understand that there has to be some index magic to get an obj file into the correct vertex/index format for OpenGL, but consider the following .obj file:

# WaveFront *.obj file (generated by CINEMA 4D)

g Polygon
v -136.714894 0 -169.395745
v 134.53617 0 -224.953191
v 321.906383 0 -87.693617
v 358.944681 0 182.468085
v 49.565957 0 264.170213
v -340.425532 0 165.038298

f 6 5 4 3 2 1 

The face is not a triangle or quad, does this mean I'll have to do some sort of tessellation on the cpu or gpu? Would that be the standard method for dealing with that type of geometry description?

EDIT: In addition, is there a library that will do triangulation that is not restrictively licensed?

Was it helpful?

Solution

Hope they are planar polygons and triangulate via your preferred method.

If they aren't planar then you might get away with PCAing a dimension off and triangulating the result.

OTHER TIPS

It depends on your polygon. OpenGL does have a function for drawing polygons rather than quads or tris or strips and such. However, the polygon needs to be a convex polygon. Otherwise you'll need to tessellate.

If you're using fixed function, it's "glBegin(GL_POLYGON)"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top