Jump to content
  • Advertisement
Sign in to follow this  
Vanshi

OpenGL Need help for better performance

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

Hi guys, I am working on a project that involves importing textured 3ds max objects of the .3ds format into OpenGL . i have been able to do that but i have observed that it takes a lot of time to render the scence and loading just 4 buildings(.3ds format) takes upto 250 MB. The framerate is very low too. Can anyone give tips/tricks on how to improve performance and reduce memory usage? Would appreciate ur help a lot. Thanx.

Share this post


Link to post
Share on other sites
Advertisement
Hi. You'll need to give much more information than that before anyone can help. Firstly can you tell us how many vertices/triangles are in your models. And secondly what is your hardware spec and what drivers you have got. 250Mb is way too much theres something very wrong there. For improving performance have a look at vertex buffer objects or even display lists if youre not already using them. Post more details or some code and you'll get help.

Share this post


Link to post
Share on other sites
You're probably trying to load four huge buildings into RAM, which implies they contain a lot of polygons. At least tell us what size the 3ds files are (or better yet, as comedypedro said, how many polygons each building consists of). You're probably trying to render as many as a several million polys (based on your RAM usage and framerate), which - unless you're doing things very inefficiently - would clog up even the newest hardware.

Share this post


Link to post
Share on other sites
I am sorry for that really low amount of information. But being a newbie i didn't know much what to ask. I did find out the polygon count for my models.
1:32668 polygons file is 830 KB
2:59610 polygons --1.54 mB
3: 4058 polygons --116 KB
4: 224 polygons -- 11.7KB

so i guess from the earlier replies that i should try to reduced the polygon count for the .3ds objects. Any other suggestions are welcome. Thanx for ur time.

Share this post


Link to post
Share on other sites
Those polygon counts seem pretty reasonable for current hardware and shouldn't under any circumstances take up 250 megabytes in RAM. Check your code for memory leaks and be sure to free up all temporarily allocated objects. Can you also post your system specs? For instance, I wouldn't expect much over 4-5 FPS on a GeForce 2 with close to 100000 polygons on the screen.

Share this post


Link to post
Share on other sites
Agreed, that amount of polys shouldnt be a problem for a decent speced machine. How do you know that 250mg of memory is being used?? Or maybe you meant 2.5megs?? 830k + 1.54 mB + 116 KB + 11.7KB = about 2.5mg so Im assuming thats what you mean. If thats giving your machine trouble then like irreversible says youre doing something wrong. Let us know your specs and the relevant code and we'll see what the problem is.

Share this post


Link to post
Share on other sites
Tip for better performance: use a display list. This makes material changes pre-calculated, and that translates to much higher frame rates (I had my framerates drop 4 times by using a display list!). This has nothing to do with memory though. After you compile the display list, delete all the mesh info you have loaded (vertices, materials, etc).

There are also other options like VBO's or vertex arrays which you could look into.

Share this post


Link to post
Share on other sites
Thank u for ur replies everyone.
My machine specs are as follows:
AMD 3000+
MSI RS-480 m2 IL motherboard
onboard video(ATI Xpress Chipset)
1 GB RAM

the code can be found on APRON TUTORIALS for loading 3ds objects into OpenGL
http://www.morrowland.com/apron/tut_gl.php
3DS loader with just a few changes in the code for placing multiple objects into scene and some camera movement with the keyboard.
I found the memory usage with the Taskmanager

Share this post


Link to post
Share on other sites
Well Im not really an expert on hardware but I reckon the problem or part of the problem lies with your hardware. The CPU is fine but for graphics youre probably better of with a dedicated video card - even something cheap like an FX5200 would do the job. Like I said Im not really up on hardware so maybe someone else can confirm this.

I was able to optimise my 3ds code a bit by using temporary pointers to avoid excessive dereferencing i.e. if you have something like


for(iCurrectVertex = 0; iCurrectVertex < NumVerts; iCurrectVertex ++)
{
pModel->pObject[iCurrentObject]->pVertexList[iCurrectVertex] = some_value;
}





you can speed things up by



float* pVertexList = pModel->pObject[iCurrentObject]->pVertexList
for(iCurrectVertex = 0; iCurrectVertex < NumVerts; iCurrectVertex ++)
{
pVertexList[iCurrectVertex] = some_value;
}





Hope this helps, and Id also consider using ms3d over 3ds, its a much more user friendly format - check the other tutorial on that link you gave.

Share this post


Link to post
Share on other sites
Hi guys,
thanks for all the suggestions. i will try them out and let u know what the results are. but i cant use ms3ds format for my project. it has to be .3ds formats. once again thank u for all ur concern and time.

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!