Sign in to follow this  

Questions about how to improve my Applications speed

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

Situation states: I have a scene made up of several millions of triangles, and there are more than fifty textures and materials. So I have the data rearranged according to the texture information and the material information that is to say the geometry data has the same texture information or material information belongs to the same group. So I have 50s rendering list each one have the blocks of geometry data. And to avoid more state change during rendering I sort the list according to the cost of their switching. The rendering organization like below. | |----Texture One VBO1(vertex data not exceed 65K ) and element Buffer Object(EBO1)indexed list VBO2(Vertex data not exceed 65K) and EBO2 |----Texture Two VBO1 and EBO1… …… |----Material OneVBO1 and EBO1VBO2 and EBO2 …… The data has been preprocessed so I can load all of them at the beginning of my application to form the static Vertex Buffer Object by using GL_STATIC_DARW. But it is impossible for me to render all of them in each frame and also this is unnecessary, so I use the element buffer object to hold the indexed data that will be changed in each frame. Then I set the VBO of indexed data by using GL_DYNAMIC_DARW and bind the data per frame. As for culling, actually I just use frustum culling. Questions Here: Is there any problem with my methods in producing the VBO for the vertex and indexed data, and the data bindings? During walking through the scene I add the data that pass the frustum culling to a block that is bind to indexed buffer object. After drawing the block context is set to 0. And in the next frame, the data that is visual will be added to it again. For limit the index value under 65K, so there is a lot of VBOs in a render list. And each one use a suitable index array to draw. Here I use glDrawElements(). In my render part just like this: glBindbuffer(GL_ARRAY_BUFFER, txVBO1); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glTexCoordPointer( 2, GL_FLOAT, nVertexStride, TExOffset); glEnableClientState( GL_NORMAL_ARRAY ); glNormalPointer( GL_FLOAT, nVertexStride,NormalOffset); glEnableClientState( GL_VERTEX_ARRAY ); glVertexPointer( 3, GL_FLOAT, nVertexStride, VertexOffset); glBindBuffer(GL_ELEMENT_BUFFER, txEbo); glDrawElement(GL_TRIANGLES, Ebo.Numindex,GL_UNSIGNED_SHORT, Ebo.block); vertex struct as {float u ,float v, float nx, float ny, float nz, float x, float y, float z}the TexOffset and Normal Offset even the VertexOffset are the offset value to the list of vertex. Doing as the, I get not satisfying result, the speed is not reach 25 fps. What should I pay attention to and how can I get a more high speed? Thank you and wait for your help. Ps: my test PC is a computer with the CPU of P4 2.8GHz, 1GB system memory and GFX 5700 Ultra with 128M. And I am not using the shader program to rendering, and there is not any complex mapping effect.

Share this post


Link to post
Share on other sites
At first blush, I imagine it is the number of triangles you have. The 5700 Ultra cards have a theoretical max of about 300 million vertices per second. Assuming you are able to render 5 million verteces at just under 25 FPS, that's pretty good for a real-world number.

I don't know how many vertices your "several million triangles" is, so you do the math to see if that's good or not.

The first real step is to profile your code and figure out where the bottlenecks are. There are many good profilers out there, including AMD's CodeAnalyst and Intel's VTune.


If you are certain or strongly suspect it has something to do with the way you are using the api, you might be able to use gDEBugger to help diagnose the problem.

Share this post


Link to post
Share on other sites
Thank you frob.
I am sorry for not give the information clear.
In fact I have about 4 million triangles in the scene.

Because I am not sure about the strategy on how to render to scene, so I asked. If my processing of sort in state change and using VBO to load the vertex and indexed data is OK.

I will fellow the way to check the code using the tools.
Thanks again.

Share this post


Link to post
Share on other sites
err are you doing any of the following and if not maybe try:

frustum cull
occlusion cull
mipmapps
order objects to draw from nearest to furthest
draw with lower level of detail if further away

also do some sort of profiling - if you haven't got a profiler then simply create a log file - I tried everything to speed my game up but couldn't get it faster than 50fps, after writing to a log I found I was doing collision detection between 180 bots each frame that were nowewhere near each other - that's 32,400 tests a frame that weren;t needed

Share this post


Link to post
Share on other sites
Thank you ade-the-heat.
I employ LODs ,Mipmapps and frustum cull in my applications.
To take your suggestion, I will consider using occulsion culling and on the other hand, it seems that it is something with the codes,So I will profile to find the bottlenecks, and the unnecessary processings in each frame.
Thank you very much

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
well frob said the theoretical max was 300 million vertices / second,
4 million triangles = 12 million vertices (unless you use strips/fans) , 12*25 = 300 so it seems like 25fps should be pretty much what you can expect with that card if everything works perfectly.

Share this post


Link to post
Share on other sites

This topic is 4198 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this