OpenGL or DirectX ?

Hi everyone ! I’m new to Panda3D and I’m impressed by this wonderful engine !

I already developped a bit using OpenGL for a simple project (OpenGL Orbiter Mesh Viewer). It worked great, but I was affraid by the processor use. It was only a mesh viewer and when I redraw the scene, it uses a lot of the processor. Therefore, I tried DirectX 9.0c. This one was really powerful on my machine. When redrawing at each frames, it didn’t use the processor (or just 1%). Then, because my C++ knowledge are not very high, I turned myself to a 3D engine.

I did the simple tutorial of Panda3D (the demo with the walking panda). Using OpenGL, I have 17 to 20% of processor use. Using DirectX 9.0, I have 1%. However, when I try some sample programs of Panda3D using DirectX, some doesn’t work, others (like the demo) are lagging a bit (it’s hard to explain, English is not my native language). The image hold for a few milliseconds but it is not a frame rate problem. The model just doesn’t move smoothly.

So, when using Panda3D, is it better to use OpenGL or DirectX ? I don’t want to start a debate about how OpenGL or DirectX is good, I just want to know if OpenGL will be able to handle a pretty big program using the processor like it’s doing right now or if I’ll have to use DirectX to have good performances (but it looks like it’s not totally supported, OpenGL seems to be the principal rendering API in Panda3D).

Thank you in advance !

Hi, and welcome to Panda.

OpenGL and DirectX are two different interfaces onto the same graphics hardware. With a few minor differences in functionality, they are pretty much equivalent in power and performance. The differences you are seeing are probably not due to fundamental weaknesses in either API, but rather may be issues in your particular graphics driver installation.

For instance, if you have never installed a graphics driver, you may be using the stock Windows OpenGL driver instead of an OpenGL driver specifically written for your graphics card, and you may therefore be running OpenGL in software emulation mode without realizing it (which will mean it requires a lot more processing power). So it may be a good idea for you to try updating your graphics drivers to see what happens to your OpenGL performance.

I’m not sure what’s going on with your DirectX issues. That problem doesn’t sound familiar to me, although I have seen issues with frames getting queued up and rendered late in buggy graphics drivers. This can result in what appears to be laggy performance, such as you describe. In this case, updating your graphics drivers is also a good idea to try.

It is true that most development is done to the OpenGL side in Panda, primarily because that API is more universal to different operating systems. But in general, there is not a strong reason to prefer one or the other in Panda, unless you are taking advantage of the features that we haven’t implemented on the DirectX side.

David

Thank you David ! :smiley:

My drivers are pretty update (version 266.58, the current release is 270.61 but when I installed it, I had strange bugs). However, my graphic is pretty old and not very powerful. It is a GeForce 6200 bought in 2005.

Anyway, I will let users choose between OpenGL and DirectX. It is probably not Panda3D related but hardware related. They’ll see which one works best on their computer.

Another thank you !