00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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 }