From 29e29ce8fb73bfc722135a967248735af5397f59 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Mon, 18 Mar 2002 20:48:39 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/wcrdisplay/test_wcr.cxx | 78 +++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 panda/src/wcrdisplay/test_wcr.cxx diff --git a/panda/src/wcrdisplay/test_wcr.cxx b/panda/src/wcrdisplay/test_wcr.cxx new file mode 100644 index 0000000000..436107d8ac --- /dev/null +++ b/panda/src/wcrdisplay/test_wcr.cxx @@ -0,0 +1,78 @@ +// Filename: test_wcr.cxx +// Created by: skyler, based on wgl* file. +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +#include "wcrGraphicsWindow.h" + +PT(GraphicsPipe) main_pipe; +PT(GraphicsWindow) main_win; +PT_NamedNode render; + +void render_frame(GraphicsPipe *pipe) { + GraphicsPipe::wins_iterator wi; + for (wi = pipe->get_win_begin(); + wi != pipe->get_win_end(); + ++wi) { + (*wi)->get_gsg()->render_frame(); + } +} + +void display_func() { + render_frame(main_pipe); +} + +int main() { + + GraphicsPipe::resolve_modules(); + + cout << "Known pipe types:" << endl; + GraphicsPipe::PipeFactory::FactoryTypesIter pti; + for (pti = GraphicsPipe::_factory.get_types_begin(); + pti != GraphicsPipe::_factory.get_types_end(); ++pti) { + cout << " " << (*pti) << endl; + } + cout << "after Known pipe types" << endl; + + GraphicsPipe::PipeFactory& factory = GraphicsPipe::_factory; + GraphicsPipe::PipePrioritiesIter pribegin = + GraphicsPipe::get_priorities_begin(); + GraphicsPipe::PipePrioritiesIter priend = GraphicsPipe::get_priorities_end(); + + GraphicsPipe::PipeParams ps1; + if (pribegin == priend) + main_pipe = factory.instance(InteractiveGraphicsPipe::get_class_type(), + ps1.begin(), ps1.end()); + else + main_pipe = factory.instance(InteractiveGraphicsPipe::get_class_type(), + ps1.begin(), ps1.end(), pribegin, priend); + nassertr(main_pipe != (GraphicsPipe*)0L, 0); + cout << "Opened a '" << main_pipe->get_type().get_name() + << "' interactive graphics pipe." << endl; + + main_win = new wcrGraphicsWindow(main_pipe); +#if 0 + main_win->register_draw_function(display_func); + main_win->main_loop(); +#endif + + return 0; +}