0

I'm trying to fill and outline the shape below. I do this with a combination of GL_LINES and GL_TRIANGLE_STRIP.

Everything looks fine from the top-side.

However, when tilting the model to see underneath, the filled triangle strip does not follow the shape on the top. It doesn't show the "well" where the corresponding bulge is on the top-side. Instead, the fill appears "flat" on the y-plane.

Even though the polygons are not "crossing over themselves", is this the common OpenGL concavity issue??

Or, should it be possible to see the "well" underneath as one would expect?

Top View

Top View

Bottom View (with z-fighting between the black fill and GL_LINES, cannot see inside the "well")

Bottom View

My drawing code:

m_vao.bind();

glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0, 1.0);
glDrawArrays(GL_TRIANGLE_STRIP, m_lineCount, m_vertexArray.size()-m_lineCount);
glDisable(GL_POLYGON_OFFSET_FILL);

glDrawArrays(GL_LINES, 0, m_lineCount);

m_vao.release();
Alchete
  • 1,629
  • 2
  • 18
  • 29
  • Why does every OpenGL question get instant downvotes with no comments?? For shame on S.O. – Alchete May 01 '15 at 18:50
  • 1
    I actually could not understand what cause the black part on the second image. Maybe problem is you are drawing the black surface and green wireframe very close that zbuffer confuses. If so, you can give "y" coordinate of black surface "-0.1". Or maybe you have culling issue. – Berke Cagkan Toptas May 01 '15 at 20:22
  • Thanks Cagkan. I guess my main question is: should a triangle strip allow you to see both above and underneath a "mountain" shape, such that underneath you see the "empty well"? Or, is this an OpenGL limitation of "convex" objects? – Alchete May 01 '15 at 20:58
  • 2
    Yes you should see both side of your triangle strip (if you did not enable face culling). – Berke Cagkan Toptas May 01 '15 at 21:06
  • 1
    I'd guess that you have back face culling on and have issues with consistent vertex order: take a look at your top picture, there you can see that "mountains" are not transparent, while "wells" are (you can see wireframe through "well" but not through "mountain"). – n0rd May 01 '15 at 22:38

0 Answers0