00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef WGLGRAPHICSBUFFER_H
00016 #define WGLGRAPHICSBUFFER_H
00017
00018 #include "pandabase.h"
00019 #include "graphicsBuffer.h"
00020 #include "glgsg.h"
00021
00022
00023
00024 #include "wglext.h"
00025 #define WIN32_LEAN_AND_MEAN
00026 #include <windows.h>
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class EXPCL_PANDAGL wglGraphicsBuffer : public GraphicsBuffer {
00039 public:
00040 wglGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
00041 const string &name,
00042 const FrameBufferProperties &fb_prop,
00043 const WindowProperties &win_prop,
00044 int flags,
00045 GraphicsStateGuardian *gsg,
00046 GraphicsOutput *host);
00047 virtual ~wglGraphicsBuffer();
00048
00049 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00050 virtual void end_frame(FrameMode mode, Thread *current_thread);
00051
00052 virtual void select_cube_map(int cube_map_index);
00053
00054 virtual void process_events();
00055
00056 virtual bool get_supports_render_texture() const;
00057
00058 protected:
00059 virtual void close_buffer();
00060 virtual bool open_buffer();
00061
00062 private:
00063 void bind_texture_to_pbuffer();
00064 bool rebuild_bitplanes();
00065 void release_pbuffer();
00066
00067 static void process_1_event();
00068
00069 HPBUFFERARB _pbuffer;
00070 HDC _pbuffer_dc;
00071 bool _pbuffer_mipmap;
00072 Texture::TextureType _pbuffer_type;
00073 int _pbuffer_sizex;
00074 int _pbuffer_sizey;
00075 PT(Texture) _pbuffer_bound;
00076
00077 public:
00078 static TypeHandle get_class_type() {
00079 return _type_handle;
00080 }
00081 static void init_type() {
00082 GraphicsBuffer::init_type();
00083 register_type(_type_handle, "wglGraphicsBuffer",
00084 GraphicsBuffer::get_class_type());
00085 }
00086 virtual TypeHandle get_type() const {
00087 return get_class_type();
00088 }
00089 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00090
00091 private:
00092 static TypeHandle _type_handle;
00093
00094 friend class wglGraphicsStateGuardian;
00095 };
00096
00097 #include "wglGraphicsBuffer.I"
00098
00099 #endif