OpenGL or DirectX - how is that implemented?

Hi :slight_smile:

Its me asking silly questions again, so please don’t get mad at me. :slight_smile:

In Config.prc you can choose to either use OpenGL or DirecX(Something) as renderer.

Now I wonder about several things (my source code knowledge is quite bad, thats why I need to ask) - are both 3D-“Languages” implemented everywhere where 3D is involved and thus there is just a question like "if renderer == OpenGL -> do this, elif renderer == DirectX8 do that,…)

Or is Panda3D creating its 3D stuff in its own “language” and then is just translated into OpenGL or DX?
How (in easy words) would it have to be done if you want to integrate another 3D language? (a “stupid” example: GLIDE)
Is it possible at all without completely rewriting Panda3D?

Regards, Bigfoot29

That’s right–we have defined a Panda3D class (GraphicsStateGuardian) that presents a common API to Panda, and internally we have two different implementations: GLGraphicsStateGuardian, which performs OpenGL calls, and DXGraphicsStateGuardian9, which performs DirectX9 calls. The requested implementation is loaded in dynamically according to the Config.prc setting.

So it’s possible to implement other kinds of 3-D API’s by writing a new kind of GraphicsStateGuardian. In fact, in the early days of Panda, we did have a GlideGraphicsStateGuardian, but since no modern cards support Glide, we have long since dropped support for this class. We also used to have a RIBGraphicsStateGuardian, which generated a RenderMan scene file, which could then be passed as input to a raytracer or whatever you like to render the scene in non-realtime. This was fun to play with, but not really useful in a practical sense, so we dropped support for that too.

Nowadays, we only keep support for OpenGL and DirectX8/9, since that seems to pretty much cover the world.

David

Thanks to both - that covered my question quite well. :slight_smile:

Its clear that GLIDE is dead (somehow). Was just an example. An thanks IPKnightly - of course API is the better word. :smiley:

Regards, Bigfoot29