I'm using AssImp to parse a simple cube (as an example to test) to be used on OpenGl. But when OpenGl starts I see a glimpse of my scene with cube in it followed by this error on my Nvidia driver:
http://nvidia.custhelp.com/app/answers/detail/a_id/3007
OpenGl shuts down and this has been happening always after I started using AssImp.
My Nvidia is the GeForce 9300M GS. The code that draws the cube is very simple:
#include "Object.h"
Object::Object(string filename){
scene = importer.ReadFile(filename,aiProcess_CalcTangentSpace|aiProcess_Triangulate|aiProcess_JoinIdenticalVertices|aiProcess_SortByPType);
if(!scene){
cout << importer.GetErrorString();
}
}
void Object::draw(){
if(!scene)
return;
if(!scene->mNumMeshes){
cout << "NO PRIMITIVES" << endl;
return;
}
for(int i = 0; i < scene->mNumMeshes ; i++){
for (int j = 0; j < scene->mMeshes[i]->mNumFaces ; j++)
{
glBegin(GL_TRIANGLES);
glVertex3f(scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[0]].x,
scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[0]].y,
scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[0]].z);
glVertex3f(scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[1]].x,
scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[1]].y,
scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[1]].z);
glVertex3f(scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[2]].x,
scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[2]].y,
scene->mMeshes[i]->mVertices[scene->mMeshes[i]->mFaces[j].mIndices[2]].z);
glEnd;
}
}
}
Has anyone ever had this crash on the Nvidia driver using AssImp?
I have no idea what the problem may be. I've used OpenGl in this computer numerous times with more complex shapes building entire scenes but I never got this.
Inside the double for loop, you probably want to write glEnd();
instead of glEnd;
(which is valid C++ but the compiler issues a warning about it)