Buffer Swap is taking most of my rendering time

I only get 29 FPS for my OpenGL applications on Windows 7 Ultimate 32 Bit, SP2 and P4 2.6GH on NVIDIA FX5200.

I think it may be because of my system hardware below are my system specification.

OS: Window 7 Ultimate 32 Bit
Processor core i3 4th Generation
Memory HPE 815098-B21
Hard drive SATA 420 GB

Is there any way to Reduce OpenGL Rendering time?

Is there any solution of this problem

That’s a measurement artefact. Most OpenGL functions simply append a command to the queue and return immediately. A buffer swap performs an implicit glFlush, which sends any queued commands to the GPU. If the application is GPU-limited (which is usually the case), eventually the GPU-side buffer will fill up and the client will have to wait until there’s enough space in the GPU-side buffer to send the commands.

So if you’re performing timing on the CPU, the buffer swap will end up taking most of the time because that’s where the client waits for the GPU to actually execute the commands it’s been sending.

Possibly, but it depends entirely upon the code. The code might be inefficient, or maybe it’s just asking too much of the GPU.

You can use GPU-side timing (glBeginQuery/glEndQuery with GL_TIME_ELAPSED and glQueryCounter with GL_TIMESTAMP) to measure how long specific commands (or groups of commands) take to execute.

That’s a very old system with all discontinued components.

It’s not clear from your post if you have a Pentium 4 or a Core i3 4th Gen, but both are old, with the Pentium 4 being particularly old.

A 32-bit desktop OS is very unusual these days.

The GeForce FX 5200 is definitely your weakest link. That’s almost 20 years old, it was a very weak GPU even when new, hasn’t gotten better with age, and while it claimed OpenGL 2.0 support, some OpenGL 2.0 features would punt it back to software emulation.

The overwhelming probability is that your code is slow because your system is slow. You’re running outdated, weak components that are no longer supported by their manufacturers.

Your choices amount to either simplifying your code, buying a new system, or (if you’re unable or unwilling to do either) accepting that you’ll get low performance.

What GClements and mhagain said. In addition, disable VSync and retime your frames (29 fps is suspiciously close to 2 60Hz VBlank intervals).

You’ve provided almost no info on what you are actually doing, nor have you really defined the problem.

Stop drawing everything, just call SwapBuffers() + glClear() + glFinish() each frame, and time+optimize that. Then gradually add in content, retiming at each stage. That’ll show you where your time is going. Profile to determine whether you’re just submitting it very inefficienly (CPU bound) or hitting the limits of your GPU’s rendering performance (GPU bound). However, you need to seriously evaluate the cost/benefit of: 1) just upgrading your system and 2) spending precious dev time on such old hardware with (in many cases) limited future benefit on modern hardware.