00001 // Filename: graphicsPipe.cxx 00002 // Created by: mike (09Jan97) 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 "config_display.h" 00021 #include "mutexHolder.h" 00022 00023 TypeHandle GraphicsPipe::_type_handle; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: GraphicsPipe::Constructor 00027 // Access: Protected 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 GraphicsPipe:: 00031 GraphicsPipe() { 00032 // Initially, we assume the GraphicsPipe is valid. A derived class 00033 // should set this to false if it determines otherwise. 00034 _is_valid = true; 00035 00036 // Similarly, we initially assume the pipe will support fullscreen 00037 // windows. A derived class can choose to inform us otherwise. 00038 _supports_fullscreen = true; 00039 00040 _display_width = 0; 00041 _display_height = 0; 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: GraphicsPipe::Copy Constructor 00046 // Access: Private 00047 // Description: Don't try to copy GraphicsPipes. 00048 //////////////////////////////////////////////////////////////////// 00049 GraphicsPipe:: 00050 GraphicsPipe(const GraphicsPipe &) { 00051 _is_valid = false; 00052 nassertv(false); 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: GraphicsPipe::Copy Assignment Operator 00057 // Access: Private 00058 // Description: Don't try to copy GraphicsPipes. 00059 //////////////////////////////////////////////////////////////////// 00060 void GraphicsPipe:: 00061 operator = (const GraphicsPipe &) { 00062 nassertv(false); 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: GraphicsPipe::Destructor 00067 // Access: Published 00068 // Description: 00069 //////////////////////////////////////////////////////////////////// 00070 GraphicsPipe:: 00071 ~GraphicsPipe() { 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: GraphicsPipe::get_num_hw_channels 00076 // Access: Public, Virtual 00077 // Description: Returns the number of hardware channels available for 00078 // pipes of this type. See get_hw_channel(). 00079 //////////////////////////////////////////////////////////////////// 00080 int GraphicsPipe:: 00081 get_num_hw_channels() { 00082 return 0; 00083 } 00084 00085 //////////////////////////////////////////////////////////////////// 00086 // Function: GraphicsPipe::get_hw_channel 00087 // Access: Public, Virtual 00088 // Description: Creates and returns an accessor to the 00089 // HardwareChannel at the given index number, which must 00090 // be in the range 0 <= index < get_num_hw_channels(). 00091 // This function will return NULL if the index number is 00092 // out of range or the hardware channel at that index is 00093 // unavailable. 00094 // 00095 // Most kinds of GraphicsPipes do not have any special 00096 // hardware channels available, and this function will 00097 // always return NULL. 00098 //////////////////////////////////////////////////////////////////// 00099 HardwareChannel *GraphicsPipe:: 00100 get_hw_channel(GraphicsWindow *, int) { 00101 return (HardwareChannel*)0L; 00102 } 00103 00104 //////////////////////////////////////////////////////////////////// 00105 // Function: GraphicsPipe::make_gsg 00106 // Access: Protected, Virtual 00107 // Description: Creates a new GSG to use the pipe (but no windows 00108 // have been created yet for the GSG). This method will 00109 // be called in the draw thread for the GSG. 00110 //////////////////////////////////////////////////////////////////// 00111 PT(GraphicsStateGuardian) GraphicsPipe:: 00112 make_gsg(const FrameBufferProperties &properties) { 00113 // shouldnt this method really be pure virtual? it's an error for a pipe to not implement it 00114 display_cat.error() << "Error: make_gsg() unimplemented by graphicsPipe!\n"; 00115 return NULL; 00116 } 00117 00118 //////////////////////////////////////////////////////////////////// 00119 // Function: GraphicsPipe::close_gsg 00120 // Access: Protected, Virtual 00121 // Description: This will be called in the draw thread (the same 00122 // thread in which the GSG was created via make_gsg, 00123 // above) to close the indicated GSG and free its 00124 // associated graphics objects just before it is 00125 // destructed. This method exists to provide a hook for 00126 // the graphics pipe to do any necessary cleanup, if 00127 // any. 00128 //////////////////////////////////////////////////////////////////// 00129 void GraphicsPipe:: 00130 close_gsg(GraphicsStateGuardian *gsg) { 00131 if (gsg != (GraphicsStateGuardian *)NULL) { 00132 gsg->close_gsg(); 00133 } 00134 }