List of usage examples for org.lwjgl.opengl GL20 glGetAttribLocation
@NativeType("GLint") public static int glGetAttribLocation(@NativeType("GLuint") int program, @NativeType("GLchar const *") CharSequence name)
From source file:processing.lwjgl.PGL.java
License:Open Source License
public int getAttribLocation(int prog, String name) { return GL20.glGetAttribLocation(prog, name); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static int glGetAttribLocation(int a, ByteBuffer b) { return GL20.glGetAttribLocation(a, b); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static int glGetAttribLocation(int a, CharSequence b) { return GL20.glGetAttribLocation(a, b); }
From source file:vertigo.graphics.lwjgl.LWJGLAttribute.java
License:Open Source License
public void bindVBO(ArrayList<BO> buffer, int i) { for (BO bo : buffer) { VBO vbo = (VBO) bo;/*from www . j a va 2s . co m*/ if (compare(vbo)) { GL20.glGetAttribLocation(this.handle, name); GL20.glEnableVertexAttribArray(i); //set the vertex's position // GL20.glenableVertexAttribArray(shaderProgram.vertexPositionAttribute); GL20.glVertexAttribPointer(i, vbo.capacity(), false, getSize(name), vbo.getFloatBuffer()); ShaderUtils.useShader(this.handle); } } }
From source file:vertigo.graphics.lwjgl.LWJGL_Renderer.java
License:Open Source License
private void drawShape(Shape obj) { // Geometry: VBO and IBO if (obj.isDirty(Node.VBO)) { processBO(obj);/*from w w w. ja v a2 s .c om*/ obj.setDirty(Node.VBO, false); } ShaderProg glshader = obj.getMaterial().getShaderMaterial(); GL20.glUseProgram(glshader.getHandle()); updateUniform(); VBO vbo = null; for (Attribute attrib : attribute) { if (vbo.getType().equals(attrib.getType())) { int alocation = GL20.glGetAttribLocation(glshader.getHandle(), attrib.getName()); GL20.glEnableVertexAttribArray(alocation); GL20.glVertexAttribPointer(alocation, attrib.getSize(), GL11.GL_FLOAT, false, vbo.getStride() << 2, 0L); } } if (isIndexed) { // draw with index GL11.glDrawElements(getOpenGLStyle(obj.getDrawingStyle()), /* elements */ ibo.getSize(), GL_UNSIGNED_INT, 0L); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL20.glDisableVertexAttribArray(0); } else { // draw without index GL11.glDrawArrays(getOpenGLStyle(obj.getDrawingStyle()), 0, capacity / vbo3f.getStride()); GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); } GL20.glUseProgram(0); }
From source file:vertigo.graphics.lwjgl.ShaderUtils.java
License:Open Source License
public static ShaderProg updateShader(ShaderProg prog) { int progID = -1; System.out.println("updateShader:\n" + prog.getVertexSource() + "\n------\n" + prog.getFragmentSource()); if (prog.isDirty()) { try {/*from w w w . ja va2 s . com*/ progID = attachVFShaders(prog); } catch (Exception ex) { System.out.println("Exception attachShaders"); Logger.getLogger(LWJGL_Renderer.class.getName()).log(Level.SEVERE, null, ex); // Renderer or LWJGL_Renderer ? } prog.setHandle(progID); GL20.glUseProgram(progID); for (Uniform uniform : prog.getAllUniforms()) { System.out.println("uniform " + uniform.getName()); prog.setUniformLocation(uniform.getName(), GL20.glGetUniformLocation(progID, uniform.getName())); } for (Attribute attribute : prog.getAllAttributes()) { System.out.println("attr " + attribute.getName()); prog.setAttributeLocation(attribute.getName(), GL20.glGetAttribLocation(progID, attribute.getName())); } GL20.glUseProgram(0); } return prog; }
From source file:wrapper.vbo.Vbo.java
License:Open Source License
public Vbo(int width, int height, Shader shader) { transformation = new Vertex3d(0, 0, 0); this.shader = shader; if (shader == null) { System.out.println("Null shader , Vbo will encounter errors!"); }/*w ww . ja v a2 s .co m*/ Vertex2d temp = new Vertex2d(width, height); width = (int) temp.x; height = (int) temp.y; vertexattrib = GL20.glGetAttribLocation(shader.programID, "vertex"); System.out.println(GL20.glGetAttribLocation(shader.programID, "vertex")); textureattrib = GL20.glGetAttribLocation(shader.programID, "texturecoordinate"); rotationcentreuniform = GL20.glGetUniformLocation(shader.programID, "rotation_centre"); rotationuniform = GL20.glGetUniformLocation(shader.programID, "rotation"); transformuniform = GL20.glGetUniformLocation(shader.programID, "translation"); }