@@ -0,0 +1,943 @@
+package org.helioviewer.jhv.opengl;%0A%0Aimport java.nio.FloatBuffer;%0A%0Aimport org.helioviewer.jhv.base.BufferUtils;%0A%0Aimport com.jogamp.opengl.GL2;%0A%0Apublic class GLShapeHelper %7B%0A%0A    private final FloatBuffer positionBuffer;%0A    private final FloatBuffer colorBuffer;%0A    private final float%5B%5D color;%0A%0A    public GLShapeHelper(int vertices, float%5B%5D _color) %7B%0A        positionBuffer = BufferUtils.newFloatBuffer(4 * vertices);%0A        colorBuffer = BufferUtils.newFloatBuffer(4 * vertices);%0A        color = _color;%0A    %7D%0A%0A    public void addVertex(double x, double y, double z) %7B%0A        BufferUtils.put4f(positionBuffer, (float) x, (float) y, (float) z, 1);%0A        colorBuffer.put(color);%0A    %7D%0A%0A    public GLShape getShape(GL2 gl) %7B%0A        GLShape shape = new GLShape();%0A        shape.init(gl);%0A        positionBuffer.rewind();%0A        colorBuffer.rewind();%0A        shape.setData(gl, positionBuffer, colorBuffer);%0A        return shape;%0A    %7D%0A%0A%7D%0A

Factor out boilerplate