Merge branch 'master' of https://github.com/plane000/crumpet-engine
This commit is contained in:
@@ -4,11 +4,16 @@ Mesh::Mesh(GLfloat *vertices, unsigned int *indices, unsigned int numVerticies)
|
||||
m_drawCount = numVerticies;
|
||||
|
||||
glGenVertexArrays(1, &m_VAO);
|
||||
glGenBuffers(1, &m_VBO);
|
||||
glGenBuffers(1, &m_EBO);
|
||||
|
||||
glBindVertexArray(m_VAO);
|
||||
|
||||
glGenBuffers(NUM_BUFFERS, m_VBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_VBO[POSITION_VB]);
|
||||
glBufferData(GL_ARRAY_BUFFER, numVerticies * sizeof(vertices[0]), vertices, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
|
||||
|
||||
// position attribute
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
|
||||
@@ -16,10 +21,19 @@ Mesh::Mesh(GLfloat *vertices, unsigned int *indices, unsigned int numVerticies)
|
||||
// color attribute
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
|
||||
glEnableVertexAttribArray(1);
|
||||
<<<<<<< HEAD
|
||||
// texture attribute
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
=======
|
||||
// texture coord attribute
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
>>>>>>> 11f63887e9573415f2ed2fed84986ab4c4bd0b4f
|
||||
std::cout << "Mesh loaded successfully" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user