Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.GL20


  }

  /** Makes OpenGL ES 2.0 use this vertex and fragment shader pair. When you are done with this shader you have to call
   * {@link ShaderProgram#end()}. */
  public void begin () {
    GL20 gl = Gdx.gl20;
    checkManaged();
    gl.glUseProgram(program);
  }
View Full Code Here


  }

  /** Disables this shader. Must be called when one is done with the shader. Don't mix it with dispose, that will release the
   * shader resources. */
  public void end () {
    GL20 gl = Gdx.gl20;
    gl.glUseProgram(0);
  }
View Full Code Here

    gl.glUseProgram(0);
  }

  /** Disposes all resources associated with this shader. Must be called when the shader is no longer used. */
  public void dispose () {
    GL20 gl = Gdx.gl20;
    gl.glUseProgram(0);
    gl.glDeleteShader(vertexShaderHandle);
    gl.glDeleteShader(fragmentShaderHandle);
    gl.glDeleteProgram(program);
    if (shaders.get(Gdx.app) != null) shaders.get(Gdx.app).removeValue(this, true);
  }
View Full Code Here

  /** Disables the vertex attribute with the given name
   *
   * @param name the vertex attribute name */
  public void disableVertexAttribute (String name) {
    GL20 gl = Gdx.gl20;
    checkManaged();
    int location = fetchAttributeLocation(name);
    if (location == -1) return;
    gl.glDisableVertexAttribArray(location);
  }
View Full Code Here

    if (location == -1) return;
    gl.glDisableVertexAttribArray(location);
  }

  public void disableVertexAttribute (int location) {
    GL20 gl = Gdx.gl20;
    checkManaged();
    gl.glDisableVertexAttribArray(location);
  }
View Full Code Here

  /** Enables the vertex attribute with the given name
   *
   * @param name the vertex attribute name */
  public void enableVertexAttribute (String name) {
    GL20 gl = Gdx.gl20;
    checkManaged();
    int location = fetchAttributeLocation(name);
    if (location == -1) return;
    gl.glEnableVertexAttribArray(location);
  }
View Full Code Here

    if (location == -1) return;
    gl.glEnableVertexAttribArray(location);
  }

  public void enableVertexAttribute (int location) {
    GL20 gl = Gdx.gl20;
    checkManaged();
    gl.glEnableVertexAttribArray(location);
  }
View Full Code Here

   * @param value1 the first value
   * @param value2 the second value
   * @param value3 the third value
   * @param value4 the fourth value */
  public void setAttributef (String name, float value1, float value2, float value3, float value4) {
    GL20 gl = Gdx.gl20;
    int location = fetchAttributeLocation(name);
    gl.glVertexAttrib4f(location, value1, value2, value3, value4);
  }
View Full Code Here

    bind(shader, null);
  }

  @Override
  public void bind (ShaderProgram shader, int[] locations) {
    final GL20 gl = Gdx.gl20;

    gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, bufferHandle);
    if (isDirty) {
      byteBuffer.limit(buffer.limit() * 4);
      gl.glBufferData(GL20.GL_ARRAY_BUFFER, byteBuffer.limit(), byteBuffer, usage);
      isDirty = false;
    }

    final int numAttributes = attributes.size();
    if (locations == null) {
View Full Code Here

    unbind(shader, null);
  }

  @Override
  public void unbind (final ShaderProgram shader, final int[] locations) {
    final GL20 gl = Gdx.gl20;
    final int numAttributes = attributes.size();
    if (locations == null) {
      for (int i = 0; i < numAttributes; i++) {
        shader.disableVertexAttribute(attributes.get(i).alias);
      }
    } else {
      for (int i = 0; i < numAttributes; i++) {
        final int location = locations[i];
        if (location >= 0) shader.disableVertexAttribute(location);
      }
    }
    gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
    isBound = false;
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.GL20

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.