Hello, I’m new to Panda3D and I’m trying to make a simple render to texture to see if Panda3D will be useful for my application.
However I have some problems with the snippet of code in the manual.
I get the first tutorial with the panda and his environment and i’m trying to render the environment on a texture and the panda on the render window.
I haven’t even try to use my texture for now.
PT(GraphicsOutput) mybuffer;
PT(Texture) mytexture;
PT(Camera) mycamera;
NodePath mycameraNP;
NodePath myscene;
// Open a new window framework and set the title
framework.open_framework(argc, argv);
framework.set_window_title("My Panda3D Window");
// Open the window
WindowFramework *window = framework.open_window();
camera = window->get_camera_group(); // Get the camera and store it
mybuffer = window->get_graphics_output()->make_texture_buffer("My Buffer", 512, 512);
mytexture = mybuffer->get_texture();
mybuffer->set_sort(-100);
mycamera = new Camera("my camera");
mycameraNP = window->get_render().attach_new_node(mycamera);
myscene = NodePath("My Scene");
mycamera->set_scene(myscene);
// Load the environment model
NodePath environ = window->load_model(framework.get_models(), "models/environment");
environ.reparent_to(myscene);
environ.set_scale(0.25 , 0.25, 0.25);
environ.set_pos(-8, 42, 0);
// Load our panda
NodePath pandaActor = window->load_model(framework.get_models(), "panda-model");
pandaActor.set_scale(0.005);
pandaActor.reparent_to(window->get_render());
// Add our task do the main loop, then rest in peace.
taskMgr->add(new GenericAsyncTask("Spins the camera", &SpinCameraTask, (void*) NULL));
framework.main_loop();
framework.close_framework();
return (0);
Here is my code which is based on the first tutorial.
I tried to make the RTT using some python script to see how it was made in python but it doesn’t work. If someone has an idea it would be great.
Thanks
Zwart