Panda3D
|
00001 // Filename: osMesaGraphicsBuffer.h 00002 // Created by: drose (09Feb04) 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 OSMESAGRAPHICSBUFFER_H 00016 #define OSMESAGRAPHICSBUFFER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "osMesaGraphicsPipe.h" 00021 #include "graphicsBuffer.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : OsMesaGraphicsBuffer 00025 // Description : An offscreen buffer using direct calls to Mesa. This 00026 // is the only kind of graphics output supported by 00027 // osmesa.h. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_PANDAMESA OsMesaGraphicsBuffer : public GraphicsBuffer { 00030 public: 00031 OsMesaGraphicsBuffer(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 ~OsMesaGraphicsBuffer(); 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 GLenum _type; 00049 PTA_uchar _image; 00050 00051 public: 00052 static TypeHandle get_class_type() { 00053 return _type_handle; 00054 } 00055 static void init_type() { 00056 GraphicsBuffer::init_type(); 00057 register_type(_type_handle, "OsMesaGraphicsBuffer", 00058 GraphicsBuffer::get_class_type()); 00059 } 00060 virtual TypeHandle get_type() const { 00061 return get_class_type(); 00062 } 00063 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00064 00065 private: 00066 static TypeHandle _type_handle; 00067 }; 00068 00069 #include "osMesaGraphicsBuffer.I" 00070 00071 #endif