I wrote this code that should produce indices which can be passed to opengl to draw any valid polygon. Problem is that I am not sure if infinite loop can happen with some weird