hi i 'm trying to load a model using assimp, ( mac, c++ , opengl core 4.1) … but i’m running into vertex array object not bound error… I have read the forums they all suggest adding vao before binding the vbo … i’m doing that but still not happening… here is the code…
vbo[VERTEX_BUFFER] = NULL;
vbo[TEXCOORD_BUFFER] = NULL;
vbo[NORMAL_BUFFER] = NULL;
vbo[INDEX_BUFFER] = NULL;
glGenVertexArraysAPPLE(1, &vao);
glBindVertexArrayAPPLE(vao);
elementCount = mesh->mNumFaces * 3;
if(mesh->HasPositions()) {
float *vertices = new float[mesh->mNumVertices * 3];
for(int i = 0; i < mesh->mNumVertices; ++i) {
vertices[i * 3] = mesh->mVertices[i].x;
vertices[i * 3 + 1] = mesh->mVertices[i].y;
vertices[i * 3 + 2] = mesh->mVertices[i].z;
}
glGenBuffers(1, &vbo[VERTEX_BUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, vbo[VERTEX_BUFFER]);
glBufferData(GL_ARRAY_BUFFER, 3 * mesh->mNumVertices * sizeof(GLfloat), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray (0);
delete vertices;
}
so on the other buffers get generated after this…
and this for setting context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
if anyone has any solution for this , pls post…
thanks…