Android 3D Item not well displayed

Hi there,

I’m quite new to OpenGl and i’m a bit stuck right now …

I’m working on an Android project using the Vuforia AR Framework and I’m trying to draw
a 3D object from a .obj file .To test, i use the following obj file :

# diamond.obj

g Object001

v 0.000000E+00 0.000000E+00 78.0000
v 45.0000 45.0000 0.000000E+00
v 45.0000 -45.0000 0.000000E+00
v -45.0000 -45.0000 0.000000E+00
v -45.0000 45.0000 0.000000E+00
v 0.000000E+00 0.000000E+00 -78.0000

f     1 2 3
f     1 3 4
f     1 4 5
f     1 5 2
f     6 5 4
f     6 4 3
f     6 3 2
f     6 2 1
f     6 1 5

So, what i do is parsing this file and putting datas into the corresponding variables in my Android program.

Here is the piece of code used to draw the shape :

                GLES20.glVertexAttribPointer(vertexHandle, 3, GLES20.GL_FLOAT,
                        false, 0, _modele3D.getVertices());                                
                GLES20.glVertexAttribPointer(textureCoordHandle, 2,
                        GLES20.GL_FLOAT, false, 0,                                        
                GLES20.glUniformMatrix4fv(mvpMatrixHandle, 1, false,
                        modelViewProjection, 0);
                GLES20.glUniform1i(texSampler2DHandle, 0);
                GLES20.glDrawArrays(GLES20.GL_TRIANGLE_FAN, 0,

_modele3D.getVertices() returns an array containing the vertices read in my obj file
_modele3D.getTextCoords() returns an array containing the texture coords read in my obj files
(even if it’s not true in the piece of code written here, in my app i made a test to avoid using a null texture array)

The problem i’m having is that all the faces of my 3D objects are not drawn …

Only half of them are drawn …

Tell me if you have ideas to help me !


Hi there,

I’m still stuck at the same point…

I come to you to show you what my problem is, with pictures this time : maybe could it help you understand it :slight_smile:

Here is the original one :

And here is what is displayed :

I don’t think that he texture I put on it is linked to my problem.

Thank you,

Few hints:

  • Your original model file uses face indices, but you don’t in your code. So maybe something went wrong going from indices into without.
  • From your model file, nothing means that you use triangle fans. So certainly you are using simple triangles.
  • Or _modele3D.getNumObjectVertex() might be calculating wrong

I would first go for my second option.