halimtkl / beginning-android-games

Automatically exported from code.google.com/p/beginning-android-games
0 stars 0 forks source link

obj Object is looking weird #45

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What is the expected output? What do you see instead?
I'm trying to load an .obj Object with the Ch. 11 "GL- Advanced" obj loader. 
But the Object seems to miss some triangles. Do you know what will fix the 
problem?

I'm using this to draw the Object to screen:
cessna.draw(GL10.GL_TRIANGLES, 0, cessna.getNumVertices());

I attached a Screenshot from the Emulator. 

Original issue reported on code.google.com by der.appb...@googlemail.com on 27 Dec 2011 at 4:27

Attachments:

GoogleCodeExporter commented 8 years ago
You probably don't care anymore, but I just leave this here because I had the 
same problem.
In the *.obj file you downloaded are probably some faces declared like this:
f x/x/x /y/y/y z/z/z k/k/k
The object loader class can only handle triangles. So you have to format it to 
something like this:
f x/x/x y/y/y z/z/z
f k/k/k z/z/z x/x/x

You will still have problems with polygons that have more than 4 vertices.

Original comment by getha...@gmail.com on 18 Apr 2013 at 4:22