Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/wcrdisplay/test_wcr.cxx

Go to the documentation of this file.
00001 // Filename: test_wcr.cxx
00002 // Created by:  skyler, based on wgl* file.
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include <graphicsPipe.h>
00020 #include <interactiveGraphicsPipe.h>
00021 #include <notify.h>
00022 #include <pt_NamedNode.h>
00023 
00024 #include "wcrGraphicsWindow.h"
00025 
00026 PT(GraphicsPipe) main_pipe;
00027 PT(GraphicsWindow) main_win;
00028 PT_NamedNode render;
00029 
00030 void render_frame(GraphicsPipe *pipe) {
00031   GraphicsPipe::wins_iterator wi;
00032   for (wi = pipe->get_win_begin();
00033        wi != pipe->get_win_end();
00034        ++wi) {
00035     (*wi)->get_gsg()->render_frame();
00036   }
00037 }
00038 
00039 void display_func() {
00040   render_frame(main_pipe);
00041 }
00042 
00043 int main() {
00044 
00045   GraphicsPipe::resolve_modules();
00046 
00047   cout << "Known pipe types:" << endl;
00048   GraphicsPipe::PipeFactory::FactoryTypesIter pti;
00049   for (pti = GraphicsPipe::_factory.get_types_begin();
00050        pti != GraphicsPipe::_factory.get_types_end(); ++pti) {
00051     cout << " " << (*pti) << endl;
00052   }
00053   cout << "after Known pipe types" << endl;
00054 
00055   GraphicsPipe::PipeFactory& factory = GraphicsPipe::_factory;
00056   GraphicsPipe::PipePrioritiesIter pribegin =
00057     GraphicsPipe::get_priorities_begin();
00058   GraphicsPipe::PipePrioritiesIter priend = GraphicsPipe::get_priorities_end();
00059 
00060   GraphicsPipe::PipeParams ps1;
00061   if (pribegin == priend)
00062     main_pipe = factory.instance(InteractiveGraphicsPipe::get_class_type(),
00063                                  ps1.begin(), ps1.end());
00064   else
00065     main_pipe = factory.instance(InteractiveGraphicsPipe::get_class_type(),
00066                                  ps1.begin(), ps1.end(), pribegin, priend);
00067   nassertr(main_pipe != (GraphicsPipe*)0L, 0);
00068   cout << "Opened a '" << main_pipe->get_type().get_name()
00069        << "' interactive graphics pipe." << endl;
00070 
00071   main_win = new wcrGraphicsWindow(main_pipe);
00072 #if 0
00073   main_win->register_draw_function(display_func);
00074   main_win->main_loop();
00075 #endif
00076 
00077   return 0;
00078 }

Generated on Fri May 2 00:44:39 2003 for Panda by doxygen1.3