Engine performance issues

BlitzMax Forums/OpenGL Module/Engine performance issues

Warner(Posted 2011) [#1]
Hi! I'm writing an OpenGL (1.0+) engine in Bmx, but it is about 50% slower than Blitz3D. I think that is a big difference.

I'm testing it with the maplet 'test.b3d' model.
On Blitz3D, the same program runs at about 100 fps. In my engine, it runs at about 50 fps.

In my engine I have the following optimisations:
-VBO's (has no huge advantage on my system +/- 1 frame difference)
-Matrices are only updated if needed (saved about 5 frames)
-As much inline code as possible (no Matrix/Quaternion/Vertex types, just float arrays and regular functions) (saved about 10 frames)
-Floats instead of Doubles (saved about 5 frames)
I also have frustum culling, but that doesn't apply to this model, since it is a big model that is allways in view.

I can get the engine to run at 100 fps, by disabling multitexturing, and by not clearing the screen.

Could this slowness be caused by OpenGL/DirectX performance issues on my card? Is there any way to find that out? I have a very bad intergrated videocard. (SiS)
Are there any more optimisations that I could think off?
Any advice appreciated.

Last edited 2011

SLotman(Posted 2011) [#2]
On older hardware (or cheaper, like SiS or Intel), DX7 (Direct-X in general) is much better supported than OpenGL.

I have the same problem with miniB3D - specially regarding animations: it is much slower than Blitz3D is. On good hardware you won't notice the difference, but on the lower end, Blitz3D can get much better results - probably - because of DX7.

This is one of the problems of OpenGL in general - video drivers (on Windows) are heavily optimized for DX, and just implemented (sometimes very poorly) for OGL.

I don't think there's nothing to be done - but if there is, I would very much like to hear it too... optimizing miniB3D performance even more would be awesome!

b32(Posted 2011) [#3]
Ah, that makes sense. However, I find a 50% difference quite a lot.
Maybe my hardware somehow emulates some of the openGL functions. Say, multitexturing and vertex buffers?
Hopefully I'll find some ways to optimize it more. I would like to get to 75 fps. Maybe I have to think about creating some sort of quadtree system? if that is the right term.. I mean a system that culls parts of the mesh.

Last edited 2011

AdamRedwoods(Posted 2011) [#4]
I can say that OpenGL on Intel's chipsets for Windows are not as well made as compared to ATI or Nvidias, so I suspect performance with OpenGL will always be behind. There just no one to enforce compliance, as I'm sure Microsoft does for DirectX.

But there are ways to find small performance increases, have you tried this idea?

Also remember that in Blitzmax, using Globals is slow. If you find a Global in a loop, try breaking it out as a Local variable.

And I'm sure you've already reviewed all this (part 3):

ProfJake(Posted 2011) [#5]
Just a small hint: In BlitzMax Arrays are Types, too.
So if you are really considering to increase the performance maybe you should do that stuff in plain old C instead..

Keep going, I'm looking forward to see your engine in action : )

Warner(Posted 2011) [#6]
Thanks Adam, DTC, SLotman, I'll release the engine as opensource when (or if offcourse..) it gets more complete.

ImaginaryHuman(Posted 2011) [#7]
Or instead of arrays use pointers and memory access, but really it's about the same speed.