Speed Problem


I am quite new to OpenGL (working on it for about 3-4 months) and I am currently developing an application which creates a 3D model of a wing of our office and lets a person walk through it.

The Application:

As of now I have completed building the model (ours is - of course - a software company). The model contains the following objects -

Walls, Desks, Ceiling, Floor - created by specifying vertices. I used glBegin(GL_POLYGON)… glEnd() to build the display lists. Some of them, for example, the floor and the ceiling are also Texture Mapped.

Chairs, Computers, Phones, Pots - created by loading objects from .3ds files downloaded from the net. Since I didn’t have a good .3ds loader, I used 3D Exploration from XDSoft to export them to .obj models and used Nate’s Wavefront Object File loading code to load them. The class converts
all objects into display lists. Each of these files contain object with around 1000 vertices on an average.

Materials and Lighting - since I wanted to concentrate on getting the geometry of the model right first I’ve added just 1 White light and all objects are made created are made of the same material.

Keyboard Navigation - user can move around the model using the arrow keys to move Forward (Up Arrow Key), Backward (Down Arrow Key), Turn Left (Left Arrow Key), Turn Right (right arrow key), Move Up (‘A’ Key) and Move Down (‘Z’ Key).

The Development Environment:

I am developing this software on a Pentium II 350 Mhz machine with 128 MB RAM. It doesn’t have a 3D card, has a normal video card with 4MB VRAM. I am using SGI’s OpenGL Implementation as I heard that it is better for non-accelerated systems and is optimized for MMX processors (But I didn’t find any significant speed improvement over the Microsoft’s implementation). The OS is NT 4.0 (Service Pack 5.0) and I am using VC 6.0. I am working on 800 X 600 mode.

The Problem(s):

Finally coming to the problem I am facing. The main problem I am facing is that the speed is very very poor. I am hardly getting 1 Frames/s. I’ve done face culling wherever possible to minimize the number of polygons. But still since those .obj files contain objects huge number of vertices
the polygon count is still pretty high. I am also using Display Lists everywhere possible to store geometry. As of now I am rendering the entire scene each time the screen is redrawn. And I am sure that the speed is going to go down further, once I add more Lighting to the scene.

1 - Is there a way in which I can improve the speed at which my application works?? I am sure that I can improve the speed even without the use of 3D acceleration b’cos I saw applications like Quake 2 or Doom/Wolf3D etc, working really fast even without 3D cards. How do these applications achieve this kind of speed? This is the problem I intend to address first. Please do mention any good sources of information too if possible.

2 - And if I find time, I would also like to implement some Collision Detection into the program. How do I do that?

Any help in this regard would be greatly appreciated. I would love to send in Screenshots of my application on request. Thanks in advance.


Some stuff comes to mind:

  • Have you read the stuff about wich “paths” are optimized in SGI OpenGL?.

  • Try optimze/reduce the number of triangles in the models.

  • Also cull entire objects wich arent in view frustum.

  • You are probably fillrate limited, switch do lower bits/pixel. Smaller window.

  • If you can live without lightning switch it of.

Quake1-2/Doom etc didn’t use OpenGL for software rendering.


What AndersO said, plus:

  1. Make sure you don’t have texture filtering enabled.

  2. Use preset vertex colours rather than dynamic OpenGL lights.

  3. Cut down the geometry - 1000 verts for a plant pot is crazy for an unaccelerated realtime app.

  4. For culling, look at portals and/or BSPs.

But at the end of the day, it’s fillrate that’s killing you. You will not get an app running fullscreen at a decent rate on that system. That’s it. End of story. Get a faster box, or run in a small window, or both.