Panda3D
|
00001 // Filename: tinyWinGraphicsPipe.cxx 00002 // Created by: drose (06May08) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "pandabase.h" 00016 00017 #ifdef WIN32 00018 00019 #include "tinyWinGraphicsPipe.h" 00020 #include "config_tinydisplay.h" 00021 #include "config_windisplay.h" 00022 #include "tinyWinGraphicsWindow.h" 00023 #include "tinyGraphicsBuffer.h" 00024 00025 TypeHandle TinyWinGraphicsPipe::_type_handle; 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: TinyWinGraphicsPipe::Constructor 00029 // Access: Public 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 TinyWinGraphicsPipe:: 00033 TinyWinGraphicsPipe() { 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: TinyWinGraphicsPipe::Destructor 00038 // Access: Public, Virtual 00039 // Description: 00040 //////////////////////////////////////////////////////////////////// 00041 TinyWinGraphicsPipe:: 00042 ~TinyWinGraphicsPipe() { 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: TinyWinGraphicsPipe::get_interface_name 00047 // Access: Published, Virtual 00048 // Description: Returns the name of the rendering interface 00049 // associated with this GraphicsPipe. This is used to 00050 // present to the user to allow him/her to choose 00051 // between several possible GraphicsPipes available on a 00052 // particular platform, so the name should be meaningful 00053 // and unique for a given platform. 00054 //////////////////////////////////////////////////////////////////// 00055 string TinyWinGraphicsPipe:: 00056 get_interface_name() const { 00057 return "TinyPanda"; 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: TinyWinGraphicsPipe::pipe_constructor 00062 // Access: Public, Static 00063 // Description: This function is passed to the GraphicsPipeSelection 00064 // object to allow the user to make a default 00065 // TinyWinGraphicsPipe. 00066 //////////////////////////////////////////////////////////////////// 00067 PT(GraphicsPipe) TinyWinGraphicsPipe:: 00068 pipe_constructor() { 00069 return new TinyWinGraphicsPipe; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: TinyWinGraphicsPipe::make_output 00074 // Access: Protected, Virtual 00075 // Description: Creates a new window or buffer on the pipe, if possible. 00076 // This routine is only called from GraphicsEngine::make_output. 00077 //////////////////////////////////////////////////////////////////// 00078 PT(GraphicsOutput) TinyWinGraphicsPipe:: 00079 make_output(const string &name, 00080 const FrameBufferProperties &fb_prop, 00081 const WindowProperties &win_prop, 00082 int flags, 00083 GraphicsEngine *engine, 00084 GraphicsStateGuardian *gsg, 00085 GraphicsOutput *host, 00086 int retry, 00087 bool &precertify) { 00088 00089 if (!_is_valid) { 00090 return NULL; 00091 } 00092 00093 TinyGraphicsStateGuardian *tinygsg = 0; 00094 if (gsg != 0) { 00095 DCAST_INTO_R(tinygsg, gsg, NULL); 00096 } 00097 00098 // First thing to try: a TinyWinGraphicsWindow 00099 00100 if (retry == 0) { 00101 if (((flags&BF_require_parasite)!=0)|| 00102 ((flags&BF_refuse_window)!=0)|| 00103 ((flags&BF_resizeable)!=0)|| 00104 ((flags&BF_size_track_host)!=0)|| 00105 ((flags&BF_rtt_cumulative)!=0)|| 00106 ((flags&BF_can_bind_color)!=0)|| 00107 ((flags&BF_can_bind_every)!=0)) { 00108 return NULL; 00109 } 00110 if ((flags & BF_fb_props_optional)==0) { 00111 if ((fb_prop.get_aux_rgba() > 0)|| 00112 (fb_prop.get_aux_hrgba() > 0)|| 00113 (fb_prop.get_aux_float() > 0)) { 00114 return NULL; 00115 } 00116 } 00117 return new TinyWinGraphicsWindow(engine, this, name, fb_prop, win_prop, 00118 flags, gsg, host); 00119 } 00120 00121 // Second thing to try: a TinyGraphicsBuffer 00122 if (retry == 1) { 00123 if (((flags&BF_require_parasite)!=0)|| 00124 ((flags&BF_require_window)!=0)) { 00125 return NULL; 00126 } 00127 return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, 00128 flags, gsg, host); 00129 } 00130 00131 // Nothing else left to try. 00132 return NULL; 00133 } 00134 00135 #endif // WIN32