Low level render-to-texture [Closed]

I’m currently trying to port some code into panda3d from an existing renderer, so I may have the wrong approach… Feel free to give me the right directions if so :wink:!

I’d like to “bypass” the panda3d actual rendering loop, i.e. not attaching everything I want to draw to a PandaNode and then call the main_loop method.

I’m looking for a lower level approach, meaning I’d just like to do the following :

  • setting the framebuffer to draw into (as well as the textures to draw / read from) (GraphicsStateGuardian & GraphicsOutput/GraphicsWindow ?)
  • setting the program/shader to use (Shader & ShaderContext ?)
  • setting the uniforms myself (shader inputs)
  • sending the geom to be drawn using the previously set stuff (Geom::Draw ?)

I read from the documentation that there is a lower-level api, and that no documentation is written yet; So I was thinking that maybe someone could help me with that.

So far, I tried the following :

  • created my Geom, which is drawable inside the the panda framework loop.
  • Tried to render it with it’s draw method, using the default GSG, but failed (black screen, even after a call to do_frame to initialize the various states). Guess I’m missing something there.

Thanks in advance.

Panda3D is a scene graph engine: it is designed to render the things in the scene graph. This is the lowest-level interface to Panda. If you want to draw something, you attach it to the scene graph.

There are no directly-callable methods to draw a single object.

You can do each of the things in your bullet list. You do this by constructing a scene graph that describes each of these things that you want Panda to do. It can be a scene graph with only one node in it, if you only want to draw one thing.


Hmm ok… not what I was hoping, but Thanks.

I’ll try to update my scene graph each time I need to do an offscreen render. If I meet any difficulties, I’ll come back :wink:

Again, thanks

Think of the scene graph as a program to perform a particular sequence of render operations. When you want a sequence of render operations performed, you “write” the program by constructing the appropriate scene graph.

This system means you tell Panda precisely what you want it to do up front, and then it has the flexibility internally to determine how to do that most efficiently, including performing state sorting and binning and, potentially, pipelining through multiple different threads.

If you don’t want Panda to do all that for you, you might be better off without an engine like Panda, and just use the OpenGL API directly.


I was probably on the wrong approach though :wink:
I’m currently looking at some more examples, I think I can actually do what I need by using the scene graph… Especially since this is only for a part of my renderings, and the rest is already using panda’s framework.

(Plus, panda has a lot of usefull features that I need, like the browser plugin and others :wink:)