Example usage for com.badlogic.gdx.graphics GL20 glUseProgram

List of usage examples for com.badlogic.gdx.graphics GL20 glUseProgram

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 glUseProgram.

Prototype

public void glUseProgram(int program);

Source Link

Usage

From source file:net.mgsx.game.examples.gpu.utils.ShaderProgramEx.java

License:Apache License

/** 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();/*from  w w w .j a v  a 2  s .co m*/
    gl.glUseProgram(program);
}

From source file:net.mgsx.game.examples.gpu.utils.ShaderProgramEx.java

License:Apache License

/** 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. *//* w ww.  jav a  2s .  com*/
public void end() {
    GL20 gl = Gdx.gl20;
    gl.glUseProgram(0);
}

From source file:net.mgsx.game.examples.gpu.utils.ShaderProgramEx.java

License:Apache License

/** 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);//from   w w  w  .  j  a  va  2s .  c  o m
    if (shaders.get(Gdx.app) != null)
        shaders.get(Gdx.app).removeValue(this, true);
}