Can I use raw C/OpenGL draw routine?

Hi,

I hope one of you Panda experts can help me with this one :slight_smile:

I have a draw routine written in C. It uses OpenGL for rendering.

I would like to use it to draw into a viewport of the main window in Panda3D ( ie, a HUD display ).

To achive this, I am hoping I can do the following:

  1. create a python wrapper around my draw routine
  2. import my library into Panda3D
  3. pass the OpenGL render context to my draw routine
  4. invoke my draw routine after Panda3D has rendered the scene

Is this possible?

Thanx.

It isn’t possible with the current Panda framework–Panda’s not designed to expose the low-level stuff to the application programmer in that way. One of the reasons for this is that Panda is designed to be platform-agnostic, and exposing an OpenGL context would certainly constrain the application that uses this feature to be OpenGL only.

This would be possible if you’re willing to get your hands dirty with C++ and code a customized GraphicsWindow or some similar approach that would perform your callback at the end of the scene.

David

Yes, I would be interested in learning how to do that.

I’ve been programming C/C++/OpenGl for several years now, so that wouldn’t necessarily be tough part for me. I just need to know the right “hooks” into the Panda 3D system.

Is the solution you propose modular? For example, will existing Panda users be able to import it as a lib or module, or would they have to recompile from the entire src, with my modifications?

Thanx!

We could include a post-render hook. But still, it sounds like a weird thing to want to do. What is this for, anyhow?