コード例 #1
0
ファイル: PointCloud.java プロジェクト: NLeSC/asterisk
  public void draw(GL3 gl, ShaderProgram program) {
    vbo.bind(gl);

    program.linkAttribs(gl, vbo.getAttribs());

    gl.glDrawArrays(GL3.GL_POINTS, 0, numParticles);
  }
コード例 #2
0
  @Override
  public void display(GLAutoDrawable glad) {
    System.out.println("display");

    GL3 gl3 = glad.getGL().getGL3();

    gl3.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    gl3.glClear(GL3.GL_COLOR_BUFFER_BIT);

    programObject.bind(gl3);
    {
      programObject.setUniform(gl3, "offset", new float[] {0.5f, 0.5f}, 2);

      gl3.glBindBuffer(GL3.GL_ARRAY_BUFFER, vertexBufferObject[0]);

      gl3.glEnableVertexAttribArray(0);
      gl3.glEnableVertexAttribArray(1);
      {
        gl3.glVertexAttribPointer(0, 4, GL3.GL_FLOAT, false, 0, 0);
        gl3.glVertexAttribPointer(1, 4, GL3.GL_FLOAT, false, 0, 36 * 4 * 4);

        gl3.glDrawArrays(GL3.GL_TRIANGLES, 0, 36);
      }
      gl3.glDisableVertexAttribArray(0);
      gl3.glDisableVertexAttribArray(1);
    }
    programObject.unbind(gl3);

    glad.swapBuffers();
  }