List of usage examples for org.lwjgl.opengl GL20 glUseProgram
public static void glUseProgram(@NativeType("GLuint") int program)
From source file:com.opengrave.og.models.DAEAnimatedMesh.java
License:Open Source License
public void setBonesUniform(int pID) { FloatBuffer matrix44 = BufferUtils.createFloatBuffer(128 * 16); GL20.glUseProgram(pID); int boneNo = 0; DAESceneNode bone = null;/*from w ww . j a va2 s.c om*/ while ((bone = skeleton.getBone(boneNo)) != null) { bone.skinningMatrix.store(matrix44); boneNo++; } Matrix4f ident = new Matrix4f(); while (boneNo < 128) { ident.store(matrix44); boneNo++; } matrix44.flip(); Util.setUniformMat44(pID, "u_BoneTransform", matrix44); }
From source file:com.opengrave.og.Util.java
License:Open Source License
/** * Used for 2D "HUD" Renderables/*from w ww .ja v a2 s . c om*/ * * @param pID * @param location * @param scale * @param rotate */ public static void setMatrices(int pID, Vector3f location) { Util.checkErr(); GL20.glUseProgram(pID); Matrix4f modelView = new Matrix4f(); modelView.translate(location, modelView); // Matrix4f.scale(location.getScale(), modelView, modelView); // Matrix4f.rotate(degreesToRadians(rotate.z), new Vector3f(0, 0, 1), // modelView, modelView); // Matrix4f.rotate(degreesToRadians(rotate.y), new Vector3f(0, 1, 0), // modelView, modelView); // Matrix4f.rotate(degreesToRadians(rotate.x), new Vector3f(1, 0, 0), // modelView, modelView); Util.checkErr(); guiMatrix.store(matrix44Buffer); matrix44Buffer.flip(); setUniformMat44(pID, "guiMatrix", matrix44Buffer); // projectionMatrix.store(matrix44Buffer); matrix44Buffer.flip(); // setUniform(pID, "projectionMatrix", matrix44Buffer); // viewMatrix.store(matrix44Buffer); matrix44Buffer.flip(); // setUniform(pID, "viewMatrix", matrix44Buffer); modelView.store(matrix44Buffer); matrix44Buffer.flip(); setUniformMat44(pID, "modelMatrix", matrix44Buffer); Util.checkErr(); }
From source file:com.redthirddivision.quad.rendering.shaders.Shader.java
License:Apache License
public void start() { GL20.glUseProgram(programID); }
From source file:com.runescape.client.revised.client.lwjgl.Shader.java
License:Open Source License
public void bind() { GL20.glUseProgram(this.getProgram()); }
From source file:com.samrj.devil.gl.DGL.java
License:Open Source License
/** * Uses the given shader program for any subsequent draw calls. Pass null to * unbind the current shader./* w ww . j av a 2 s .co m*/ * * @param shaderProgram The shader program to use. * @return The given shader program, which is now in use. */ public static ShaderProgram useProgram(ShaderProgram shaderProgram) { if (boundProgram != shaderProgram) { if (shaderProgram == null) GL20.glUseProgram(0); else shaderProgram.use(); boundProgram = shaderProgram; } return shaderProgram; }
From source file:com.samrj.devil.gl.ShaderProgram.java
License:Open Source License
/** * Use this shader for any subsequent draw calls. */// w w w . j a v a 2 s.co m void use() { if (state == State.DELETED) throw new IllegalStateException("Shader must not be deleted to use."); GL20.glUseProgram(id); }
From source file:com.sgflt.ShaderManager.Shader.java
License:Apache License
/** * Bind the Shader Program to the OpenGL pipeline. * */ public void bind() { GL20.glUseProgram(shaderProgram); }
From source file:com.voxelplugineering.voxelsniper.render.RenderMain.java
License:Open Source License
public void tick() { if (!setup) { return;//w ww. j a v a 2 s . c om } Camera camera = Standalone.system().getMainCamera(); // reset view matrix viewMatrix.setIdentity(); // Translate camera Vector3f rot = camera.getCameraRot(); Matrix4f.rotate(rot.x, new Vector3f(1, 0, 0), viewMatrix, viewMatrix); Matrix4f.rotate(rot.y, new Vector3f(0, 1, 0), viewMatrix, viewMatrix); Matrix4f.rotate(rot.z, new Vector3f(0, 0, 1), viewMatrix, viewMatrix); Matrix4f.translate(camera.getCameraPos(), viewMatrix, viewMatrix); GL20.glUseProgram(pId); // push matrices viewMatrix.store(matrix44Buffer); matrix44Buffer.flip(); GL20.glUniformMatrix4(viewMatrixLocation, false, matrix44Buffer); modelMatrix.store(matrix44Buffer); matrix44Buffer.flip(); GL20.glUniformMatrix4(modelMatrixLocation, false, matrix44Buffer); projectionMatrix.store(matrix44Buffer); matrix44Buffer.flip(); GL20.glUniformMatrix4(projectionMatrixLocation, false, matrix44Buffer); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); // bind textures GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.textures.get("block")); // render all buffer sections buffer.renderSections(); GL20.glUseProgram(0); OpenGLUtilities.checkGLError("render main"); Display.update(); }
From source file:com.voxelplugineering.voxelsniper.render.RenderMain.java
License:Open Source License
public void destroy() { textures.destroy();/*from w w w. j av a 2 s. co m*/ // Delete the shaders GL20.glUseProgram(0); GL20.glDeleteProgram(pId); buffer.destroy(); OpenGLUtilities.checkGLError("destroyOpenGL"); Display.destroy(); }
From source file:com.xrbpowered.gl.examples.GLFractal.java
License:Open Source License
@Override protected void setupResources() { super.setupResources(); palette = new Texture("palette.png"); shader = new PostProcessShader("post_fractal_f.glsl") { private int aspectLocation; private int pivotLocation; private int zoomLocation; private int maxiLocation; @Override//from w ww .j a v a2 s .c o m protected void storeUniformLocations() { super.storeUniformLocations(); aspectLocation = GL20.glGetUniformLocation(pId, "aspect"); pivotLocation = GL20.glGetUniformLocation(pId, "pivot"); zoomLocation = GL20.glGetUniformLocation(pId, "zoom"); maxiLocation = GL20.glGetUniformLocation(pId, "maxi"); GL20.glUseProgram(pId); GL20.glUniform1i(GL20.glGetUniformLocation(pId, "palette"), 0); GL20.glUseProgram(0); } @Override public void updateUniforms() { super.updateUniforms(); GL20.glUniform1f(aspectLocation, (float) Display.getWidth() / (float) Display.getHeight()); GL20.glUniform2f(pivotLocation, pivotx, pivoty); GL20.glUniform1f(zoomLocation, zoom); GL20.glUniform1i(maxiLocation, maxi); } }; uiDebugPane.setVisible(false); resetBuffer(); }