コード例 #1
0
  @Override
  protected void update(double time) {
    glClear(GL_COLOR_BUFFER_BIT);

    program.activate();

    // Bind to the VAO that has all the information about the vertices
    glBindVertexArray(vaoId);
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);

    // Bind to the index VBO that has all the information about the order of the vertices
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboiId);

    // Draw the vertices
    glDrawElements(GL_TRIANGLES, indicesCount, GL_UNSIGNED_BYTE, 0);

    // Put everything back to default (deselect)
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glBindVertexArray(0);

    Program.deactivate();
  }
コード例 #2
0
 @Override
 protected void dispose() {
   program.destroy();
   Program.deactivate();
 }
コード例 #3
0
 private void setupShaders() {
   program = new Program();
   program.attach(new PassThruVertexShader());
   program.attach(new PassThruFragmentShader());
   program.arm();
 }