the most important thing is to find out whats causing the lack of speed or else youre just blindly stabbing in the dark wasting time/effort, it could be one of 100 things, amd/nvidia websites have pdf's on help on finding an apps bottlenecks. once u know whats causing the problem then u can solve it
eg download this pdf
http://72.14.253.104/search?q=cache:0MSvD5y2TH4J:ati.amd.com/developer/gdc/GDC2005_OpenGL_Performance.pdf+gdc2005_opengl_performance&hl=en&ct=clnk&cd=1&client=firefox-a
Raising 3D Game Frame rate
Quote:Original post by CRACK123
Just because you are loading obj files it doesnt mean that you cant use glDrawArrays or glDrawElements in OpenGL or VBO's. When you are loading an obj just construct the structure in such a way that you can send the data in one go during a render call for each model using glDrawArrays or glDrawElements. If you can manage that then you can easily modify the code to use VBO's. That should probably give you a major framerate boost from glVertex3f calls.
Is the format of the structures on the NeHe tutorial the only way that they can be set up to be loaded into the VBO? The way that they load data into a vertex array(inm looking at this site: http://www.songho.ca/opengl/gl_vertexarray.html) is a lot like how i have my data set up now. Can i use the vertex array structure to load it into a VBO? or do i have to format it like the NeHe tutorial? I am using vectors too, does that make a difference than arrays, which is what NeHe uses.
also, when i use glEnable(GL_CULL_FACE);, it mostly works, but makes most of my walls not appear. How does this calculate what is the front and back of the face?
Also i made a counter, and turns out i am using 19k triangles if that matters
[Edited by - bovinedragon on October 3, 2007 9:15:07 PM]
u have not found out whats causing the bottleneck
19,000 tris is nothing for todays cpu's even for immediate mode, ie u will implememnt VBOs + then come back in 2 days time + say it doesnt help :) (though using VAs is always good)
so i repeat
the most important thing is to find out whats causing the lack of speed or else youre just blindly stabbing in the dark wasting time/effort, it could be one of 100 things, amd/nvidia websites have pdf's on help on finding an apps bottlenecks. once u know whats causing the problem then u can solve it
eg download this pdf
http://72.14.253.104/search?q=cache:0MSvD5y2TH4J:ati.amd.com/developer/gdc/GDC2005_OpenGL_Performance.pdf+gdc2005_opengl_performance&hl=en&ct=clnk&cd=1&client=firefox-a
19,000 tris is nothing for todays cpu's even for immediate mode, ie u will implememnt VBOs + then come back in 2 days time + say it doesnt help :) (though using VAs is always good)
so i repeat
the most important thing is to find out whats causing the lack of speed or else youre just blindly stabbing in the dark wasting time/effort, it could be one of 100 things, amd/nvidia websites have pdf's on help on finding an apps bottlenecks. once u know whats causing the problem then u can solve it
eg download this pdf
http://72.14.253.104/search?q=cache:0MSvD5y2TH4J:ati.amd.com/developer/gdc/GDC2005_OpenGL_Performance.pdf+gdc2005_opengl_performance&hl=en&ct=clnk&cd=1&client=firefox-a
Quote:Original post by zedz
u have not found out whats causing the bottleneck
Yeah thx for the link, i will look into it and post what I find. I will try VBO just cuz I should do that anyway.
EDIT:
ok i read the pdf, and this is what I came up with
I tested on crappy comp, probably isnt the best place to test it.
Change with resolution, changes up to 1 FPS , so not Pixel bottleneck?
Turning off Lighting, raised FPS from 5 to ~6.5, not really Vertex bottleneck?
Reducing rendered triangles by 1/2, raised FPS from 5 to ~8.5, Submission/fetch bottleneck, this is what VBO fixes right?
"CPU Bottlenec: Find API versus application time" - What does this mean?
Also, i wrote a simple frustrum culling function, and If I stand face away from most of my scene, I can reduce it from 19k triangles to ~6k and my FPS jumps from 5 to ~25!! What type of bottleneck would this classify as?
[Edited by - bovinedragon on October 4, 2007 6:15:40 PM]
Quote:Original post by bovinedragon
Also, i wrote a simple frustrum culling function, and If I stand face away from most of my scene, I can reduce it from 19k triangles to ~6k and my FPS jumps from 5 to ~25!! What type of bottleneck would this classify as?
Your culling algorithm is reducing the number of triangles submitted to the API by ~1/3 so it's a "Submission/fetch bottleneck".
Culling will reduce the "submission" times, and VBOs should reduce the "fetch" times, so implementing VBO's and a decent culling algorithm should fix most of your problems (hopefully) ;)
Quote:Original post by bovinedragon
"CPU Bottlenec: Find API versus application time" - What does this mean?
If you start/stop a timer before/after any openGL function calls, and add up all these time values for each frame, then you can find out what percentage of time in each frame is being spent inside the OpenGL API compared to the amount of time spent executing your own code.
For example, if you were doing lots of Physics or AI in your code, then that could be to blame for the lousy FPS, not the graphics at all. In this kind of situation you might find that each frame takes 20ms, but only 1ms is spent inside the graphics API.
your framerate sounds suspiciously low perhaps u dont have hardware acceleration
try
cout << glGetString( GL_VENDOR ) << glGetString( GL_RENDERER ) << endl;
whats your cpu/graphics card?
have u tested other ppls apps?
though even if its software, changing resolution should show a huge difference
are u testing between 2 completely different sizes eg 320x240 + 1024x768 (+ not say 1024x768 + 800x600)
possibly u are going
for ( i=0; i<19000; i++ )
{
glBegin( GL_TRIANGLE );
glVertex3fv(a); glVertex3fv(c); glVertex3fv(c);
glEnd();
}
if so u need to do
glBegin( GL_TRIANGLE );
for ( i=0; i<19000; i++ )
{
glVertex3fv(a); glVertex3fv(c); glVertex3fv(c);
}
glEnd();
try
cout << glGetString( GL_VENDOR ) << glGetString( GL_RENDERER ) << endl;
whats your cpu/graphics card?
have u tested other ppls apps?
though even if its software, changing resolution should show a huge difference
are u testing between 2 completely different sizes eg 320x240 + 1024x768 (+ not say 1024x768 + 800x600)
possibly u are going
for ( i=0; i<19000; i++ )
{
glBegin( GL_TRIANGLE );
glVertex3fv(a); glVertex3fv(c); glVertex3fv(c);
glEnd();
}
if so u need to do
glBegin( GL_TRIANGLE );
for ( i=0; i<19000; i++ )
{
glVertex3fv(a); glVertex3fv(c); glVertex3fv(c);
}
glEnd();
Quote: I am rebinding the texture and making a new GL_triangle this for each triangle in the model,
you should bind your texture only once... something like this:
BindTexture2D(...)
glBegin(GL_TRIANGLES);
for (i=0;i<numTriangles;i++)
{
glVertex3f(...);
}
glEnd();
make sure the loop doesn't include texture binding or glEnable calls, they are very slow when put in a loop
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement