Exemple #1
0
 /**
  * Detaches all shader codes and deletes the program. If <code>destroyShaderCode</code> is true it
  * destroys the shader codes as well.
  */
 public synchronized void release(GL2ES2 gl, boolean destroyShaderCode) {
   useProgram(gl, false);
   for (Iterator<ShaderCode> iter = allShaderCode.iterator(); iter.hasNext(); ) {
     ShaderCode shaderCode = iter.next();
     if (attachedShaderCode.remove(shaderCode)) {
       ShaderUtil.detachShader(gl, shaderProgram, shaderCode.shader());
     }
     if (destroyShaderCode) {
       shaderCode.destroy(gl);
     }
   }
   allShaderCode.clear();
   attachedShaderCode.clear();
   if (0 != shaderProgram) {
     gl.glDeleteProgram(shaderProgram);
     shaderProgram = 0;
   }
 }
Exemple #2
0
 /**
  * Deletes the program, and resets this object to the way it was before {@link #begin(GL2ES2)} was
  * first called.
  *
  * <p>This object can be safely reused after being disposed, but in most cases there is no
  * significant advantage to doing so.
  */
 public void dispose(GL2ES2 gl) {
   if (this.handles != null) {
     gl.glDeleteProgram(this.handles.program);
     this.handles = null;
   }
 }