Panda3D
 All Classes Functions Variables Enumerations
wglGraphicsPipe.h
00001 // Filename: wglGraphicsPipe.h
00002 // Created by:  drose (20Dec02)
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 #ifndef WGLGRAPHICSPIPE_H
00016 #define WGLGRAPHICSPIPE_H
00017 
00018 #include "pandabase.h"
00019 #include "winGraphicsPipe.h"
00020 
00021 class wglGraphicsStateGuardian;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : wglGraphicsPipe
00025 // Description : This graphics pipe represents the interface for
00026 //               creating OpenGL graphics windows on the various
00027 //               Windows OSes.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_PANDAGL wglGraphicsPipe : public WinGraphicsPipe {
00030 public:
00031   wglGraphicsPipe();
00032   virtual ~wglGraphicsPipe();
00033 
00034   virtual string get_interface_name() const;
00035   static PT(GraphicsPipe) pipe_constructor();
00036 
00037 protected:
00038   virtual PT(GraphicsOutput) make_output(const string &name,
00039                                          const FrameBufferProperties &fb_prop,
00040                                          const WindowProperties &win_prop,
00041                                          int flags,
00042                                          GraphicsEngine *engine,
00043                                          GraphicsStateGuardian *gsg,
00044                                          GraphicsOutput *host,
00045                                          int retry,
00046                                          bool &precertify);
00047   virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
00048 
00049 private:
00050 
00051   static string format_pfd_flags(DWORD pfd_flags);
00052   static void wgl_make_current(HDC hdc, HGLRC hglrc, PStatCollector *collector);
00053 
00054   static bool  _current_valid;
00055   static HDC   _current_hdc;
00056   static HGLRC _current_hglrc;
00057 
00058 public:
00059   static TypeHandle get_class_type() {
00060     return _type_handle;
00061   }
00062   static void init_type() {
00063     WinGraphicsPipe::init_type();
00064     register_type(_type_handle, "wglGraphicsPipe",
00065                   WinGraphicsPipe::get_class_type());
00066   }
00067   virtual TypeHandle get_type() const {
00068     return get_class_type();
00069   }
00070   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00071 
00072 private:
00073   static TypeHandle _type_handle;
00074 
00075   friend class wglGraphicsBuffer;
00076   friend class wglGraphicsWindow;
00077   friend class wglGraphicsStateGuardian;
00078 };
00079 
00080 #include "wglGraphicsPipe.I"
00081 
00082 #endif
 All Classes Functions Variables Enumerations