00001 // Filename: graphicsPipe.h 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 #ifndef GRAPHICSPIPE_H 00020 #define GRAPHICSPIPE_H 00021 00022 #include "pandabase.h" 00023 00024 #include "typedReferenceCount.h" 00025 #include "pointerTo.h" 00026 #include "pmutex.h" 00027 #include "pvector.h" 00028 00029 class HardwareChannel; 00030 class GraphicsWindow; 00031 class GraphicsStateGuardian; 00032 class FrameBufferProperties; 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : GraphicsPipe 00036 // Description : An object to create GraphicsWindows that share a 00037 // particular 3-D API. Normally, there will only be one 00038 // GraphicsPipe in an application, although it is 00039 // possible to have multiple of these at once if there 00040 // are multiple different API's available in the same 00041 // machine. 00042 // 00043 // Often, the GraphicsPipe corresponds to a physical 00044 // output device, hence the term "pipe", but this is not 00045 // necessarily the case. 00046 // 00047 // The GraphicsPipe is used by the GraphicsEngine object 00048 // to create and destroy windows; it keeps ownership of 00049 // the windows it creates. 00050 //////////////////////////////////////////////////////////////////// 00051 class EXPCL_PANDA GraphicsPipe : public TypedReferenceCount { 00052 protected: 00053 GraphicsPipe(); 00054 private: 00055 GraphicsPipe(const GraphicsPipe ©); 00056 void operator = (const GraphicsPipe ©); 00057 00058 PUBLISHED: 00059 virtual ~GraphicsPipe(); 00060 00061 INLINE bool is_valid() const; 00062 INLINE bool supports_fullscreen() const; 00063 00064 INLINE int get_display_width() const; 00065 INLINE int get_display_height() const; 00066 00067 virtual string get_interface_name() const=0; 00068 00069 public: 00070 virtual int get_num_hw_channels(); 00071 virtual HardwareChannel *get_hw_channel(GraphicsWindow *window, int index); 00072 00073 protected: 00074 // The make_window() and make_gsg() interfaces on GraphicsPipe are 00075 // protected; don't try to call them directly. Instead, use 00076 // the interface on GraphicsEngine to make a new window or gsg. 00077 virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); 00078 virtual void close_gsg(GraphicsStateGuardian *gsg); 00079 virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg)=0; 00080 00081 Mutex _lock; 00082 00083 bool _is_valid; 00084 bool _supports_fullscreen; 00085 int _display_width; 00086 int _display_height; 00087 00088 public: 00089 static TypeHandle get_class_type() { 00090 return _type_handle; 00091 } 00092 static void init_type() { 00093 TypedReferenceCount::init_type(); 00094 register_type(_type_handle, "GraphicsPipe", 00095 TypedReferenceCount::get_class_type()); 00096 } 00097 virtual TypeHandle get_type() const { 00098 return get_class_type(); 00099 } 00100 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00101 00102 private: 00103 static TypeHandle _type_handle; 00104 friend class GraphicsEngine; 00105 }; 00106 00107 #include "graphicsPipe.I" 00108 00109 #endif /* GRAPHICSPIPE_H */