List of usage examples for org.lwjgl.opengl GL20 glVertexAttribPointer
public static void glVertexAttribPointer(@NativeType("GLuint") int index, @NativeType("GLint") int size, @NativeType("GLenum") int type, @NativeType("GLboolean") boolean normalized, @NativeType("GLsizei") int stride, @NativeType("void const *") FloatBuffer pointer)
From source file:processing.lwjgl.PLWJGL.java
License:Open Source License
public void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, Buffer data) { if (type == UNSIGNED_INT) { GL20.glVertexAttribPointer(index, size, true, normalized, stride, (IntBuffer) data); } else if (type == UNSIGNED_BYTE) { GL20.glVertexAttribPointer(index, size, true, normalized, stride, (ByteBuffer) data); } else if (type == UNSIGNED_SHORT) { GL20.glVertexAttribPointer(index, size, true, normalized, stride, (ShortBuffer) data); } else if (type == FLOAT) { GL20.glVertexAttribPointer(index, size, normalized, stride, (FloatBuffer) data); }/* ww w.j av a2 s . c o m*/ }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, int offset) { GL20.glVertexAttribPointer(index, size, type, normalized, stride, offset); }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, Buffer data) { if (type == UNSIGNED_INT) { GL20.glVertexAttribPointer(index, size, true, normalized, stride, (IntBuffer) data); } else if (type == UNSIGNED_BYTE) { GL20.glVertexAttribPointer(index, size, true, normalized, stride, (ByteBuffer) data); } else if (type == UNSIGNED_SHORT) { GL20.glVertexAttribPointer(index, size, true, normalized, stride, (ShortBuffer) data); } else if (type == FLOAT) { GL20.glVertexAttribPointer(index, size, normalized, stride, (FloatBuffer) data); }//from w w w .j av a2s . c o m }
From source file:ru.axialshift.vram.gl.VertexVBO.java
License:Apache License
@Override protected void upload_gl() { //Allocation/*from w w w. jav a2 s . com*/ glpointer = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, glpointer); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, (FloatBuffer) tovram, GL15.GL_STATIC_DRAW); //Mapping int stride = 4 * (MeshData.VERTICES_STRIDE + MeshData.UVS_STRIDE + MeshData.NORMALS_STRIDE + MeshData.TANGENTS_STRIDE + MeshData.BITANGENTS_STRIDE); int offset = 0; //Vertices int bytesPerVertex = MeshData.VERTICES_STRIDE * 4; GL20.glVertexAttribPointer(id_pos, MeshData.VERTICES_STRIDE, GL11.GL_FLOAT, false, stride, offset); //UVs int bytesPerUVs = MeshData.UVS_STRIDE * 4; offset += bytesPerVertex; GL20.glVertexAttribPointer(id_uvs, MeshData.UVS_STRIDE, GL11.GL_FLOAT, false, stride, offset); //Normals int bytesPerNormals = MeshData.NORMALS_STRIDE * 4; offset += bytesPerUVs; GL20.glVertexAttribPointer(id_nor, MeshData.NORMALS_STRIDE, GL11.GL_FLOAT, false, stride, offset); //Tangents int bytesPerTangents = MeshData.TANGENTS_STRIDE * 4; offset += bytesPerNormals; GL20.glVertexAttribPointer(id_tan, MeshData.TANGENTS_STRIDE, GL11.GL_FLOAT, false, stride, offset); //BiTangents //int bytesPerBiTangents = MeshData.BITANGENTS_STRIDE*4; offset += bytesPerTangents; GL20.glVertexAttribPointer(id_btan, MeshData.BITANGENTS_STRIDE, GL11.GL_FLOAT, false, stride, offset); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); }
From source file:se.angergard.engine.graphics.Mesh.java
License:Apache License
public void draw() { GL20.glEnableVertexAttribArray(0);/*from w ww. j a va2 s . co m*/ GL20.glEnableVertexAttribArray(1); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, ibo); GL20.glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, Vertex2D.SIZE_BYTES, 0); GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, Vertex2D.SIZE_BYTES, 8); GL11.glDrawElements(GL11.GL_TRIANGLES, INDICES_LENGTH, GL11.GL_UNSIGNED_INT, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); }
From source file:thebounzer.org.lwgldemo.Chapter5.java
License:Open Source License
private void createAndBindVertexObject(float[] data) throws IOException { FloatBuffer fBuffer = BufferUtils.createFloatBuffer(data.length); fBuffer.put(data);// w w w . ja v a2 s .com fBuffer.flip(); int vboId = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboId); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, fBuffer, GL15.GL_STATIC_DRAW); GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 0, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glVertexAttribPointer(int a, int b, int c, boolean d, int e, long f) { GL20.glVertexAttribPointer(a, b, c, d, e, f); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glVertexAttribPointer(int a, int b, boolean c, boolean d, int e, ByteBuffer f) { GL20.glVertexAttribPointer(a, b, c, d, e, f); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glVertexAttribPointer(int a, int b, boolean c, boolean d, int e, IntBuffer f) { GL20.glVertexAttribPointer(a, b, c, d, e, f); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glVertexAttribPointer(int a, int b, boolean c, boolean d, int e, ShortBuffer f) { GL20.glVertexAttribPointer(a, b, c, d, e, f); }