Simple triangle isn't display using JOGL

I’m using JOGL from JogAmp to display a simple triangle in OpenGL, converting code from c++ to java with minor modifications following this tutorial. No errors, expecting a white triangle but the window is just pitch black.

This is the display and reshape overridden functions in my class that implements GLEventListener:

public void display(GLAutoDrawable drawable)

    float[] vertices =
        0.0f, 0.5f, 0.0f,
        -0.5f, -0.5f, 0.0f,
        0.5f, -0.5f, 0.0f

    final GL4 gl = drawable.getGL().getGL4();
    FloatBuffer vertexBuffer = Buffers.newDirectFloatBuffer(vertices);
    int[] ids = new int[1];
    // 0: vertex buffer ID

    gl.glGenBuffers(1, ids, 0);
    gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, ids[0]);
    gl.glBufferData(GL4.GL_ARRAY_BUFFER, vertices.length * Buffers.SIZEOF_FLOAT, vertexBuffer, GL4.GL_STATIC_DRAW);
    gl.glVertexAttribPointer(0, 3, GL4.GL_FLOAT, false, 0, 0);
    gl.glDrawArrays(GL4.GL_TRIANGLES, 0, 3);

public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
    final GL4 gl = drawable.getGL().getGL4();

    gl.glViewport(x, y, width, height);