예제 #1
0
  private boolean initVertexArray(GL4 gl4) {

    gl4.glGenVertexArrays(1, vertexArrayName, 0);

    gl4.glBindVertexArray(vertexArrayName[0]);
    {
      gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName[Buffer.F64.ordinal()]);
      gl4.glVertexAttribLPointer(Semantic.Attr.POSITION, 3, GL_DOUBLE, 3 * Double.BYTES, 0);
      gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);

      gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
    }
    gl4.glBindVertexArray(0);

    return checkError(gl4, "initVertexArray");
  }
  private boolean initVertexArray(GL4 gl4) {

    boolean validated = true;

    gl4.glGenVertexArrays(1, vertexArrayName);
    gl4.glBindVertexArray(vertexArrayName.get(0));
    {
      gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX));
      gl4.glVertexAttribPointer(Semantic.Attr.POSITION, 2, GL_FLOAT, false, 2 * Vec2.SIZE, 0);
      gl4.glVertexAttribPointer(
          Semantic.Attr.TEXCOORD, 2, GL_FLOAT, false, 2 * Vec2.SIZE, Vec2.SIZE);
      gl4.glBindBuffer(GL_ARRAY_BUFFER, 0);

      gl4.glEnableVertexAttribArray(Semantic.Attr.POSITION);
      gl4.glEnableVertexAttribArray(Semantic.Attr.TEXCOORD);

      gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
    }
    gl4.glBindVertexArray(0);

    return validated;
  }