Jump to content

  • Log In with Google      Sign In   
  • Create Account


in a wavefront object file (.obj) how am i supposed to render faces with more than 4 vertices in opengl?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 blackknight467   Members   -  Reputation: 100

Like
0Likes
Like

Posted 05 February 2012 - 03:26 AM

So using a wavefront object file as defined here: http://en.wikipedia.org/wiki/Wavefront_.obj_file
how am i supposed to render faces that have more than 4 vertices in opengl.

I undertand that if it have 3 vertices i use GL_TRIANGLES, if it has 4 i use GL_QUADS, but if it has 5 or more, what am i supposed to use? Is there a standard? in my internet search i haven't been able to come up with anything and samples open gl code i've found only support up to 4 vertices.

I created an object file by exporting from google sketchup and many of the faces have more than 4 verticies, is there a tool or another modeling program i can / should be using?

Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 7774

Like
0Likes
Like

Posted 05 February 2012 - 04:34 AM

The correct OpenGL primitive is a triangle fan or a polygon, but the correct way to handle it is to split it into a sequence of triangles. Then you can put the whole object into a vertex array and handle it much more efficiently.

#3 babarorhum   Members   -  Reputation: 100

Like
0Likes
Like

Posted 05 February 2012 - 04:50 PM

Hello,
Have you considered using Blender 3D for your project ? or do you have a hard requirement to use Google Sketchup ?

From my fresh experience in Blender 3D (and as matter of fact OpenGL ES), i found it quite easy to pick, free and supported by a wide and helpful community; and most important doing the OBJ export job quite well. There are couple of operations to do on your modeled objects before exporting them but it is no rocket science.

Cheers,
Stéphane




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS