Guest User

Untitled

a guest
Dec 27th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public void compositeVAO(int width, int height) {
  2.         float[] vertices = new float[] {
  3.             -1.0f, 1.0f,
  4.             -1.0f, -1.0f,
  5.             1.0f, 1.0f,
  6.             1.0f, -1.0f
  7.         };
  8.        
  9.         FloatBuffer verts = BufferUtils.createFloatBuffer(vertices.length);
  10.         verts.put(vertices);
  11.         verts.flip();
  12.        
  13.         vao = glGenVertexArrays();
  14.         glBindVertexArray(vao);
  15.        
  16.         int vbo = glGenBuffers();
  17.         glBindBuffer(GL_ARRAY_BUFFER, vbo);
  18.         glBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
  19.  
  20.         glVertexAttribPointer(position, 2, GL_FLOAT, false, 0, 0);
  21.         glEnableVertexAttribArray(position);
  22.  
  23.         glBindBuffer(GL_ARRAY_BUFFER, 0);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment