00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GRAPHICSPIPE_H
00016 #define GRAPHICSPIPE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "graphicsDevice.h"
00021 #include "typedReferenceCount.h"
00022 #include "pointerTo.h"
00023 #include "lightMutex.h"
00024 #include "displayInformation.h"
00025
00026 class GraphicsEngine;
00027 class GraphicsOutput;
00028 class GraphicsWindow;
00029 class GraphicsBuffer;
00030 class GraphicsStateGuardian;
00031 class FrameBufferProperties;
00032 class WindowProperties;
00033 class Texture;
00034 class WindowHandle;
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 class EXPCL_PANDA_DISPLAY GraphicsPipe : public TypedReferenceCount {
00059 protected:
00060 GraphicsPipe();
00061 private:
00062 GraphicsPipe(const GraphicsPipe ©);
00063 void operator = (const GraphicsPipe ©);
00064
00065 PUBLISHED:
00066 virtual ~GraphicsPipe();
00067
00068 enum OutputTypes {
00069 OT_window = 0x0001,
00070 OT_fullscreen_window = 0x0002,
00071 OT_buffer = 0x0004,
00072 OT_texture_buffer = 0x0008,
00073 };
00074
00075 enum BufferCreationFlags {
00076
00077 BF_refuse_parasite = 0x0001,
00078 BF_require_parasite = 0x0002,
00079 BF_refuse_window = 0x0004,
00080 BF_require_window = 0x0008,
00081 BF_require_callback_window = 0x0010,
00082
00083
00084 BF_can_bind_color = 0x0040,
00085 BF_can_bind_every = 0x0080,
00086 BF_resizeable = 0x0100,
00087 BF_size_track_host = 0x0200,
00088 BF_rtt_cumulative = 0x0400,
00089 BF_fb_props_optional = 0x0800,
00090 BF_size_square = 0x1000,
00091 BF_size_power_2 = 0x2000,
00092 };
00093
00094 INLINE bool is_valid() const;
00095 INLINE int get_supported_types() const;
00096 INLINE bool supports_type(int flags) const;
00097
00098 INLINE int get_display_width() const;
00099 INLINE int get_display_height() const;
00100
00101 DisplayInformation *get_display_information();
00102 virtual void lookup_cpu_data();
00103
00104 virtual string get_interface_name() const=0;
00105
00106 public:
00107 enum PreferredWindowThread {
00108 PWT_app,
00109 PWT_draw
00110 };
00111 virtual PreferredWindowThread get_preferred_window_thread() const;
00112
00113 INLINE GraphicsDevice *get_device() const;
00114 virtual PT(GraphicsDevice) make_device(void *scrn = NULL);
00115
00116 protected:
00117 virtual void close_gsg(GraphicsStateGuardian *gsg);
00118
00119 virtual PT(GraphicsOutput) make_output(const string &name,
00120 const FrameBufferProperties &fb_prop,
00121 const WindowProperties &win_prop,
00122 int flags,
00123 GraphicsEngine *engine,
00124 GraphicsStateGuardian *gsg,
00125 GraphicsOutput *host,
00126 int retry,
00127 bool &precertify);
00128 virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
00129
00130 LightMutex _lock;
00131
00132 bool _is_valid;
00133 int _supported_types;
00134 int _display_width;
00135 int _display_height;
00136 PT(GraphicsDevice) _device;
00137
00138 DisplayInformation *_display_information;
00139
00140 static const int strip_properties[];
00141
00142 public:
00143
00144 static TypeHandle get_class_type() {
00145 return _type_handle;
00146 }
00147 static void init_type() {
00148 TypedReferenceCount::init_type();
00149 register_type(_type_handle, "GraphicsPipe",
00150 TypedReferenceCount::get_class_type());
00151 }
00152 virtual TypeHandle get_type() const {
00153 return get_class_type();
00154 }
00155 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00156
00157 private:
00158 static TypeHandle _type_handle;
00159 friend class GraphicsEngine;
00160 };
00161
00162 #include "graphicsPipe.I"
00163
00164 #endif