want 20k+ 2D polygons to be rendered in opengl with outline & fill
some polygons are concave
is it possible to do this using shaders?
thx!
want 20k+ 2D polygons to be rendered in opengl with outline & fill
some polygons are concave
is it possible to do this using shaders?
thx!
You don't need shaders for this:
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); //Fill
glDrawElements(...);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); //Outline
glDrawElements(...);
If the polygons are concave you'll have to tesselate them, either manually or using the gl utility library, glu. Look at gluNewTess. If you decide to tesselate the polygons yourself you'll have to remember to set the correct edge flags so that the interior edges of the tesselation aren't rendered, see glEdgeFlagPointer.
EDIT: I found the following link on how to use the stencil buffer to render concave polygons.