Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Cirian

Undoubtedly shonky.

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

I''m currently about to optimise my engine, and am hoping to get some suggestions from the all powerful members of this forum The fact of the matter is: my engine code produces some terrible framerates. I''m at a loss to know exactly where to start optimising it -- and the entire engine architecture is to blame in some respects. Out benchmarking program generates 500 static objects, and one particle emitter of 500 objects. The all share the same texture. This, it should be noted, is a 2D engine. All the objects are quads. The framerate is calculated right at the end of the program, and although marginally lower than the actual fps, it is pretty accurate (successful calls to render loop / engine uptime). Framerate with all bells and whistles on: 19 fps Framerate with no alpha blending: 22 fps Framerate rendering with glPolygonMode(...,GL_POINT): 25 fps Framerate with no drawing code (everything other than glCallLists/glBegin - End): 85 fps Framerate with nothing on the screen: 300+ fps I have forayed into the world of vertex arrays (for the particle system), but the framerate when rendering as a vertex array is 3-4 fps less. I have disabled vsync, and although my 3D card (a TNT2 Ultra) is a bit on ye olde side, I do get about 120 fps in Quake III arena. As I said before, the engine architecture is, in many ways, to blame; static objects each have their own display list, and between 4 and 8 operations are carried out on each of them, per frame. The particle array is drawn in immediate mode, simply because it gave a silly performance boost over vertex arrays. Objects are held in std::list containers, and each object executes its own Draw() function. A partcle array is a single object with multiple polygons. The app is not running in software mode, and I have the latest drivers. I know that something very screwy is going on, and I am going to do a complete overhaul of the rendering subsystem in the next few days. I would request any ideas for improving performance, although it is undoubtedly hard for you to contribute without any source code, please do try... Also, I will answer any questions about the rendering loop that you want, and will post code snippets if asked (I''m not posting all ~5000 lines in one go, sorry =) --Cirian

Share this post


Link to post
Share on other sites
Advertisement
I just noticed that I neglected to include any sizes/resolutions... the test is windowed, at 640*480*32. Each static object is 32*32 pixels, and each PArray polygon is between ~2*2 pixels to ~128*128 pixels.

The all use a 32*32 grayscale texture.

Share this post


Link to post
Share on other sites
i don''t think 32x32 textures are properly aligned, i remember the recomendations for optimal speed/preformance are textures of 64x64, 128x128 and 256x256

Share this post


Link to post
Share on other sites
I tested it with a 64*64 texture, the fps dropped to 11 (!)

Edit: larger power-of-two values proceed to lower the framerate further....

Edit 2: I forgot to mention, glBindTextures is only being called once -- the engine works out that it was bound last, and never binds it again.

[edited by - Cirian on June 8, 2002 10:05:19 AM]

Share this post


Link to post
Share on other sites
Wait a second: you are dropping from 19fps to 11, if all you do is replace the 32² by a 64² texture ?!

You definitely have a real problem somewhere. Now, while your engine structure itself seems to be inefficient (too many display lists, function calls, etc), it will never create such a heavy performance breakdown. Are you sure that you aren''t uploading your texture every frame ? But even if you did, it wouldn''t drop that much, a 64² intensity texture is nothing.

Sorry to ask that (since you already mentioned it) but: are you sure that you are not in software mode ? Your whole problem description literally screams software mode. Do a quick check: are your textures filtered or not ?

/ Yann

Share this post


Link to post
Share on other sites
To check if you''re in software mode: use glGetString(GL_VENDOR). If the vendor is your graphics card maker then you''re in hardware. If it''s MS then you''re in software.

____________________________________________________________
www.elf-stone.com

Share this post


Link to post
Share on other sites
quote:

To check if you''re in software mode: use glGetString(GL_VENDOR). If the vendor is your graphics card maker then you''re in hardware. If it''s MS then you''re in software.


Doesn''t work, if he''s using a specific feature that is unsupported by his HW, and will cause a SW fallback. The texture filtering check is usually a good way to determine this (but not always either, depends on the specific fallback).

Share this post


Link to post
Share on other sites
Sorry about the glacial response time (Windows managed to orphan the system32 directory (!!!); thank God for CHKDSK and NTFS) -- glGetString produces "NVIDIA Corporation", the texture loading routine is being called 501 times (500 of them will return with a pointer to the managed container, so the texture is only being loaded once).

The engine loads min and mag textures with GL_LINEAR, and it is certainly filtering them succesfully (magnified textures are nice and antialiased). One thing to note though, switching to GL_NEAREST lowered the fps by 2.

I have some more stats too (taken from an email my partner sent me -- he has a GeForce 2):
Test 1:
800 object particle array (size 16x16, scaled to 20x20)
500 static objects (size 64x64, no scale)
1 static object (size 64x64, scale to 90x134)
fps: 22 (at fullscreen: 22)

Test 2:
800 object particle array (size 16x16, scaled to 20x20)
500 static objects (size 64x64, scale to 16x16)
1 static object (size 64x64, scale to 90x134)
fps: 38 (at fullscreen: 37)

Test 3:
800 object particle array (size 16x16, scaled to 20x20)
1 static object (size 90x134, scale to 640x480)
fps: 40 (at fullscreen: 42)

Test 4:
800 object particle array (size 16x16, scaled to 20x20)
1000 static objects (size 64x64, scale to 16x16)
fps: 36 (at fullscreen: 37)

-----------

Depressing....

[edited by - Cirian on June 8, 2002 10:06:53 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!