List of usage examples for org.lwjgl.opengl GL20 glUseProgram
public static void glUseProgram(@NativeType("GLuint") int program)
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Binds OpenGL to use this shader program. */ public void bindShader() { GL20.glUseProgram(programID); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
@Override public void close() { GL20.glUseProgram(0); GL20.glDetachShader(programID, vertShaderID); GL20.glDetachShader(programID, fragShaderID); GL20.glDeleteShader(vertShaderID);/* www . j a v a 2 s.co m*/ GL20.glDeleteShader(fragShaderID); GL20.glDeleteProgram(programID); Game.getCurrentInstance().removeFromTrashCleanup(this); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Gets the integer location of a uniform variable. * @param variableName The {@link java.lang.String} name of the Uniform variable. * @return Returns the integer location of a uniform variable. *///from ww w . j a v a 2s .c o m public int getUniformVariableLocation(String variableName) { if (uniformMap.containsKey(variableName)) { int ret = uniformMap.get(variableName); if (ret != -1) return ret; } GL20.glUseProgram(programID); int ret = GL20.glGetUniformLocation(programID, variableName); uniformMap.put(variableName, ret); return ret; }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Changes the shader's projection matrix to the one specified. * This will only work with the 3D shader! * @param value The {@link org.lwjgl.util.vector.Matrix4f} object containing the shader projection data. *///from ww w.jav a 2s . co m public void setProjectionMatrix(Matrix4f value) { GL20.glUseProgram(programID); FloatBuffer pbuf = BufferUtils.createFloatBuffer(16); value.store(pbuf); pbuf.flip(); GL20.glUniformMatrix4fv(getUniformVariableLocation("projectionMatrix"), false, pbuf); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Changes the shader's transformation matrix to the one specified. * @param value The {@link org.lwjgl.util.vector.Matrix4f} object containing the shader transformation data. *//* w w w .j a va 2s . c o m*/ public void setTransformationMatrix(Matrix4f value) { GL20.glUseProgram(programID); value.store(matrixBuf); matrixBuf.flip(); GL20.glUniformMatrix4fv(getUniformVariableLocation("transformationMatrix"), false, matrixBuf); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Sets the value of a uniform variable in the shader. * @param location The integer id of the Uniform variable. * @param value The value to set./* ww w . j av a 2 s . c o m*/ */ public void setUniformVariable(int location, float value) { GL20.glUseProgram(programID); GL20.glUniform1f(location, value); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Sets the value of a uniform variable in the shader. * @param location The integer id of the Uniform variable. * @param value The value to set.//from w w w. j av a2s .c o m */ public void setUniformVariable(int location, Vector3f value) { GL20.glUseProgram(programID); GL20.glUniform3f(location, value.x, value.y, value.z); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Sets the value of a uniform variable in the shader. * @param location The integer id of the Uniform variable. * @param value The value to set.//from w ww .j a v a 2s .co m */ public void setUniformVariable(int location, boolean value) { GL20.glUseProgram(programID); GL20.glUniform1f(location, value ? 1f : 0f); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Sets the value of a uniform variable in the shader. * @param location The integer id of the Uniform variable. * @param value The value to set.//from w w w . j a v a 2s . co m */ public void setUniformVariable(int location, Matrix4f value) { GL20.glUseProgram(programID); value.store(matrixBuf); matrixBuf.flip(); GL20.glUniformMatrix4fv(location, false, matrixBuf); }
From source file:wrath.client.graphics.ShaderProgram.java
License:Open Source License
/** * Finalizes the shader and prepares it for rendering. * This is called automatically!/*w ww.j ava2s .c om*/ */ public void finish() { GL20.glUseProgram(programID); GL20.glLinkProgram(programID); GL20.glValidateProgram(programID); setProjectionMatrix(Game.getCurrentInstance().getRenderer().getProjectionMatrix()); finalized = true; }