Panda3D
|
00001 // Filename: glxGraphicsPixmap.h 00002 // Created by: drose (10Mar09) 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 GLXGRAPHICSPIXMAP_H 00016 #define GLXGRAPHICSPIXMAP_H 00017 00018 #include "pandabase.h" 00019 00020 #include "glxGraphicsPipe.h" 00021 #include "graphicsBuffer.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : glxGraphicsPixmap 00025 // Description : Another offscreen buffer in the GLX environment. This 00026 // creates a Pixmap object, which is probably less 00027 // efficient than a GLXPBuffer, so this class is a 00028 // second choice to glxGraphicsBuffer. However, this 00029 // might be the only option for some graphics drivers. 00030 //////////////////////////////////////////////////////////////////// 00031 class glxGraphicsPixmap : public GraphicsBuffer { 00032 public: 00033 glxGraphicsPixmap(GraphicsEngine *engine, GraphicsPipe *pipe, 00034 const string &name, 00035 const FrameBufferProperties &fb_prop, 00036 const WindowProperties &win_prop, 00037 int flags, 00038 GraphicsStateGuardian *gsg, 00039 GraphicsOutput *host); 00040 virtual ~glxGraphicsPixmap(); 00041 00042 virtual bool begin_frame(FrameMode mode, Thread *current_thread); 00043 virtual void end_frame(FrameMode mode, Thread *current_thread); 00044 00045 protected: 00046 virtual void close_buffer(); 00047 virtual bool open_buffer(); 00048 00049 private: 00050 X11_Display *_display; 00051 X11_Window _drawable; 00052 Pixmap _x_pixmap; 00053 GLXPixmap _glx_pixmap; 00054 00055 public: 00056 static TypeHandle get_class_type() { 00057 return _type_handle; 00058 } 00059 static void init_type() { 00060 GraphicsBuffer::init_type(); 00061 register_type(_type_handle, "glxGraphicsPixmap", 00062 GraphicsBuffer::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 00073 #include "glxGraphicsPixmap.I" 00074 00075 #endif