i have been trying to load a 3d model in opengl. i have been successful in loading a small model which has 2000 vertices now i am trying to load a model which has 350000 vertices using the same loader but it simply does not show up. i am using the loader from http://www.morrowland.com/apron/tut_gl.php and this is the function where i render the 3ds model
void C3dsLoader::Render_3ds()
{
for(int i = 0; i < m3DModel.numOfObjects; i++)
{
if(m3DModel.pObject.size() <= 0) break;
t3DObject *pObject = &m3DModel.pObject[i];
if(pObject->bHasTexture)
{
glEnable(GL_TEXTURE_2D);
glColor3ub(255, 255, 255);
glBindTexture(GL_TEXTURE_2D, TextureArray3ds[pObject->materialID]);
}
else
{
glDisable(GL_TEXTURE_2D);
glColor3ub(255, 255, 255);
}
glBegin(GL_TRIANGLES);
for(int j = 0; j < pObject->numOfFaces; j++)
{
for(int whichVertex = 0; whichVertex < 3; whichVertex++)
{
int index = pObject->pFaces[j].vertIndex[whichVertex];
glNormal3f(pObject->pNormals[ index ].x, pObject->pNormals[ index ].y, pObject->pNormals[ index ].z);
if(pObject->bHasTexture) {
if(pObject->pTexVerts) {
glTexCoord2f(pObject->pTexVerts[ index ].x, pObject->pTexVerts[ index ].y);
}
} else {
if(m3DModel.pMaterials.size() < pObject->materialID)
{
BYTE *pColor = m3DModel.pMaterials[pObject->materialID].color;
glColor3ub(pColor[0], pColor[1], pColor[2]);
}
}
glVertex3f(pObject->pVerts[ index ].x, pObject->pVerts[ index ].y, pObject->pVerts[ index ].z);
}
}
glEnd();
}
}
i am using 3ds format. why is this so?
You may be running out of memory on the card
Anyway display a 350K triangle model using old style glVertex loop, and especially changing the colour on each vertex is going to be very-very slow (as in several seconds per frame)
Before you do much more I would learn about vertex buffer objects. You may also need to reorder your model triangles to minimize the number of colour changes