Java Code Examples for org.lwjgl.opengl.GL15#glBufferSubData()

The following examples show how to use org.lwjgl.opengl.GL15#glBufferSubData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GL33HelperPrimitives.java    From ldparteditor with MIT License 6 votes vote down vote up
public static void drawTrianglesIndexedRGB_Triangle(float[] vertices, int[] indices) {
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO_triangle);
    GL15.glBufferSubData(GL15.GL_ARRAY_BUFFER, 0, vertices);
    
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, EBO_triangle);
    GL15.glBufferSubData(GL15.GL_ELEMENT_ARRAY_BUFFER, 0, indices);
   
    GL20.glEnableVertexAttribArray(POSITION_SHADER_LOCATION);
    GL20.glVertexAttribPointer(POSITION_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_STRIDE, 0);
    
    GL20.glEnableVertexAttribArray(COLOUR_SHADER_LOCATION);
    GL20.glVertexAttribPointer(COLOUR_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_STRIDE, 12); // 3 * 4
   
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    
    GL11.glDrawElements(GL11.GL_TRIANGLES, 6, GL11.GL_UNSIGNED_INT, 0);
}
 
Example 2
Source File: GL33HelperPrimitives.java    From ldparteditor with MIT License 6 votes vote down vote up
public static void drawTrianglesIndexedRGB_Quad(float[] vertices, int[] indices) {
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO_quad);
    GL15.glBufferSubData(GL15.GL_ARRAY_BUFFER, 0 , vertices);
    
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, EBO_quad);
    GL15.glBufferSubData(GL15.GL_ELEMENT_ARRAY_BUFFER, 0, indices);
   
    GL20.glEnableVertexAttribArray(POSITION_SHADER_LOCATION);
    GL20.glVertexAttribPointer(POSITION_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_STRIDE, 0);
    
    GL20.glEnableVertexAttribArray(COLOUR_SHADER_LOCATION);
    GL20.glVertexAttribPointer(COLOUR_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_STRIDE, 12); // 3 * 4
   
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    
    GL11.glDrawElements(GL11.GL_TRIANGLES, 12, GL11.GL_UNSIGNED_INT, 0);
}
 
Example 3
Source File: GL33HelperPrimitives.java    From ldparteditor with MIT License 5 votes vote down vote up
public static void drawLinesRGB_Line(float[] vertices) {
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO_line);
    GL15.glBufferSubData(GL15.GL_ARRAY_BUFFER, 0, vertices);
    
    GL20.glEnableVertexAttribArray(POSITION_SHADER_LOCATION);
    GL20.glVertexAttribPointer(POSITION_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_STRIDE, 0);
    
    GL20.glEnableVertexAttribArray(COLOUR_SHADER_LOCATION);
    GL20.glVertexAttribPointer(COLOUR_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_STRIDE, 12); // 3 * 4
   
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    
    GL11.glDrawArrays(GL11.GL_LINES, 0, 2);
}
 
Example 4
Source File: Vbo.java    From LowPolyWater with The Unlicense 4 votes vote down vote up
public void storeData(long startInBytes, IntBuffer data){
	GL15.glBufferSubData(type, startInBytes, data);
}
 
Example 5
Source File: Vbo.java    From LowPolyWater with The Unlicense 4 votes vote down vote up
public void storeData(long startInBytes, FloatBuffer data){
	GL15.glBufferSubData(type, startInBytes, data);
}
 
Example 6
Source File: Vbo.java    From LowPolyWater with The Unlicense 4 votes vote down vote up
public void storeData(long startInBytes, ByteBuffer data){
	GL15.glBufferSubData(type, startInBytes, data);
}
 
Example 7
Source File: LwjglGLExt.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void glBufferSubData(int target, long offset, IntBuffer data) {
    checkLimit(data);
    GL15.glBufferSubData(target, offset, data);
}
 
Example 8
Source File: LWJGL15DrawContext.java    From settlers-remake with MIT License 4 votes vote down vote up
@Override
public void updateGeometryAt(GeometryHandle handle, int pos, ByteBuffer data) {
	bindGeometry(handle);
	data.rewind();
	GL15.glBufferSubData(GL15.GL_ARRAY_BUFFER, pos, data);
}