List of usage examples for org.lwjgl.opengl GL20 glUniformMatrix4fv
public static void glUniformMatrix4fv(@NativeType("GLint") int location, @NativeType("GLboolean") boolean transpose, @NativeType("GLfloat const *") float[] value)
From source file:com.adavr.player.context.ShaderContext.java
License:Open Source License
@Override public void updateMatrix(Matrix4f projectionMatrix, Matrix4f modelViewMatrix) { int location; Program.bind(program);/*from w ww. j av a 2 s . c om*/ { location = program.getUniformLocation("projectionMatrix"); GL20.glUniformMatrix4fv(location, false, Utils.toFloatBuffer(projectionMatrix)); location = program.getUniformLocation("modelViewMatrix"); GL20.glUniformMatrix4fv(location, false, Utils.toFloatBuffer(modelViewMatrix)); } Program.unbind(); }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java
License:Apache License
public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) { GL20.glUniformMatrix4fv(location, transpose, value); }
From source file:com.badlogic.gdx.backends.lwjgl3.Lwjgl3GL20.java
License:Apache License
public void glUniformMatrix4fv(int location, int count, boolean transpose, float[] value, int offset) { GL20.glUniformMatrix4fv(location, transpose, toFloatBuffer(value, offset, count << 4)); }
From source file:com.grillecube.client.opengl.GLProgram.java
protected void loadUniformMatrix(int location, Matrix4f matrix) { matrix.store(this.matrixBuffer); this.matrixBuffer.flip(); GL20.glUniformMatrix4fv(location, false, this.matrixBuffer); }
From source file:com.grillecube.engine.opengl.object.GLProgram.java
protected void loadUniformMatrix(int location, Matrix4f matrix) { matrix.store(_matrix_buffer); _matrix_buffer.flip(); GL20.glUniformMatrix4fv(location, false, _matrix_buffer); }
From source file:com.opengrave.og.Util.java
License:Open Source License
public static void setUniformMat44(int pID, String string, FloatBuffer matrix44) { // System.out.println("Program "+pID); Util.checkErr();//from w ww. j ava 2s. c om int i = GL20.glGetUniformLocation(pID, string); Util.checkErr(); if (i == -1) { // System.out.println("Cannot find uniform '"+string+"'"); // Thread.dumpStack(); } else { GL20.glUniformMatrix4fv(i, false, matrix44); Util.checkErr(); } }
From source file:cuchaz.jfxgl.prism.JFXGLContext.java
License:Open Source License
@Override public void uniformMatrix4fv(int location, boolean transpose, float values[]) { GL20.glUniformMatrix4fv(location, transpose, values); }
From source file:me.sunchiro.game.engine.gl.Graphic.java
License:Open Source License
private synchronized void render() { GL11.glClearColor(bgColor.x, bgColor.y, bgColor.z, 0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL20.glUseProgram(shader.getPID());// w w w . j a va 2s . c o m // GL13.glActiveTexture(GL13.GL_TEXTURE0); GL30.glBindVertexArray(vaoId); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid)); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId); long offset = 0; int shift = 0; GL11.glAlphaFunc(GL11.GL_GREATER, 0.4f); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); for (Drawable object : objects) { Matrix4f finalMVP = new Matrix4f(mvpMat); Matrix4f modelMat = new Matrix4f(); Matrix4f scaler = new Matrix4f(); scaler.scale(object.scale * allScale); modelMat.translate(object.translation); modelMat.rotateXYZ(object.rotation.x, object.rotation.y, object.rotation.z); finalMVP.mul(modelMat); finalMVP.mul(scaler); finalMVP.get(0, matBuff); if (object.isChar) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid_charmap)); } GL20.glUniformMatrix4fv(shader.getMVPLocation(), false, matBuff); GL20.glUniform1i(shader.getInverseLocation(), object.inverseAlpha ? 1 : 0); if (object.isVisible()) GL32.glDrawElementsBaseVertex(GL11.GL_TRIANGLES, object.getIndices().length, GL11.GL_UNSIGNED_BYTE, offset, shift); offset += object.getIndices().length; shift += object.getVertex().length; if (object.isChar) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid)); } } render2d(offset, shift); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); GL30.glBindVertexArray(0); // GL20.glUseProgram(0); glfwSwapBuffers(window); glfwPollEvents(); }
From source file:me.sunchiro.game.engine.gl.Graphic.java
License:Open Source License
private void render2d(long offset, int shift) { cam.getOrthoMVP().get(0, matBuff);/*from w ww. ja v a2 s . c o m*/ GL20.glUniformMatrix4fv(shader.getMVPLocation(), false, matBuff); for (Drawable object : orthoObjects) { if (object.isChar) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, texManager.getTexture(tid_charmap)); } GL20.glUniform1i(shader.getInverseLocation(), object.inverseAlpha ? 1 : 0); if (object.isVisible()) GL32.glDrawElementsBaseVertex(GL11.GL_TRIANGLES, object.getIndices().length, GL11.GL_UNSIGNED_BYTE, offset, shift); offset += object.getIndices().length; shift += object.getVertex().length; } // static utility function }
From source file:net.smert.frameworkgl.opengl.helpers.ShaderUniformHelper.java
License:Apache License
public void setUniformMatrix4(int uniformID, boolean transpose, FloatBuffer matrix) { GL20.glUniformMatrix4fv(uniformID, transpose, matrix); }