/** * Constructor. * * @param gl the OpenGL interface * @param glResourceManager the resource manager * @param rect the position and size of the rectangle * @param color the colour of the rectangle */ public FlatRenderer( @Nonnull GL2 gl, @Nonnull GlResourceManager glResourceManager, @Nonnull Rect rect, @Nonnull Color color) { program = glResourceManager.getShaderManager().getProgram(FlatProgram.class); vertexArrayObject = new VertexArrayObject(gl); this.color = color; float[] positions = createPositions(rect); positionsBuffer = vertexArrayObject.addBuffer(gl, FlatProgram.POSITION_LOCATION, positions, 2); }