Panda3D

osxGraphicsPipe.h

00001 ////////////////////////////////////////////////////////////////////
00002 //
00003 // PANDA 3D SOFTWARE
00004 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00005 //
00006 // All use of this software is subject to the terms of the revised BSD
00007 // license.  You should have received a copy of this license along
00008 // with this source code in a file named "LICENSE."
00009 //
00010 ////////////////////////////////////////////////////////////////////
00011 
00012 #ifndef OSXGRAPHICSPIPE_H
00013 #define OSXGRAPHICSPIPE_H
00014 
00015 #include "pandabase.h"
00016 #include "graphicsPipe.h"
00017 
00018 #include <Carbon/Carbon.h>
00019 
00020 class osxGraphicsStateGuardian;
00021 class PNMImage;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : osxGraphicsPipe
00025 // Description : This graphics pipe represents the interface for
00026 //               creating OpenGL graphics windows on the various
00027 //               OSX's.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_PANDAGL osxGraphicsPipe : public GraphicsPipe {
00030 public:
00031   osxGraphicsPipe();
00032   virtual ~osxGraphicsPipe();
00033 
00034   virtual string get_interface_name() const;
00035   static PT(GraphicsPipe) pipe_constructor();
00036   virtual PreferredWindowThread get_preferred_window_thread() const;
00037 
00038   static CGImageRef create_cg_image(const PNMImage &pnm_image);
00039 
00040 private:
00041   static void release_data(void *info, const void *data, size_t size);
00042 
00043 protected:
00044   virtual PT(GraphicsOutput) make_output(const string &name,
00045                                          const FrameBufferProperties &fb_prop,
00046                                          const WindowProperties &win_prop,
00047                                          int flags,
00048                                          GraphicsEngine *engine,
00049                                          GraphicsStateGuardian *gsg,
00050                                          GraphicsOutput *host,
00051                                          int retry,
00052                                          bool &precertify);
00053   virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
00054 
00055 public:
00056   static TypeHandle get_class_type() {
00057     return _type_handle;
00058   }
00059   static void init_type() {
00060     GraphicsPipe::init_type();
00061     register_type(_type_handle, "osxGraphicsPipe",
00062                   GraphicsPipe::get_class_type());
00063   }
00064   virtual TypeHandle get_type() const {
00065     return get_class_type();
00066   }
00067   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00068 
00069 private:
00070   static TypeHandle _type_handle;
00071 
00072   friend class osxGraphicsBuffer;
00073 };
00074 
00075 #endif
 All Classes Functions Variables Enumerations