Anaglyph display monitoring in C++

Just trying to monitor an anaglyph stereo rendering directly from C++.

Since I would like to switch Anaglyph mode on and off, I decided not to use the “red-blue-stereo 1” setting in config.prc file.

Here is a piece of code that obviously doesn’t work!

I must admit I’m sort of puzzled trying to find out my way on C++ ShowBase stuff…

Any suggestions?




	// enable anaglyph stereo mode on the window
	// -----------------------------------------
	unsigned int leftColor  = ColorWriteAttrib::C_red;			
	unsigned int rightColor = ColorWriteAttrib::C_blue | ColorWriteAttrib::C_green;
	GraphicsWindow *gwind   = window->get_graphics_window();		
	gwind->set_red_blue_stereo(true, leftColor, rightColor);

	// disable the original, mono DisplayRegion
	DisplayRegion *monoDr = window->get_display_region_3d();
    monoDr->set_active(0);	// disable the default DisplayRegion

	// create a new, stereo DisplayRegion
	StereoDisplayRegion *stereoDr = gwind->make_stereo_display_region();	

	Camera *cam0 = window->get_camera(0);  // *** not sure what I'm doing


	PerspectiveLens *cam_lens = cam0->cam_lens(); // *** this call doesn't exist, but this gives an idea on the desired target action

cam_lens->set_interocular_distance(6.7);			// in cm