Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void display::setVO(GLuint setVBO, GLfloat* vertsVO)
- {
- //Vertex Buffer Object(VBO) to the current VAO
- glGenBuffers(1, &setVBO);
- glBindBuffer(GL_ARRAY_BUFFER, setVBO);
- //copy vertices to VBO
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertsVO), vertsVO, GL_STATIC_DRAW);
- // Specify the layout of the vertex data
- GLint posAttrib = glGetAttribLocation(shaderProgram, "position");
- glEnableVertexAttribArray(posAttrib);
- glVertexAttribPointer(posAttrib, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), 0);
- GLint colAttrib = glGetAttribLocation(shaderProgram, "color");
- glEnableVertexAttribArray(colAttrib);
- glVertexAttribPointer(colAttrib, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void*)(3 * sizeof(GLfloat)));
- GLint texAttrib = glGetAttribLocation(shaderProgram, "texcoord");
- glEnableVertexAttribArray(texAttrib);
- glVertexAttribPointer(texAttrib, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void*)(6 * sizeof(GLfloat)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement