Example usage for org.lwjgl.opengl GL20 glUseProgram

List of usage examples for org.lwjgl.opengl GL20 glUseProgram

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL20 glUseProgram.

Prototype

public static void glUseProgram(@NativeType("GLuint") int program) 

Source Link

Document

Installs a program object as part of current rendering state.

Usage

From source file:com.github.kajdreef.mazerunnermvn.MazeRunner.ShaderProgram.java

public void stopProgram() {
    GL20.glUseProgram(0);
}

From source file:com.github.kajdreef.mazerunnermvn.Object.Camera.java

public void update(float delta, boolean collision) {
    viewMatrix.setIdentity();//from  w w w  . j a v  a2s  .c o m

    if (!collision)
        position.set(newPosition);

    Matrix4f.rotate((float) Math.toRadians(xRotation), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
    Matrix4f.rotate((float) Math.toRadians(yRotation), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);

    Matrix4f.translate(position, viewMatrix, viewMatrix);

    GL20.glUseProgram(ShaderProgram.getProgram());

    FloatBuffer matrix44Buffer = BufferUtils.createFloatBuffer(16);
    viewMatrix.store(matrix44Buffer);
    matrix44Buffer.flip();
    GL20.glUniformMatrix4(ShaderProgram.getVML(), false, matrix44Buffer);

    GL20.glUseProgram(0);
}

From source file:com.github.kajdreef.mazerunnermvn.State.MazeRunner.java

@Override
public void logic(float delta) {
    // Update the model positions
    level.update(delta);//from ww  w.ja v  a 2 s  .c o  m

    GL20.glUseProgram(shaderProgram.getProgram());

    projectionMatrix.store(matrix44Buffer);
    matrix44Buffer.flip();
    GL20.glUniformMatrix4(shaderProgram.getPML(), false, matrix44Buffer);

    GL20.glUseProgram(0);
}

From source file:com.github.ryancwilliams.WJ3dPL.graphics.GLUtils.ShaderProgram.java

License:Apache License

/**
 * Make this shader the active program.
 */
public void use() {
    GL20.glUseProgram(this.program);
}

From source file:com.google.gapid.glviewer.gl.Shader.java

License:Apache License

void bind() {
    GL20.glUseProgram(handle);
    for (Attribute attribute : attributes.values()) {
        attribute.bind();//  www.  j  ava2s.com
    }
    for (Uniform uniform : uniforms.values()) {
        uniform.bind();
    }
}

From source file:com.grillecube.client.opengl.GLProgram.java

public void useStart() {
    GL20.glUseProgram(this.progID);
}

From source file:com.grillecube.client.opengl.GLProgram.java

public void useStop() {
    GL20.glUseProgram(0);
}

From source file:com.grillecube.engine.opengl.object.GLProgram.java

public void useStart() {
    GL20.glUseProgram(this._programID);
}

From source file:com.kauridev.lunarfever.graphics.ShaderProgram.java

License:Open Source License

public void use() {
    if (!isValid()) {
        throw new IllegalStateException();
    }

    GL20.glUseProgram(program);
}

From source file:com.opengrave.og.base.Renderable2D.java

License:Open Source License

@Override
public void renderForPicking(Matrix4f matrix, Pickable object) {
    dealWithChange();//from   w  w  w  . j a v a 2 s .c o  m
    if (vertexList.size() == 0) {
        return;
    }
    int pID = Resources.loadShader("pickinggui.vs", "pickinggui.fs").getProgram();
    GL20.glUseProgram(pID);
    GL30.glBindVertexArray(vaoID);
    GL20.glEnableVertexAttribArray(0);
    Util.setMatrices(pID, location2d);
    Picking.registerObject(pID, getContext(), object);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vertexList.size());
    GL20.glDisableVertexAttribArray(0);
    GL30.glBindVertexArray(0);
    GL20.glUseProgram(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL30.glBindVertexArray(0);
}