I’m new to Panda3D. I’d like to implement an offscreen graphics buffer for some custom rendering I’m experimenting with. I’ve read through the rendering documentation. Is there an example (preferably C++ but Python is OK) that shows how to do this?
The Teapot on TV sample program shows how to do this. It is Python but the API is quite similar for C++. If you run into any specific issues, we’ll be happy to help.
I tried what was suggested however I’m still getting an error:
Panda3D_C++_Test.cpp: In function ‘int main(int, char**)’:
Panda3D_C++_Test.cpp:21: error: no matching function for call to ‘GraphicsEngine::make_buffer(GraphicsWindow*, const std::string&, int, int, int)’
/Applications/Panda3D/1.6.2/include/graphicsEngine.I:121: note: candidates are: GraphicsOutput* GraphicsEngine::make_buffer(GraphicsStateGuardian*, const std::string&, int, int, int)
make: *** [test.o] Error 1
BTW, I’m working on OSX however my MacBook only has an Intel GMA 950 graphics processor. I set the renderer to tinydisplay as this was the only one I could get to work. Could this be a problem?
// Open a new window framework
framework.open_framework(argc, argv);
// Set the window title to My Panda3D Window
framework.set_window_title("Panda3D Sound Source Occlusion Test");
// Open the window
WindowFramework *window = framework.open_window();
// Here is room for your own code.
const string bufferName("myBuffer");
GraphicsOutput* buffer;
buffer = GraphicsEngine::make_buffer(window->get_graphics_window(), bufferName, 0, 100, 100);
// Do the main loop, equal to run() in python
framework.main_loop();
// Close the window framework
framework.close_framework();
return (0);