Archived

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

The Wizard Of Oz

performance problems :((

Recommended Posts

hi! i''m loading an .ASE world and it all works fine till i try moving through it. it''s very, very slow ( i have an AMD 1.2 GHz, 256 Mb RAM etc. ). even when i try to load a single object ( a sphere ) which consists of 8066 vertices & 16128 faces it''s also too slow ( about 10 fps ). can anyone please help me? i''ve already loaded it using display lists as i was told it''ll be much faster. is there any way to draw an object only once so that when the scene is being drawn over and over again the object isn''t? thanx in advance follow the yellow brick road

Share this post


Link to post
Share on other sites
v71    100
16128 faces is pretty high , are you sure that you are safely locking the arrays when drawing or that you are redrawing each single triangle because the triangle''s number will rais by a 3 factor if you draw them as a stand alone triangle ,....

Share this post


Link to post
Share on other sites
here''s the part of my program:

struct OBJECTSK
{
int number_of_vertices,number_of_faces;
struct v{float x,y,z;} vertex[8066];
struct f{int vertex[4];} face[16128];
struct n{float x,y,z;} normal[16128];
} objectK[1];

void glLoadObjectK(char *File,int slot)
{
FILE *filename;
int x,i,j;
char line[200];

filename=fopen(File,"r");
fscanf( filename, "%s", line );
fscanf( filename, "%i", &objectK[slot].number_of_vertices);
fscanf( filename, "%s", line );
fscanf( filename, "%i", &objectK[slot].number_of_faces);

fscanf( filename, "%s", line );
fscanf( filename, "%s", line );
for (x=0;x {

fscanf( filename, "%s", line );
fscanf( filename, "%i", &i);
fscanf( filename, "%f", &objectK[slot].vertex[x].x);
fscanf( filename, "%f", &objectK[slot].vertex[x].z);
fscanf( filename, "%f", &objectK[slot].vertex[x].y);
}
fscanf( filename, "%s", line );
fscanf( filename, "%s", line );
fscanf( filename, "%s", line );
for (x=0;x {

fscanf( filename, "%s", line );
fscanf( filename, "%i", &i);
printf("%i) ",i);

fscanf( filename, "%s", line );
for (j=0;j<3;j++)
{
fscanf( filename, "%s", line );
fscanf( filename, "%i", &objectK[slot].face.vertex[j]);
}


for (j=0; j<5;j++) //irrelevant code
{
fscanf( filename, "%s", line );
fscanf( filename, "%i", &i);
}

}
fscanf( filename, "%s", line );
fscanf( filename, "%s", line );
fscanf( filename, "%s", line );
for(x=0;x {
fscanf( filename, "%s", line );
fscanf( filename, "%i", &i);
fscanf( filename, "%f", &objectK[slot].normal[x].x);
fscanf( filename, "%f", &objectK[slot].normal[x].y);
fscanf( filename, "%f", &objectK[slot].normal[x].z);
int hk;
for(hk=0;hk<3;hk++)
{
fscanf( filename, "%s", line );
fscanf( filename, "%i", &i);
fscanf( filename, "%i", &i);
fscanf( filename, "%i", &i);
fscanf( filename, "%i", &i);
}
}
fclose(filename);
}

now when i''ve loaded the file into memory i''ve created a list:

kugla=police+1;
glNewList(kugla,GL_COMPILE);
for(slot=0;slot<=0;slot++){ //KUGLA.ASE
glBegin(GL_TRIANGLES);
int x;
for (x=0;x < objectK[slot].number_of_faces;x++)
{
glNormal3f(objectK[slot].normal[x].x,objectK[slot].normal[x].y,objectK[slot].normal[x].z);
glTexCoord2f(0,0);
glVertex3f(objectK[slot].vertex[objectK[slot].face[x].vertex[0]].x*FAKTOR,objectK[slot].vertex[objectK[slot].face[x].vertex[0]].y*FAKTOR,objectK[slot].vertex[objectK[slot].face[x].vertex[0]].z*FAKTOR);
glTexCoord2f(0,1);
glVertex3f(objectK[slot].vertex[objectK[slot].face[x].vertex[1]].x*FAKTOR,objectK[slot].vertex[objectK[slot].face[x].vertex[1]].y*FAKTOR,objectK[slot].vertex[objectK[slot].face[x].vertex[1]].z*FAKTOR);
glTexCoord2f(1,1);
glVertex3f(objectK[slot].vertex[objectK[slot].face[x].vertex[2]].x*FAKTOR,objectK[slot].vertex[objectK[slot].face[x].vertex[2]].y*FAKTOR,objectK[slot].vertex[objectK[slot].face[x].vertex[2]].z*FAKTOR);
}
glEnd();
}
glEndList();

i''ve loaded it in InitGL section and displayed it in the drawing section:

glCallList(kugla);

and i''ve only been able to get a slideshow!

can someone tell me what''s wrong with this code

please advise!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
v71:

16128 is pretty *nothing* for a modern 3D card. You should get several hundert fps on such an object.

quote:

are you sure that you are safely locking the arrays when drawing or that you are redrawing each single triangle because the triangle''s number will rais by a 3 factor if you draw them as a stand alone triangle



Sorry, but that''s pure nonsense.
The triangle number will *never* rise, except for frustum clipping and such. The number of transformed vertices may rise, but only if the vertex stream is badly organized (vertex cache misses).

a) He is using display lists, not VAs, so you can''t lock them, since DLs are ''locked'' by default.

b) Locking vertex arrays will help, but only on static geometry, and it''s use is outdated and not recommended for newer 3D cards (GeForce+). Especially on nVidia boards, you should use vertex_array_range instead.

Oz: What 3D card are you using ? Are you sure that you aren''t in software mode ?

- AH

Share this post


Link to post
Share on other sites
HelplessFool    451
how many lights are you using?

also, do you have polygon culling enabled?
try updating your drivers.

BTW anonymous dude:
don't knock on other people.at least v71 suggested something. software mode is a lot slower that what he seems to be getting.

Edited by - HelplessFool on November 12, 2001 5:08:10 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
BTW, HelplessFool:

> don''t knock on other people.at least v71 suggested something

I''m sorry, but what he suggested was misleading and wrong. This won''t help Oz very much.
> software mode is a lot slower that what he seems to be getting.

HAve you used software mode ? 16128 faces at 10fps in software mode on a *1.2 Ghz K7* is absolutely realistic - fact is that on such a processor it''s likely that you would even get more fps in software. Esp. without textures.

Please think before posting. Thanks.

- AH

Share this post


Link to post
Share on other sites
avianRR    100
You might not be "intentionaly" using software mode but depending on the video card & drivers it might be using a software mode. One of the nehe tutorials show how to get the current renderer. Maybe you should check that out and put a couple lines at the end of your Init function to display the renderer''s id string in a message box so that you can confirm that you got a hw renderer. I used to have that problem with my old voodoo3 2000 card.
Also there''s no gaurentee that a display list will be stored on the video card. meaning that the vert''s will still have to be passed through the video buss (especially with larger models).
And one last thing. drawing 16128 triangles one at a time takes 100-300% more time.
A project I''m currently woking on...
Athalon 1G w/ GeForce2 MX
131072 triangles drawn useing vertex lists and GL_TRIANGLE_STRIP as 256 strips = 45 fps = 5898240 tri''s / sec.
So, depending on your video cards 3d capability you should be able to get a lot better performance.

Share this post


Link to post
Share on other sites
RipTorn    722
I don''t want to patronize here, but can you actually see the object? and does it look correct? because I''ve found that if a triangle is passing through more than 2 clip frustrum clip planes (very often caused when data isn''t loaded correctly, or triangles are not referencing the correct vertex data)... This can have an amazing effect on frame rates, I have seen 10,000 triangles pulling 2-3fps, where with correct vertex assignment, 200.

as for the software thing. that is very unlikly.

another possiblity: (I have not used .ASE''s before, so I''m likly wrong) the texture coords in the file _may_ be pixel based... and if you''re not using mipmapping, you may be getting pixel strides in the 100''s... a recipie for disaster

Share this post


Link to post
Share on other sites
v71    100
Hey Hey relax i was thinking the guy used vertex arrays,
by the way all those triangles are pretty high for me but i got a 450 pIII but not for someone else

Share this post


Link to post
Share on other sites
zedzeek    529
16,000 tris is to much to stick in one display list or vertex array call. break it up into say 8 calls of 2000 tris + performance should improve. also check the faq at www.opengl.org for optimization help

Share this post


Link to post
Share on other sites