Esempio n. 1
0
  public void renderBuffer(OpenGLBuffer buffer, ITextureObject texture) {
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + 0);
    texture.bind();
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glEnableVertexAttribArray(2);

    glBindBuffer(GL_ARRAY_BUFFER, buffer.getVboID());
    glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SIZE_IN_FLOATS * 4, 0);
    glVertexAttribPointer(1, 2, GL_FLOAT, false, Vertex.SIZE_IN_FLOATS * 4, 12);
    glVertexAttribPointer(2, 3, GL_FLOAT, false, Vertex.SIZE_IN_FLOATS * 4, 20);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer.getIboID());
    glDrawElements(GL_TRIANGLES, buffer.getIndicesCount(), GL_UNSIGNED_INT, 0);

    glDisableVertexAttribArray(2);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(0);
  }