I am working on an object (OBJ File) loader for my app on iOS, currently I have successfully read the vertices and the faces of the object, and I am now just adding colours to the imported models.

I am coming across a major problem now. Out of a cube with six faces, all coloured red apart from two opposite faces which are coloured blue. This cube is set to rotate so I can see all sides, but the colours do not appear correctly as shown in the video below:


The blue faces only shows when the two blue sections overlap, I cannot figure out why - I am used to OpenGL for PC, is there something I am missing which is causing this strange colouring?

The colouring is achieved by sending a large float array of the format RGBA RGBA RGBA etc for each vertex;

// colours is the name of the array of floats
glColorPointer(colorStride, GL_FLOAT, 0, colors);   
glDrawArrays(renderStyle, 0, vertexCount);

Any help you can offer would be great,


Even if you don't know the problem, but have seen this before and know what it may be that would help as I have no idea where to even start looking as it is!

Many thanks

  • 1
    \$\begingroup\$ Do you have depth buffering enabled? \$\endgroup\$ Sep 27, 2011 at 4:38
  • \$\begingroup\$ Thanks for your comment, I have a working program now! I did enable depth buffering, but it caused the screen to go blank - I made two changes - drew each face with a separate call to glDrawArrays. And also changed how I culled the faces :) \$\endgroup\$
    – Paul Reed
    Sep 27, 2011 at 19:09
  • \$\begingroup\$ You definitely should not need to render each face separately, but if you're happy with the result, that's probably all that matters. \$\endgroup\$ Sep 28, 2011 at 5:37
  • \$\begingroup\$ Yes it is now causing another problem, rendering each face makes colouring the vertices difficult. This is something I will take a look at and try to solve tomorrow but I may be back on here soon! \$\endgroup\$
    – Paul Reed
    Sep 28, 2011 at 17:07
  • \$\begingroup\$ @JariKomppa I looked into the issue at more detail and I have now got it drawing all faces from a single call, thanks for pointing out that it should work as it now means I can colour each vertex individually! \$\endgroup\$
    – Paul Reed
    Sep 28, 2011 at 19:57

1 Answer 1


It looks like your face normals are pointing to the wrong side. Change the triangle winding order on your loader or set a different glCullMode when rendering.

  • \$\begingroup\$ Yes. I also think, there could be some problem with vertices order - are all of them entered in the same direction (CCW or CW)? \$\endgroup\$
    – zacharmarz
    Sep 27, 2011 at 9:21
  • \$\begingroup\$ Hi @r2d2rigo I solved the problem at Uni earlier today, and one of the problems was to do with the culling, so if I had not have done it earlier this would have been a big help! :) \$\endgroup\$
    – Paul Reed
    Sep 27, 2011 at 19:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .