C++ – how to draw polygons in OpenGL that have an outline drawn with a black pen and another fill color

cdrawopenglpolygonvisual studio 2010

How can I draw a shape like this in OpenGL?

enter image description here
I mean, I know how to draw polygons in OpenGL. I want to know how to make the outline black and the fill color ( for example ) yellow?

Best Answer

You have 5 vertices. Draw a GL_POLYGON with them and then then a GL_LINE_LOOP.

Note that GL_POLYGON is only valid for convex polygons.