Jump to content
  • Advertisement
Sign in to follow this  
coorn

OpenGL My program is slow

This topic is 4492 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

In one test scene in my game I have 6 Draw calls, 10 700 vertexes and 18 500 tris per frame. I have 38 fps on a RADEON 9800 Pro - 2.2 GHz. This seams really slow? I don't use VBOs, I use normal glDrawElements calls. I know program is NOT fill rate limited or some other non-geometry bottleneck. The amount of vertex data is proportional to my fps. Here comes the strange part, if I render my surfaces in 2 passes instead of one the fps goes to 34 fps, should it not be half of 38 fps? (I know I am still not fill rate limited) If I bind all my OpenGL calls to null functions I see that almost all the CPU time is spent inside OpenGL and the driver. What should I do to make it faster? I know I could start using VBOs. What performance gain can I expect with VBOs? But even if I use VBO I think is strange that my game goes extremely so slow without it.

Share this post


Link to post
Share on other sites
Advertisement
Make sure that your vertex, color, and normal data is 'packed' (ie. no gaps between elements). OpenGL can zip right through your arrays if each one is kept separately and the elements in each are right next to each other, without any extraneous data.

Another method, along the same lines, would be to use interleaved arrays (still with no extra data between elements). Some people have mixed results using interleaved arrays, but in my previous projects, it yielded sizeable performance gains.

What are you doing to texture and light your geometry? Are you having OpenGL calculate normals every frame? Are your textures' dimensions not powers of two?

That's all I can think of, off the top of my head. Hope that helps.

Share this post


Link to post
Share on other sites
err just in case you haven't done this:

1. frustum cull everything
2. occlusion cull complicated objects
3. draw objects in order nearest to furthest
4. VBOs will up the rate a lot more maybe from 20% upwards
5. display lists ?
6. draw distant objects/terrain sectors with less vertices - level of detail, eg a person 200 yards away can be drawn as little more than matchsticks
7. mipmap your textures - choosing the most suitable mimap method made a gain of about 30% in my game - with a little lower quality
8. the wgl command - how many bits per pixel have you set - I found the fastest for me was 24 (as I'm using rgb channels with 8 bits for each) - 32 will give best quality but slower, 16 bits will slow it right down.

all the above are pretty easy to do

hope this helps

ade

Share this post


Link to post
Share on other sites
I forgot to add:

a) reduce the max distance see-able - the less far you can see the more you will cull in frustum culling

b) narrow the angle see-able - think this is in setting the camera position, eg if you can see at angle of 45 degrees you'll be seeing an area almost 1/3 times the coverage of if the angle is 75 degree - this means 3 times more items being culled.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!