// main.cpp
#define __USE_VBO_
// in geo.cpp
#ifndef __USE_VBO_
//Bind the vertex array and set the vertex pointer to point at it
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);
//glVertexPointer(3, GL_FLOAT, 0, 0);
glVertexAttribPointer((GLint)0, 3, GL_FLOAT, GL_FALSE, 0, 0);
//Bind the color array
glBindBuffer(GL_ARRAY_BUFFER, m_colorBuffer);
//glColorPointer(3, GL_FLOAT, 0, 0);
glVertexAttribPointer((GLint)1, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_texCoordBuffer);
glVertexAttribPointer((GLint)2, 2, GL_FLOAT, GL_FALSE, 0, 0);
//Bind the index array
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);
//Draw the triangles
glDrawElements(GL_TRIANGLES, m_indices.size(), GL_UNSIGNED_INT, 0);
#else
//Bind the vertex array and set the vertex pointer to point at it
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);
//glVertexPointer(3, GL_FLOAT, 0, 0);
glVertexAttribPointer((GLint)0, 3, GL_FLOAT, GL_FALSE, 0, 0);
//Bind the color array
glBindBuffer(GL_ARRAY_BUFFER, m_colorBuffer);
//glColorPointer(3, GL_FLOAT, 0, 0);
glVertexAttribPointer((GLint)1, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_texCoordBuffer);
glVertexAttribPointer((GLint)2, 2, GL_FLOAT, GL_FALSE, 0, 0);
//Bind the index array
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);
//Draw the triangles
glDrawElements(GL_TRIANGLES, m_indices.size(), GL_UNSIGNED_INT, 0);
#endif
I've tried doing this but it comes with messy results far from what i expected, please can someone advice me on this.
thanks
Dave

New Topic/Question
Reply




MultiQuote





|