I want to split the window into 2 halves and show different images into it, but how can i disable the (0,1,0,1) displayregion when i create the other region i set the sort value of both the regions above 0 but still i continue to get the region which spans the window, how do i stop it.
my code:
// splitdisplay.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "displayregion.h"
int _tmain(int argc, char* argv[])
{
PandaFramework framework;
WindowFramework *window;
PT(DisplayRegion) dRegR;
PT(DisplayRegion) dRegL;
NodePath Camc;
NodePath Cam2;
framework.open_framework(argc, argv);
framework.set_window_title("My Panda3D Window");
window = framework.open_window();
dRegR= window->get_graphics_output()->make_display_region(.4,1,0,1);
dRegL= window->get_graphics_output()->make_display_region(0,.4,0,1);
Camc = window->get_camera(0);
Cam2 = window->make_camera();
dRegR->set_camera(Cam2);
dRegL->set_camera(Camc);
dRegL->set_sort(10);
dRegR->set_sort(10);
Camc.set_pos(0,0,3);
Cam2.set_pos(0,-20,3);
NodePath environ = window->load_model(framework.get_models(), "models/environment");
environ.reparent_to(window->get_render());
environ.set_scale(0.25 , 0.25, 0.25);
environ.set_pos(-8, 42, 0);
NodePath pandaActor = window->load_model(framework.get_models(), "panda-model");
pandaActor.set_scale(0.005);
pandaActor.reparent_to(window->get_render());
window->load_model(pandaActor, "panda-walk4");
window->loop_animations(0);
framework.main_loop();
framework.close_framework();
return 0;
}
drwr
December 3, 2011, 3:38pm
2
displayregion->set_active(false);
Thanks for the reply,
I did try that but it would not work the whole window becomes black and blank so i even tried making the other regions active, what to do now?
This code gives the black windows:
// splitdisplay.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "displayregion.h"
int _tmain(int argc, char* argv[])
{
PandaFramework framework;
WindowFramework *window;
PT(DisplayRegion) dRegR;
PT(DisplayRegion) dRegL;
PT(DisplayRegion) dRegW;
NodePath Camc;
NodePath Cam2;
framework.open_framework(argc, argv);
framework.set_window_title("My Panda3D Window");
window = framework.open_window();
dRegW = window->get_display_region_3d();
dRegR= window->get_graphics_output()->make_display_region(.4,1,0,1);
dRegL= window->get_graphics_output()->make_display_region(0,.4,0,1);
Camc = window->get_camera(0);
Cam2 = window->make_camera();
dRegW->set_active(false);
dRegR->set_camera(Cam2);
dRegL->set_camera(Camc);
dRegL->set_sort(10);
dRegR->set_sort(10);
dRegL->set_active(true);
dRegR->set_active(true);
Camc.set_pos(0,0,3);
Cam2.set_pos(0,-20,3);
NodePath environ = window->load_model(framework.get_models(), "models/environment");
environ.reparent_to(window->get_render());
environ.set_scale(0.25 , 0.25, 0.25);
environ.set_pos(-8, 42, 0);
NodePath pandaActor = window->load_model(framework.get_models(), "panda-model");
pandaActor.set_scale(0.005);
pandaActor.reparent_to(window->get_render());
window->load_model(pandaActor, "panda-walk4");
window->loop_animations(0);
framework.main_loop();
framework.close_framework();
return 0;
}
got the soln, you add the line
Camc = window->get_camera(0);
Camc.remove_node();
and make the display region inactive
dRegW = window->get_graphics_output()->get_display_region(0);
dRegW->set_active(false);