• Advertisement

Archived

This topic is now archived and is closed to further replies.

.3ds model loading and low frame rate

This topic is 5098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve loaded 3ds format model with 38k triangles and when I display it with OpenGl I get about 10 frames per second. Is it normal?? Or is there any way to quick draw all these triangles.

Share this post


Link to post
Share on other sites
Advertisement
How are you sending those triangles to opengl?
Also note that it''s hard for us to tell if 10 fps is normal or not without knowing anything about your system specs.

Share this post


Link to post
Share on other sites
That''s pretty normal if I''m thinking correctly because you didn''t use a display list.

Share this post


Link to post
Share on other sites
I tried lists, but I don't know if I'm doing everything alright.

In init function I do:

ModelList = glGenLists(1);
glNewList(ModelList, GL_COMPILE);

for(int i = 0; i < g_3DModel.numOfObjects; i++)
{
(size() is in the vector class)
if(g_3DModel.pObject.size() <= 0) break;

t3DObject *pObject = &g_3DModel.pObject;
if(pObject->bHasTexture) {


glEnable(GL_TEXTURE_2D);
glColor3ub(255, 255, 255);

glBindTexture(GL_TEXTURE_2D,g_Texture[pObject->materialID]);
} else {


glDisable(GL_TEXTURE_2D);

glColor3ub(255, 255, 255);
}

glBegin(g_ViewMode);


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(g_3DModel.pMaterials.size() && pObject->materialID >= 0)
{

BYTE *pColor = g_3DModel.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();
}
glEndList();


and later in drawing function is:

glPushMatrix();
glCallList(ModelList);
glPopMatrix();


Is it good?


[edited by - vireck on March 7, 2004 8:57:42 AM]

Share this post


Link to post
Share on other sites
Nope, not good. Try vertex arrays instead. And if you need more speed look into VBO''s and stuff like that.

Share this post


Link to post
Share on other sites
I''ve used vertex arrays and it''s still 10-12 fps. But when object is smaller (farther) it grows even to 200 fps

Share this post


Link to post
Share on other sites
sounds like fill rate limit to me
does your model take up most of the screen ?
and with 38k polys then you are getting ALOT of overdraw most likely which contributes to the fill rate limit. so i would say the 10-12 sounds about right


"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

Share this post


Link to post
Share on other sites
yes, when I have 10-12 fps it takes most of the screen so it must be fill rate limit. Is it possible to speed up that?

Share this post


Link to post
Share on other sites

  • Advertisement