Panda3D

osxGraphicsBuffer.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 OSXGRAPHICSBUFFER_H
00013 #define OSXGRAPHICSBUFFER_H
00014 #include <Carbon/Carbon.h>
00015 
00016 #define __glext_h_
00017 #include <OpenGL/gl.h>
00018 #include <AGL/agl.h>
00019 
00020 #include "pandabase.h"
00021 #include "graphicsBuffer.h"
00022 #include "glgsg.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : osxGraphicsBuffer
00026 // Description : An offscreen buffer in the OSX environment.  This
00027 //               creates an AGLPbuffer.
00028 ////////////////////////////////////////////////////////////////////
00029 class osxGraphicsBuffer : public GraphicsBuffer {
00030 public:
00031   osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, 
00032                     const string &name,
00033                     const FrameBufferProperties &fb_prop,
00034                     const WindowProperties &win_prop,
00035                     int flags,
00036                     GraphicsStateGuardian *gsg,
00037                     GraphicsOutput *host);
00038   virtual ~osxGraphicsBuffer();
00039 
00040   virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00041   virtual void end_frame(FrameMode mode, Thread *current_thread);
00042 
00043 protected:
00044   virtual void close_buffer();
00045   virtual bool open_buffer();
00046 
00047 private:
00048   AGLPbuffer _pbuffer;
00049    
00050 public:
00051   static TypeHandle get_class_type() {
00052     return _type_handle;
00053   }
00054   static void init_type() {
00055     GraphicsBuffer::init_type();
00056     register_type(_type_handle, "osxGraphicsBuffer",
00057                   GraphicsBuffer::get_class_type());
00058   }
00059   virtual TypeHandle get_type() const {
00060     return get_class_type();
00061   }
00062   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00063 
00064 private:
00065   static TypeHandle _type_handle;
00066 
00067   friend class osxGraphicsStateGuardian;
00068 };
00069 
00070 
00071 #endif
 All Classes Functions Variables Enumerations