🔒 Locked
performance problems :((
Advertisement
Original Post
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
i''m not. i''ve loaded everything in the InitGL() section...
follow the yellow brick road
follow the yellow brick road
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!
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!
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
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
i have an ASUS V3800 graphics card and i''m not using any lights at this point yet.
i''m not using software mode

i''m not using software mode
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.
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.
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
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
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement