PDA

View Full Version : GL_TRIANGLE_STRIP looking underneath



Alketi
05-01-2015, 07:15 AM
Hi,

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

Everything looks fine from the top-side.

However, underneath, the triangle strip does not follow the shape on the top. Instead, it only shows the bulges underneath, not the concavity on the top. Even though the polygons are not "crossing over themselves", I'm still assuming this is the common OpenGL concavity issue??

1769 1770

Questions:

1. Should what I'm attempting be possible with triangle strips? [This didn't seem to me to be a case of triangles crossing, so I'm hoping I just have an error in my drawing algorithm.]

2. Is there a better way to fill and outline a shape that has simple curves, such as this?



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();