I’m trying to do some 2d rendering to an off-screen buffer. I’d like to use makeCamera2d, but I can’t get it working right.
In the Sample Program Cartoon-Shader, I’ve been playing around with removing the line:
and replacing it with something like:
camera2d = base.makeCamera2d(base.win)
but that doesn’t work… I figure it’s got to be close to it but I’m not sure what.
Hmm, in general, that looks about right–assuming that by “something like” you mean you are not actually using render and base.win, since render is a global that refers to the already-existing 3-d scene graph, and base.win refers to your main window.
If you’re creating an offscreen buffer, it should look something like this:
myBuffer = (..make buffer..)
myScene = NodePath('root')
camera2d = base.makeCamera2d(myBuffer)
Note that reparentTo() is usually preferred to setScene() for cameras, since it’s easier to understand.