Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Gl_object::initializeRender()
- {
- //initializeTexture();
- //Init vertices + texCoord
- //float *vertices = m_vertices.data();
- //float *texCoord = m_texCoord.data();
- //m_vertice = sizeof(vertices);
- //m_tex = sizeof(texCoord);
- m_vertice = m_vertices.size() * sizeof(glm::vec3);
- m_tex = m_texCoord.size() * sizeof(glm::vec2);
- //Init shader
- if(m_transparency)
- {
- shader = Shader("Extensions/AltisCraft/Shaders/shader4.vs", "Extensions/AltisCraft/Shaders/shader4.fs");
- shader2 = Shader("Extensions/AltisCraft/Shaders/shader5.vs", "Extensions/AltisCraft/Shaders/shader5.fs");
- }
- else
- shader = Shader("Extensions/AltisCraft/Shaders/shader3.vs", "Extensions/AltisCraft/Shaders/shader3.fs");
- //Init first VBO with vertice and texture coordinates
- glGenVertexArrays(1, &m_VAO);
- glGenBuffers(1, &m_VBO);
- glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
- glBufferData(GL_ARRAY_BUFFER, m_vertice + m_tex, 0, GL_STATIC_DRAW);
- glBufferSubData(GL_ARRAY_BUFFER, 0, m_tex, &m_vertices[0]);
- glBufferSubData(GL_ARRAY_BUFFER, m_vertice, m_tex, &m_texCoord[0]);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glGenBuffers(1, &m_translationVBO);
- m_indice = m_indices.size() * sizeof(unsigned int);
- glGenBuffers(1, &m_IBO);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_IBO);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_indice, &m_indices[0], GL_STATIC_DRAW);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement