   cutPositions[cutPositionCount++] = cutPositions[0];
   for (int i = 0; i < cutPositionCount - 1; ++i)
   {
-    justEmit(matrix * center, vec4(0, 0, 1, 0.8));
-    justEmit(matrix * cutPositions[i], vec4(1, 0, 0, 0.8));
-    justEmit(matrix * cutPositions[i + 1], vec4(0, 1, 0, 0.8));
+    justEmit(matrix, center);
+    justEmit(matrix, cutPositions[i]);
+    justEmit(matrix, cutPositions[i + 1]);
     EndPrimitive();
   }
 }

vec4 cutPositions[18];
int cutPositionCount = 0;

void justEmit(vec4 pos, vec4 color)
{
  vertexPos = pos;
  gl_Position = vertexPos;
  vertexColor = color;
  EmitVertex();
}

int emit(vec4 pos, vec4 color, int emittedVertexCount)
{
  if (isFirst)
  {

      addCutPositionIfNew(newPos);
      //vec4 c = newPos * 0.5f + vec4(0.5, 0.5f, 0.5f, 0);
      // c.a = 0.5f;
      emittedVertexCount = emit(matrix, newPos, emittedVertexCount);
    }
  }

  if (emittedVertexCount == 5)
  {
    emit(matrix, firstPosition, emittedVertexCount);
  }

  EndPrimitive();
