Original Post
Hi, I'm having trouble getting display lists to work in my game. I am loading .obj models from diffrent files and "trying" to put them in display lists to make them render faster. They render just fine without using display list, but I see nothing that is defined in a display list. Here is the meat of my code, any suggestions would be greatly appreciated. JModelObj(char* objFileName, char* mtlFileName) { loadMTLFile(mtlFileName); loadOBJfile(objFileName); displayListID = glGenLists(1); cout << "\nDisplay list: " << displayListID; glNewList( displayListID, GL_COMPILE ); draw(); glEndList(); } void JModelObj::drawDL() { glPushMatrix(); glColor3f(1.0, 0.0, 0.0); glCallList(displayListID); glPopMatrix(); } void JModelObj::draw() { JVertex *vertIt, *normIt; JTexCoor *texIt; int curMatIndex=-99; int tempIndex=0; faceVec::iterator faceIt; glColor3d( 0.0, 1.0, 0.0); glPushMatrix(); glBegin(GL_TRIANGLES); for( faceIt=faces.begin(); faceIt!=faces.end(); faceIt++) { vertIt = vertexVec.at(*faceIt); //cout << (*faceIt) << " "; faceIt++; texIt = textureVec.at(*faceIt); //cout << (*faceIt) << " "; faceIt++; normIt = normalVec.at(*faceIt); //cout << (*faceIt) << "\n"; faceIt++; tempIndex = (*faceIt); if( curMatIndex != tempIndex ) { curMatIndex = tempIndex; glEnd(); //matVec.at(curMatIndex)->setCurrentMaterial(); glBegin(GL_TRIANGLES); } //glTexCoord2f(texIt->getTexX(), texIt->getTexY()); glNormal3f(normIt->getPointX(), normIt->getPointY(), normIt->getPointZ()); glVertex3f(vertIt->getPointX(), vertIt->getPointY(), vertIt->getPointZ()); //cout << "P:" <getPointX()<<"/"<getPointY()<<"/"<getPointZ()<<"\n"; } glEnd(); glPopMatrix(); }