Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Gl_object::initializeTranslations(vector<glm::vec3> translations)
- {
- initializeTexture();
- m_size = translations.size();
- //Init second VBO with translations
- glBindBuffer(GL_ARRAY_BUFFER, m_translationVBO);
- glBufferData(GL_ARRAY_BUFFER, m_size * sizeof(glm::vec3), &translations[0], GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- //Send vertex attrib to VAO
- glBindVertexArray(m_VAO);
- glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
- glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
- glEnableVertexAttribArray(0);
- glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, ((char*)NULL + (m_vertice)));
- glEnableVertexAttribArray(1);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glBindBuffer(GL_ARRAY_BUFFER, m_translationVBO);
- glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
- glEnableVertexAttribArray(2);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glVertexAttribDivisor(2, 1);
- debug("GLObject initRender");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement