Exemple #1
0
  public void begin(GL2ES2 gl) {
    if (this.handles == null) {
      this.handles = new LineProgramHandles(gl);
    }

    gl.getGL3().glBindVertexArray(GLUtils.defaultVertexAttributeArray(gl));
    gl.glUseProgram(this.handles.program);
    gl.glEnableVertexAttribArray(this.handles.inXy);
    gl.glEnableVertexAttribArray(this.handles.inFlags);
    gl.glEnableVertexAttribArray(this.handles.inMileage);
    gl.glEnableVertexAttribArray(this.handles.inRgba);
  }
Exemple #2
0
  private final void relocateAttribute(GL2ES2 gl, GLArrayData attribute) {
    // get new location ..
    final String name = attribute.getName();
    final int loc = getAttribLocation(gl, name);
    attribute.setLocation(loc);

    if (0 <= loc) {
      if (isVertexAttribArrayEnabled(name)) {
        // enable attrib, VBO and pass location/data
        gl.glEnableVertexAttribArray(loc);
      }

      if (attribute.isVBO()) {
        gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName());
        gl.glVertexAttribPointer(attribute);
        gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
      } else {
        gl.glVertexAttribPointer(attribute);
      }
    }
  }
Exemple #3
0
 private boolean enableVertexAttribArray(GL2ES2 gl, String name, int location) {
   activedAttribEnabledMap.put(name, Boolean.TRUE);
   if (0 > location) {
     location = getAttribLocation(gl, name);
     if (0 > location) {
       if (verbose) {
         System.err.println(
             "ShaderState: glEnableVertexAttribArray failed, no index for: " + name);
         if (DEBUG) {
           Thread.dumpStack();
         }
       }
       return false;
     }
   }
   if (DEBUG) {
     System.err.println("ShaderState: glEnableVertexAttribArray: " + name + ", loc: " + location);
   }
   gl.glEnableVertexAttribArray(location);
   return true;
 }