Advertisement
Guest User

Untitled

a guest
May 29th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. void display::setVO(GLuint setVBO, GLfloat* vertsVO)
  3. {
  4.  
  5. //Vertex Buffer Object(VBO) to the current VAO
  6. glGenBuffers(1, &setVBO);
  7. glBindBuffer(GL_ARRAY_BUFFER, setVBO);
  8. //copy vertices to VBO
  9. glBufferData(GL_ARRAY_BUFFER, sizeof(vertsVO), vertsVO, GL_STATIC_DRAW);
  10.  
  11. // Specify the layout of the vertex data
  12. GLint posAttrib = glGetAttribLocation(shaderProgram, "position");
  13. glEnableVertexAttribArray(posAttrib);
  14. glVertexAttribPointer(posAttrib, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), 0);
  15.  
  16. GLint colAttrib = glGetAttribLocation(shaderProgram, "color");
  17. glEnableVertexAttribArray(colAttrib);
  18. glVertexAttribPointer(colAttrib, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void*)(3 * sizeof(GLfloat)));
  19.  
  20. GLint texAttrib = glGetAttribLocation(shaderProgram, "texcoord");
  21. glEnableVertexAttribArray(texAttrib);
  22. glVertexAttribPointer(texAttrib, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void*)(6 * sizeof(GLfloat)));
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement